简体   繁体   中英

Building a SPARQL query

I need to create a SPARQL query that gives me all the TopicItems contained in a Topic, in the following schema, but I don't know how to do that. 在此处输入图片说明

There is an inverse ObjectProperty named "ContainedIn", I think I must use it, but I don't know exactly how.

You do not need to use any inverse property, as you can place SPARQL variables in any position in a triple pattern. Just supply a variable for the object in your triple pattern:

SELECT ?topicItem
WHERE {
    <...> slo:consistsOf ?topicItem .
}

where <...> needs to be replaced with the IRI of the topic you want to examine.

EDIT: I have omitted the prefix declaration here; as you were already using the prefix slo , I presumed you had already successfully declared it somehow. Of course, a prefix declaration needs to be added unless the SPARQL endpoint somehow knows slo as a pre-defined prefix.

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