SPARQL-DL: query for literals

拜拜、爱过 提交于 2019-12-11 06:15:04

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!