Bug on changing properties

classic Classic list List threaded Threaded
2 messages Options
ehe
Reply | Threaded
Open this post in threaded view
|

Bug on changing properties

ehe
Hello,

there is a bug in the prop.py when you want to remove and set new data properties of an entity.
In the _callback routine, you are trying to change the difference of the properties (new-old) with _add_data_triple_spod() and _del_data_triple_spod() and you are trying to get the data type of the already existing properties and pass it in the SQL command.

This never deletes data property assertions that are in the ontology without type specification (and also created with owlready2).
FOR EXAMPLE:

<owl:NamedIndividual rdf:about="#entity1">
  <rdf:type rdf:resource="#Entry"/>
  <abbreviation>ex1</abbreviation>
</owl:NamedIndividual> 

The command
abbreviation[entity1] = ["ex2"]

generates the following 2 statements:

* Owlready2 * DEL TRIPLE ex#entity1 ex#abbreviation ex1 http://www.w3.org/2001/XMLSchema#string

* Owlready2 * DEL TRIPLE ex#entity1 ex#abbreviation ex2 http://www.w3.org/2001/XMLSchema#string

This will not delete the first triple, since d is None here.
I recommend to go to _spo at least for deleting the triple and to neglect the type.
Reply | Threaded
Open this post in threaded view
|

Re: Bug on changing properties

Jiba
Administrator
Hello,

The problem was caused by the presence of a literal without datatype. After some research, it appears that such literals should be treated as string (see https://www.w3.org/TR/rdf11-concepts/#section-Graph-Literal : concrete syntaxes MAY support simple literals consisting of only a lexical form without any datatype IRI or language tag. Simple literals are syntactic sugar for abstract syntax literals with the datatype IRI http://www.w3.org/2001/XMLSchema#string).

I fixed that in the development version of Owlready on BitBucket.

Notice that the fix occurs when ontologies are loaded, so, if you are storing the quadstore on disk, you need to recreate it from OWL files.

Jiba