W3C home > Mailing lists > Public > public-owl-dev@w3.org > July to September 2010

Re: Problem with deleting a value from an infGraph

From: Dave Reynolds <dave.e.reynolds@gmail.com>
Date: Fri, 20 Aug 2010 08:42:31 +0100
To: Shamir Nazaraly <nazaralyshamir@gmail.com>
Cc: public-owl-dev@w3.org
Message-ID: <1282290151.2454.11.camel@dave-desktop>
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 GMT

This archive was generated by hypermail 2.3.1 : Wednesday, 27 March 2013 09:32:58 GMT