Discussion:
How to create annotations of annotations
Jos Lehmann
2016-12-09 10:53:18 UTC
Permalink
Third Attempt with shorter subject and no html

Original Subject: How to create (or copy) annotations of annotations (i.e. axioms) (from a model) to a(nother) model in jena?


Hi there

SITUATION

1. I have an ontology with individuals that have (i) Annotations as well as (ii) Annotations of Annotations.

2. In RDF/XML, (ii) above are expressed as Axioms as in Example#1 below.

3. I manage to extract (ii) from the my RDF ontology using Code#1 below and I get Output#1

PROBLEM

4. I have managed to copy the individuals and their annotations ((i) above) but fail to copy the annotations of annotations ((ii)) to the second model. I have unsuccessfully tried by adding to Code#1 (see upper-case comment) something like:

model2.createResource(thisPropertyOfThisInstanceProperty);



Please let me know if you need more info or you can think of doing this.

Thank you in advance for the advice.
Jos Lehmann

Knowledge Management
Bauhaus Luftfahrt e.V.
GERMANY




Example#1 (RDF/XML Input)

<owl:Axiom>
<owl:annotatedSource rdf:resource="http://www.XXX.net/ontologies/2016/Ls_Ontology.owl#ATR"/>
<owl:annotatedProperty rdf:resource="http://www. XXX.net/ontologies/2016/PS_Ontology.owl#Alias_English_Alias_9"/>
<owl:annotatedTarget xml:lang="en">Whyatr.com</owl:annotatedTarget>
<ps:Disambiguation_English_Word_1 xml:lang="en">airplane</ps:Disambiguation_English_Word_1>
<ps:Disambiguation_English_Word_2 xml:lang="en">airframer</ps:Disambiguation_English_Word_2>
</owl:Axiom>

END-- Example#1



Code#1 (adapted from https://www.google.de/#q=jena+how+to+create+an+axiom+from+a+model+to+another+an+axiom)

ExtendedIterator propertiesOfThisInstanceProperty = model.listSubjectsWithProperty(RDF.type, OWL2.Axiom);
//
while (propertiesOfThisInstanceProperty.hasNext()) {

Resource thisPropertyOfThisInstanceProperty = (Resource) propertiesOfThisInstanceProperty.next();
System.out.println("Found axiom: " + thisPropertyOfThisInstanceProperty.toString());
ExtendedIterator test = thisPropertyOfThisInstanceProperty.listProperties();
// FAILED ADDITION OF CODE IN 4. ABOVE
while (test.hasNext()) {
//
Statement thisPropertyOfNewInstanceProperty = (Statement) test.next();
System.out.println(" Found axiom-related stuff: " + thisPropertyOfNewInstanceProperty.toString());

}


}
END-- Code#1



Output#1

Found axiom: -f670fe7:158df287be1:-7fe4
Found axiom-related stuff: [-f670fe7:158df287be1:-7fe4, http://www. XXX.net/ontologies/2016/PS_Ontology.owl#Disambiguation_English_Word_2, "airframer"@en]
Found axiom-related stuff: [-f670fe7:158df287be1:-7fe4, http://www. XXX.net/ontologies/2016/PS_Ontology.owl#Disambiguation_English_Word_1, "airplane"@en]
Found axiom-related stuff: [-f670fe7:158df287be1:-7fe4, http://www.w3.org/2002/07/owl#annotatedTarget, "Whyatr.com"@en]
Found axiom-related stuff: [-f670fe7:158df287be1:-7fe4, http://www.w3.org/2002/07/owl#annotatedProperty, http://www XXX.net/ontologies/2016/PS_Ontology.owl#Alias_English_Alias_9]
Found axiom-related stuff: [-f670fe7:158df287be1:-7fe4, http://www.w3.org/2002/07/owl#annotatedSource, http://www. XXX.net/ontologies/2016/Ls_Ontology.owl#ATR]
Found axiom-related stuff: [-f670fe7:158df287be1:-7fe4, http://www.w3.org/1999/02/22-rdf-syntax-ns#type, http://www.w3.org/2002/07/owl#Axiom]

END-- Output#1

Loading...