Nij*_*ain 2 ontology sparql protege4 protege
嗨,我是本体论新手。我通过 Protege 软件开发了一个餐厅本体。但我非常需要一个 SPARQL 查询来查找类中所有个体的属性值。
我想得到这样的结果:
Angels_n_Gypsies
House #30, Rd No. 19/A, Dhaka 1213, Bangladesh
Run Code Online (Sandbox Code Playgroud)
只需遵循属性值...
SELECT ?rname ?lname
WHERE {
?inst a :Popular_restaurant .
?inst :restaurant_name ?rname .
?inst :Location_name ?lname .
}
Run Code Online (Sandbox Code Playgroud)
但这只是最终结果。理解 SPARQL 的一种方法是从学究式开始。例如:
SELECT ?inst
WHERE {
?inst a :Popular_restaurant .
}
Run Code Online (Sandbox Code Playgroud)
这将为您提供该类的所有成员:Popular_restaurant。然后查找为每个成员定义了哪些属性:
SELECT ?inst ?p ?o
WHERE {
?inst a :Popular_restaurant .
?inst ?p ?o .
}
Run Code Online (Sandbox Code Playgroud)
的绑定p将告诉您为此类的成员定义了哪些属性。因此,请使用这些值来不断优化查询。
| 归档时间: |
|
| 查看次数: |
5732 次 |
| 最近记录: |