CODE erstellen:kann nicht DataPropertyAssertion mit OWL API
OWLDataProperty prop = factory.getOWLDataProperty(IRI.create(getOntologyIRI() + "#" + owlDataProp));
OWLNamedIndividual ind = factory.getOWLNamedIndividual(IRI.create(getOntologyIRI() + "#" + owlNamedIndividual));
OWLLiteral lit = factory.getOWLLiteral(val);
OWLDataPropertyAssertionAxiom axiom = factory.getOWLDataPropertyAssertionAxiom(prop, ind, lit);
if(manager.addAxiom(this.ontology, axiom) == ChangeApplied.SUCCESSFULLY)
return saveOntology();
return false;
erstellt:
Aber erwartete Ergebnis wird (manuell erstellt):
Ich versuche, OWLNegativeDataPropertyAssertionAxiom zu erstellen, und es funktioniert einwandfrei. Auch wenn ich zuerst getOWLNegativeDataPropertyAssertionAxiom und dann OWLDataPropertyAssertionAxiom erstelle - funktioniert es.
OWLAPI: owlapi Verteilungs 4.1.4.jar
EDIT:
Erstellt Ontologien:
<?xml version="1.0"?>
<rdf:RDF xmlns="gunkoFB.owl#"
xml:base="gunkoFB.owl"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:gunkoFB="gunkoFB.owl#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<owl:Ontology rdf:about="gunkoFB.owl"/>
<owl:DatatypeProperty rdf:about="gunkoFB.owl#hasFirstName"/>
<owl:NamedIndividual rdf:about="gunkoFB.owl#Michal_Joštiak">
<hasFirstName rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Michal</hasFirstName>
</owl:NamedIndividual>
<?xml version="1.0"?>
<rdf:RDF xmlns="gunkoFB.owl#"
xml:base="gunkoFB.owl"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<owl:Ontology rdf:about="gunkoFB.owl"/>
<owl:DatatypeProperty rdf:about="gunkoFB.owl#hasFirstName"/>
<owl:NamedIndividual rdf:about="gunkoFB.owl#Michal_Joštiak"/>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NegativePropertyAssertion"/>
<owl:sourceIndividual rdf:resource="gunkoFB.owl#Michal_Joštiak"/>
<owl:assertionProperty rdf:resource="gunkoFB.owl#hasFirstName"/>
<owl:targetValue rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Michal</owl:targetValue>
</rdf:Description>
In diesem Fall speichere ich Ontologie als RDF/XML. Vielleicht scheitert es nur Protege. Wenn ich Ontologie als OWL/XML speichere, ist es wieder OK. –