简体   繁体   中英

Selecting nested locations in SPARQL

I'm using the below demonstration:

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

However I also wish to select the values of a named attribute '?place', for which there is a value contained in each entry of '?location', how do I adjust my query to do this?

I'm not sure I understand correctly what you mean in this phrase:

named attribute '?place', for which there is a value contained in each entry of '?location'

I guess you are looking for something like 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM