0

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:

<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. So any recommendation how do solve this problem?

user3699711
  • 49
  • 1
  • 8

1 Answers1

0

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.

user3699711
  • 49
  • 1
  • 8