SPARQL:从查询结果中排除数据类型 uri
SPARQL: Exclude datatype uri from query result
我正在尝试在 Protege 上学习 SPARQL 查询,并且我已经添加了一些人来查询电影 ontology,该电影位于:
Movie Ontology
我有以下简单的 sparql 查询:
Query 1: Get all movies and actors having rating more than 7.0
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX mov: <http://www.movieontology.org/2009/10/01/movieontology.owl#>
SELECT ?subject ?actors ?rating
WHERE {
?subject a mov:Movie;
mov:hasActor ?actors;
mov:imdbrating ?rating.
Filter(?rating > "7.0"^^xsd:double)
}
我得到了预期的结果:
问题是我不需要评分栏中的 ^^xsd:double uri !!
如何摆脱 uri“^^http://www.w3.org/2001/XMLSchema#double”。
提前致谢!
使用str
得到词汇部分
SELECT ?subject ?actors (str(?rating) AS ?r)
我正在尝试在 Protege 上学习 SPARQL 查询,并且我已经添加了一些人来查询电影 ontology,该电影位于: Movie Ontology
我有以下简单的 sparql 查询:
Query 1: Get all movies and actors having rating more than 7.0
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX mov: <http://www.movieontology.org/2009/10/01/movieontology.owl#>
SELECT ?subject ?actors ?rating
WHERE {
?subject a mov:Movie;
mov:hasActor ?actors;
mov:imdbrating ?rating.
Filter(?rating > "7.0"^^xsd:double)
}
我得到了预期的结果:
问题是我不需要评分栏中的 ^^xsd:double uri !! 如何摆脱 uri“^^http://www.w3.org/2001/XMLSchema#double”。 提前致谢!
使用str
得到词汇部分
SELECT ?subject ?actors (str(?rating) AS ?r)