[英]How to get individuals data property value in sparql
Hi i am in new to ontologies. 嗨,我是本体的新手。 I have developed a restaurant ontology by Protege software.
我已经通过Protege软件开发了餐厅本体。 But I badly need a SPARQL query that finds property values for all individuals of a class.
但是我非常需要一个SPARQL查询,该查询可以为一个类的所有个体查找属性值。
I want to get a result like: 我想要得到这样的结果:
Angels_n_Gypsies
House #30, Rd No. 19/A, Dhaka 1213, Bangladesh
Just follow the property values... 只需遵循属性值...
SELECT ?rname ?lname
WHERE {
?inst a :Popular_restaurant .
?inst :restaurant_name ?rname .
?inst :Location_name ?lname .
}
But that's just the end result. 但这仅仅是最终结果。 A way to understand SPARQL is to start pedantically.
了解SPARQL的一种方法是徒劳地开始。 For example:
例如:
SELECT ?inst
WHERE {
?inst a :Popular_restaurant .
}
That gets you all members of the class :Popular_restaurant. 这使您成为该类的所有成员:Popular_restaurant。 Then find what properties are defined for each member:
然后找到为每个成员定义了哪些属性:
SELECT ?inst ?p ?o
WHERE {
?inst a :Popular_restaurant .
?inst ?p ?o .
}
And the bindings for p
will tell you what properties are defined for members of this class. p
的绑定将告诉您为该类的成员定义了哪些属性。 So use those values to continuously refine the query. 因此,请使用这些值来不断优化查询。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.