简体   繁体   English

有没有机会从现有的本体中找到特定的类,并使用jena为它添加等效的类

[英]Is there any opportunities to find specific class from exsisting ontology and add equivalent class to it using jena

Im trying to find a specific class from ontology and add equivalent class to it. 我试图从本体中找到一个特定的类,并添加相应的类。 I have a list of classes where i want to add equivalent class, but im not sure how do find them from ontology and then not writing all the ontology but just adding equivalent class to specific class. 我有一个类列表,我想添加等效的类,但我不知道如何从本体中找到它们,然后不写所有的本体,而只是添加相应的类到特定的类。

Ex: i have a ontology class 例如:我有一个本体课

<owl:Class rdf:about="http://www.w3.org/ns/person#Inimene"> </owl:Class>

and when i find that class from ontology i want to add equivalentClass So that output looks like this: 当我从本体中找到该类时,我想添加equivalentClass,以便输出如下所示:

<owl:Class rdf:about="http://www.w3.org/ns/person#Inimene"> <owl:equivalentClass rdf:resource="http://www.semanticweb.org/dellalienware/ontologies/2019/4/eesti#Person"/> </owl:Class>

i know how do create new ontology using Jena but i dont know how do find spesific class from exsisting ontology and add a new equivalentclass to it. 我知道如何使用Jena创建新的本体,但我不知道如何从现有的本体中找到特定的类并为其添加新的等效类。 So any recommendation how do solve this problem? 那么任何建议如何解决这个问题呢?

i found a solution, not the best way but, first i read my ontology in. then i find all classes from ontology using this snippet: 我找到了一个解决方案,而不是最好的方法,但是,首先我读了我的本体。然后我使用这个片段找到了来自本体的所有类:

    while (classes.hasNext())
{
  OntClass thisClass = (OntClass) classes.next();
  if(thisClass.toString().equals("http://www.w3.org/ns/person#Inimene")){
    thisClass.addEquivalentClass(testClassInstan1);
  }

and finally rewriting ontology. 最后重写本体论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM