在SPARQL中选择嵌套位置

时间:2017-06-16 12:55:34

标签: nested sparql rdf

我使用以下演示:

SELECT ?performer ?prefLabel ?date ?location WHERE    
{    
?art rdf:type etree:Concert.    
?art rdf:type mo:Performance.    
?art mo:performer ?performer.    
?art skos:prefLabel ?prefLabel.    
?art etree:date ?date.    
?art event:place ?location.    
}     
LIMIT 2

但是我也希望选择一个命名属性的值'?place',其中包含了'?location'的每个条目中包含的值,如何调整我的查询是这样做的?

1 个答案:

答案 0 :(得分:3)

我不确定我在这句话中正确理解你的意思:

  

命名属性'?place',每个都包含一个值   进入'?location'

我猜您正在寻找类似this的内容:

PREFIX mo: <http://purl.org/ontology/mo/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX etree: <http://etree.linkedmusic.org/vocab/>
PREFIX event: <http://purl.org/NET/c4dm/event.owl#>

SELECT ?performer ?prefLabel ?date ?location ?place WHERE 
{    
    ?art a etree:Concert, mo:Performance ;   
         mo:performer ?performer ;    
         skos:prefLabel ?prefLabel ;    
         etree:date ?date ;    
         event:place ?location . 
    ?location etree:location ?place .   
} LIMIT 2