[英]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. 我需要在以下架构中创建一个SPARQL查询,该查询为我提供主题中包含的所有TopicItem,但是我不知道该怎么做。
There is an inverse ObjectProperty named "ContainedIn", I think I must use it, but I don't know exactly how. 有一个名为“ ContainedIn”的反向ObjectProperty,我想必须使用它,但我不知道具体如何。
You do not need to use any inverse property, as you can place SPARQL variables in any position in a triple pattern. 您无需使用任何逆属性,因为可以将SPARQL变量放置在三元模式的任何位置。 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. 其中<...>
需要替换为您要检查的主题的IRI。
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. 因为您已经在使用前缀slo
,所以我想您已经以某种方式成功声明了它。 Of course, a prefix declaration needs to be added unless the SPARQL endpoint somehow knows slo
as a pre-defined prefix. 当然,除非SPARQL端点以某种方式知道slo
作为预定义的前缀,否则需要添加前缀声明。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.