我有20个品种的数据individual
,它们的成本,能量水平,适应性水平,低变应原性以及将它们设为object properties
的目的。我想单独检索所有object properties
。
到目前为止,这是我的查询:
PREFIX dog: <http://www.owl-ontologies.com/guguk_test.owl#>
SELECT *
WHERE {
?dog dog:hasAdaptability ?adaptability .
?dog dog:hasCost ?cost .
?dog dog:hasEnergy ?energy .
?dog dog:hasHypoallergenic ?hypoallergenic .
?dog dog:hasPurpose ?purpose .
}
结果显示所有individual
的所有品种(object properties
这是结果的屏幕截图
我只需要选择一个品种(individual
)和该品种的object properties
。
我已经尝试过该查询,但是结果是:no matches found
。
PREFIX dog: <http://www.owl-ontologies.com/guguk_test.owl#>
SELECT *
WHERE {
?dog dog:hasBreeds dog:Basenji .
?dog dog:hasAdaptability ?adaptability .
?dog dog:hasCost ?cost .
?dog dog:hasEnergy ?energy .
?dog dog:hasHypoallergenic ?hypoallergenic .
?dog dog:hasPurpose ?purpose .
}
答案 0 :(得分:2)
尝试一下...
PREFIX dog: <http://www.owl-ontologies.com/guguk_test.owl#>
SELECT *
WHERE {
VALUES ?dog { dog:Basenji } .
?dog dog:hasAdaptability ?adaptability .
?dog dog:hasCost ?cost .
?dog dog:hasEnergy ?energy .
?dog dog:hasHypoallergenic ?hypoallergenic .
?dog dog:hasPurpose ?purpose .
}
答案 1 :(得分:0)
请注意,您也可以将变量用于属性。即使您更改了本体,此查询也会全部获取它们:
PREFIX dog: <http://www.owl-ontologies.com/guguk_test.owl#>
SELECT * WHERE {
dog:Basenji ?property ?value
}
或者,您可以使用BIND operator将要检索的品种分配给变量。
PREFIX dog: <http://www.owl-ontologies.com/guguk_test.owl#>
SELECT * WHERE {
BIND (dog:Basenji AS ?dog)
?dog ?property ?value
}