[solved] User defined datatypes not working in OWL 1.X

I seemingly ran into the trouble that user-defined datatypes does not work in OWL 1.X (which is seemingly what the version of Pellet used in Bioclipse does support? TODO: CHECK).

The problem was manifested when trying to do arithmetic operations on the values (like filtering) in a SPARQL query.

So, the following SPARQL query would work:

PREFIX onto: <http://www.nmrshiftdb.org/onto#>
SELECT distinct ?shift
WHERE {
  ?peak onto:hasShift ?shift .
} LIMIT 10

...but not this one:

PREFIX onto: <http://www.nmrshiftdb.org/onto#>
SELECT distinct ?shift
WHERE {
  ?peak onto:hasShift ?shift .
  FILTER ( ?shift > 12.2 &&  ?shift < 12.8 ) .
} LIMIT 10

I tried defnining the custom datatype by the means of the following file (NMRDatatypes.owl):

<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <xsd:simpleType name="nmr:ppm">
  <xsd:restriction base="xsd:double">
  </xsd:restriction>
 </xsd:simpleType>
</xsd:schema>

But, when trying to read this file into Pellet, with the following Bioclipse script:

rdf.importFile(myStore, "runningbioclipse/NMRDatatypes.xsd", "RDF/XML");

...I get the following error:

Running JavaScript...
org.mozilla.javascript.WrappedException: Wrapped java.lang.RuntimeException: Failed to run method (line: #9)
 java.lang.NullPointerException: 
JavaScript done.

The same problem seems to be reported here.

More external links

Suggestion ...

Maybe these ones solve it all:

Update: Problem solved

The problem was solved with the help of a message on the pellet-users mailing list. The problem was partly with an inconsistent combination of pellet and arq (Jena SPARQL package), and partly that namespaces can't be used in atttribute values, which was the case in the nmr-data, so it works after substituting:

<nmr:hasShift rdf:datatype="xsd:decimal"></nmr:hasShift>

...with:
<nmr:hasShift rdf:datatype="http://www.w3.org/2001/XMLSchema#decimal"></nmr:hasShift>

(or in fact, we were using <nmr:hasShift rdf:datatype="nmr:ppm"></nmr:hasShift>, but that didn't work eventhough expanding to the full URI, http://www.nmrshiftdb.org/onto#).