SPARQL:从查询结果中排除数据类型uri

时间:2017-09-24 19:22:35

标签: sparql rdf owl ontology protege

我正在尝试在Protege上学习SPARQL查询,并且我添加了一些个人来查询在以下位置找到的Movie 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)
     }

我得到了预期的结果:

Result

问题是我在评级栏中不需要^^ xsd:double uri !! 如何摆脱uri“^^ http://www.w3.org/2001/XMLSchema#double”。 提前谢谢!

1 个答案:

答案 0 :(得分:2)

使用str获取词汇部分

SELECT ?subject ?actors (str(?rating) AS ?r)