2017-09-24 117 views
0

我努力學習SPARQL查詢的門生,我增加了一些人對電影本體查詢時發現: Movie OntologySPARQL:排除從查詢結果數據類型URI

我有以下簡單的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」。 在此先感謝!

回答

2

使用str得到詞彙部分

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