Reputation: 4481
I have an ontology instance that imports other ontology instances and I'm trying to state a relationship using an ObjectProperty
between an individual of the import (professors-instance
or acm-ccs-lite-core
) and an individual of the main ontology instance (curricula-instance
).
If I do it by hand using protege it creates:
<!-- http://www.semanticweb.org/lsarni/ontologies/professors-instance#Andrés_Calviño -->
<rdf:Description rdf:about="http://www.semanticweb.org/lsarni/ontologies/professors-instance#Andrés_Calviño">
<curricula:inChargeOf rdf:resource="http://www.semanticweb.org/lsarni/ontologies/curricula-instance#Software_Architecture"/>
</rdf:Description>
<!-- http://www.semanticweb.org/lulas/ontologies/2018/acm-ccs-lite-core#10011119 -->
<rdf:Description rdf:about="http://www.semanticweb.org/lulas/ontologies/2018/acm-ccs-lite-core#10011119">
<curricula:taughtIn rdf:resource="http://www.semanticweb.org/lsarni/ontologies/curricula-instance#Databases_1"/>
</rdf:Description>
But the way I'm trying to do it using owl api it creates a NamedIndividual
in the main ontology instead and adds the relationship like this:
<!-- http://www.semanticweb.org/lsarni/ontologies/professors-instance#Andrés_Calviño -->
<owl:NamedIndividual rdf:about="http://www.semanticweb.org/lsarni/ontologies/professors-instance#Andrés_Calviño">
<curricula:inChargeOf rdf:resource="http://www.semanticweb.org/lsarni/ontologies/curricula-instance#Software_Architecture"/>
</owl:NamedIndividual>
This is the code I'm using:
File file = new File("C:\\Users\\lulas\\Documents\\Curricula Ontology\\curricula-instance.owl");
OWLOntology o = man.loadOntologyFromOntologyDocument(file);
OWLDataFactory df = o.getOWLOntologyManager().getOWLDataFactory();
IRI curriculaIOR = IRI.create("http://www.semanticweb.org/lsarni/ontologies/curricula");
IRI instanceIOR = IRI.create("http://www.semanticweb.org/lsarni/ontologies/curricula-instance");
IRI profInstanceIOR = IRI.create("http://www.semanticweb.org/lsarni/ontologies/professors-instance");
OWLObjectProperty charge = df.getOWLObjectProperty(curriculaIOR + "#inChargeOf");
OWLIndividual individual = df.getOWLNamedIndividual(profInstanceIOR + "#Andrés_Calviño");
OWLIndividual course = df.getOWLNamedIndividual(instanceIOR + "#Software_Architecture");
OWLObjectPropertyAssertionAxiom objAssertion = df.getOWLObjectPropertyAssertionAxiom(charge, individual, course);
AddAxiom addAxiom = new AddAxiom(o, objAssertion);
man.applyChange(addAxiom);
Which is the correct way of creating a rdf:Description
?
I'm using Protege version 5.2.0 on windows.
As you both said the code was correct, I was using the incorrect IRI for one of the imported ontologies, that's why it was acting as this NamedIndividual
s where different.
Upvotes: 0
Views: 51
Reputation: 10684
An rdf:Description with an
rdf:about` IRI is equivalent to a named individual, so there is no real difference between the two versions. They will be parsed as the same thing by OWL API.
Not sure why Protege is outputting it in that format - as Henriette asked in the comment, which version of Protege is doing this?
Upvotes: 2