问题
I'm using SPARQL-DL with OWL-API in a Java application. The Maven dependency is the following:
<dependency>
<groupId>edu.stanford.protege</groupId>
<artifactId>de-derivo-sparqldlapi</artifactId>
<version>2.0.0</version>
</dependency>
I assume it downloads the right (compatible) version of OWL-API. I have a class Person with some individuals. Each individual has a data property called name which ranges over a string.
By running this query:
SELECT ?x WHERE { PropertyValue(?y, my:name, ?x) }
I get this:
?de.derivo.sparqldlapi.Var@78 = ?"Andrea"^^xsd:string
?de.derivo.sparqldlapi.Var@78 = ?"Pippo"^^xsd:string
?de.derivo.sparqldlapi.Var@78 = ?"Pluto"^^xsd:string
I'm not able to get all the individuals having name equal to Pluto.
SELECT ?p WHERE { PropertyValue(?p, my:name, "Pluto") }
returns an empty set and
SELECT ?p WHERE { PropertyValue(?p, my:name, "Pluto^^xsd:string") }
returns an empty set
Any help? Thanks in advance.
回答1:
The datatype has to be put outside of the quotes, i.e. "Pluto"^^xsd:string
Unfortunately, from the source code I can see that the SPARQL-DL API doesn't support datatypes, see here . All literals are handled as plain literals. I think you should open a feature request or implement it by yourself and then make a pull request.
来源:https://stackoverflow.com/questions/40870730/sparql-dl-query-for-literals