My ontology is about Cocktail. This is a cocktail named "AfterGlow"
<owl:Class rdf:about="&cocktails;AfterGlow">
<owl:equivalentClass>
<owl:Class>
<owl:intersectionOf rdf:parseType="Collection">
<owl:Restriction>
<owl:onProperty rdf:resource="&cocktails;aPourIngredient"/>
<owl:someValuesFrom rdf:resource="&cocktails;JusAnanas"/>
</owl:Restriction>
<owl:Restriction>
<owl:onProperty rdf:resource="&cocktails;aPourIngredient"/>
<owl:someValuesFrom rdf:resource="&cocktails;JusOrange"/>
</owl:Restriction>
<owl:Restriction>
<owl:onProperty rdf:resource="&cocktails;aPourIngredient"/>
<owl:someValuesFrom rdf:resource="&cocktails;SiropGrenadine"/>
</owl:Restriction>
<owl:Restriction>
<owl:onProperty rdf:resource="&cocktails;aPourDescription"/>
<owl:hasValue>Descriptoion AfterGlow</owl:hasValue>
</owl:Restriction>
<owl:Restriction>
<owl:onProperty rdf:resource="&cocktails;aPourTitre"/>
<owl:hasValue>AfterGlow</owl:hasValue>
</owl:Restriction>
</owl:intersectionOf>
</owl:Class>
</owl:equivalentClass>
<rdfs:subClassOf rdf:resource="&cocktails;Cocktail"/>
</owl:Class>
JusOrange
means Orange juice
JusAnanas
means Pineapple juice
aPourIngredient
is a property
which means "has(contain) the ingredient"
This is the request which list all my cocktails with theirs rectrictions
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX : <http://www.semanticweb.org/cocktails#>
SELECT *
WHERE {
?Cocktail rdfs:subClassOf :Cocktail.
?Cocktail owl:equivalentClass ?restriction .
}
How can I request for example "select all cocktail which contains JusAnanas AND JusOrange"
You can find my ontology here :
https://s3-eu-west-1.amazonaws.com/ontologycero/cocktailsOnthology.owl
I've already found an ugly request, but it's not usable because we have to know the ontology for use this kind of request.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX : <http://www.semanticweb.org/cocktails#>
SELECT *
WHERE {
?Cocktail rdfs:subClassOf :Cocktail.
?Cocktail owl:equivalentClass ?restriction .
?restriction owl:intersectionOf ?intersection.
?intersection rdf:first ?ingredient1.
?intersection rdf:rest ?rest1.
?rest1 rdf:first ?ingredient2.
?rest1 rdf:rest ?rest2.
?rest2 rdf:first ?ingredient3.
?ingredient1 owl:someValuesFrom :JusAnanas.
?ingredient2 owl:someValuesFrom :JusOrange.
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…