Re: Problem with deleting a value from an infGraph

On Thu, 2010-08-19 at 15:09 +0200, Shamir Nazaraly wrote:
> Hi, 
> 
> 
> I builded the ontology from the software Protégé. I developped a
> method with Jena API  to delete a value inside the ontology:
>  
> public void delete(Node measurement, OWLDatatypeProperty property,
> String value) {
>         
>         Node propertyNode = Node.createURI(property.getURI());
>         Node valueNode = Node.createLiteral(value);
> 
> 
>         infGraph.delete(new
> Triple(measurement, propertyNode , valueNode ));
>     }

Operating a mixture of API (e.g. OWLDatatypeProperty) and SPI (Node) is
a little odd but works.

Any easier way to get the Node corresponding to the API object is:

  property.asNode() 
> This method works correctly..
> For example there is an instance which has a dataType property
> "hasValue" and it contains the value "France":
> 
> 
> http://www.cmf.com/Ontology.owl#PCountryMeasurement
> @http://www.cmf.com/Ontology.owl#hasValue "France"
> 
> 
> After executing the method above, the value is correctly deleted.
> 
> 
> But when I launch Protégé, and I save after rewriting the same value
> deleting "France" , I execute this same method but this value is still
> here.
> 
> 
> Actually, when I change something in the ontology graphically with
> Protégé, I can't delete it with the method above.
> 
> 
> I printed the statement to see what is the problem and I saw this
> statement after rewriting the same value graphically. 
> 
> 
> http://www.cmf.com/Ontology.owl#PCountryMeasurement
> @http://www.cmf.com/Ontology.owl#hasValue
> "France"^^http://www.w3.org/2001/XMLSchema#string
> 
> 
> There is something added to the second statement compared to the first
> statement: ^^http://www.w3.org/2001/XMLSchema#string

A plain literal and a literal with type xsd:string are different nodes
in an RDF graph, though they are semantically equivalent. How well that
equivalence is handled for you automatically depends on the set up, in
particular whether you are using a database (at least with the old RDB
they were stored differently in the database).

Protege is choosing to use the typed literal representation instead of
the plain literal. I would question that choice (you might want
different language tags on your country names) but that's what is
happening.

To create a corresponding typed literal at the SPI level use:

  Node.createLiteral("France", null, XSDDatatype.XSDstring) 
Dave

Received on Friday, 20 August 2010 07:43:06 UTC