Hello,
I am currently working with SPARQL Update queries together with owlready2 to update my ontology and I came across the following issue:
When I run an INSERT query to insert a triple, this triple might be inserted although it already exists. However, Protégé does not allow me to insert a triple twice.
I reproduced this issue with the following toy ontology:
ONTOLOGY:
<?xml version="1.0"?>
<rdf:RDF xmlns="
http://www.example.org/onto#" xml:base="
http://www.example.org/onto" xmlns:owl="
http://www.w3.org/2002/07/owl#" xmlns:rdf="
http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xml="
http://www.w3.org/XML/1998/namespace" xmlns:xsd="
http://www.w3.org/2001/XMLSchema#" xmlns:onto="
http://www.example.org/onto#" xmlns:rdfs="
http://www.w3.org/2000/01/rdf-schema#"> <owl:Ontology rdf:about="
http://www.example.org/onto"/>
<owl:ObjectProperty rdf:about="
http://www.example.org/onto#OP1"/>
<owl:ObjectProperty rdf:about="
http://www.example.org/onto#OP2"/>
<owl:Class rdf:about="
http://www.example.org/onto#A"/>
<owl:NamedIndividual rdf:about="
http://www.example.org/onto#I1"> <rdf:type rdf:resource="
http://www.example.org/onto#A"/> <OP1 rdf:resource="
http://www.example.org/onto#I2"/> <OP2 rdf:resource="
http://www.example.org/onto#I2"/> </owl:NamedIndividual>
<owl:NamedIndividual rdf:about="
http://www.example.org/onto#I2"> <rdf:type rdf:resource="
http://www.example.org/onto#A"/> </owl:NamedIndividual>
</rdf:RDF>
UPDATE QUERY:
with ontology:
graph.update("""
INSERT {
onto:I1 onto:OP1 onto:I2
}
WHERE {}
""")
Querying the object property of individual I1 by running “ontology.I1.OP1” now delivers
[test.I2, test.I2]
as a result. Running the following SELECT query after the INSERT query delivers:
(rdflib.term.URIRef('
http://www.example.org/onto#I2'),)
(rdflib.term.URIRef('
http://www.example.org/onto#I2'),)
Is this behavior of the INSERT query intended?
Thanks in advance!
Marie