I have data for 20 breeds as individual
and their costs, energy level, adaptability level, hypoallergenic, and the purposes of having them as object properties
. I want to retrieve all object properties
in individual.
so far this is my query:
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 .
}
the result show all the breeds ( individual
) with all the object properties
this is screenshot of the result
I need to select just 1 breed ( individual
) and object properties
of that breed.
I already try this query but the result was: 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 .
}
Try this...
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 .
}
Note that you can use variables for properties too. This query will fetch them all, even if you change your ontology :
PREFIX dog: <http://www.owl-ontologies.com/guguk_test.owl#>
SELECT * WHERE {
dog:Basenji ?property ?value
}
Alternatively, you can use the BIND operator to assign the breed you want to retrieve to a variable.
PREFIX dog: <http://www.owl-ontologies.com/guguk_test.owl#>
SELECT * WHERE {
BIND (dog:Basenji AS ?dog)
?dog ?property ?value
}
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.