On 13/04/12 21:36, Andrés Zules wrote:
2012/4/10 Dave Reynolds<dave.e.reyno...@gmail.com>
On 10/04/12 16:09, Andrés Zules wrote:
2012/4/10 Dave Reynolds<dave.e.reynolds@**gmail.com<dave.e.reyno...@gmail.com>
Well that ontology is a bit painful to work with at the SPARQL level but
you could query for (untested example):
SELECT * WHERE
{
?pizza rdfs:subClassof [
owl:onProperty pizza:hasTopping;
owl:someValuesFrom pizza:MushroomTopping ] .
}
Dave
Thanks Dave ... I realize on protege and jena this query:
SELECT *
WHERE {
?X ?Y pizza:MushroomTopping .
}
See outputs
https://plus.google.com/photos/116190906023059719803/albums/5730984081208355185
Like I say, for that ontology as I see it when I download it then there
should not be any matches for the query with ?Y = pizza:hasTopping.
I infer that
| _:b2 | owl:someValuesFrom
|
| _:b5 | owl:someValuesFrom
|
| _:b6 | owl:someValuesFrom
|
| _:b7 | owl:someValuesFrom
|
and
DefaultOWLNamedClass(
http://www.co-ode.org/ontologies/pizza/pizza.owl#FourSeasons)
DefaultOWLObjectProperty(
http://www.co-ode.org/ontologies/pizza/pizza.owl#hasTopping) etc etc etc
are the pizzas with MushroomTopping
Why does Jena return _:b* and no return the names? I dont understan why the
results have differences
If you look at the declarations of the relevant Named Classes you see
things like:
<owl:Class rdf:about="#FourSeasons">
<rdfs:label xml:lang="pt">QuatroQueijos</rdfs:label>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="#hasTopping"/>
<owl:someValuesFrom rdf:resource="#MushroomTopping"/>
</owl:Restriction>
</rdfs:subClassOf>
...
Putting that in Turtle to make in clearer:
pizza:FourSeasons a owl:Class;
rdfs:label "QuatroQueijos"@pt;
rdfs:subClassOf [
a owl:Restriction;
owl:onProperty pizza:hasTopping;
owl:someValuesFrom pizza:MushroomTopping;
]
...
So each OWL restriction is represented by a blank-node (an RDF resource
which has no URI). If we want to write that out as a set of separate
triples then you see:
pizza:FourSeasons a owl:Class .
pizza:FourSeasons rdfs:label "QuatroQueijos"@pt .
pizza:FourSeasons rdfs:subClassOf _:b .
_:b a owl:Restriction .
_:b owl:onProperty pizza:hasTopping .
_:b owl:someValuesFrom pizza:MushroomTopping .
The notation _:X is what Turtle uses to represent such blank nodes,
which is what you are seeing in Jena's output.
So all that's happening is that your query is matching the
owl:someValuesFrom part of those restrictions, i.e. the final triple in
the above example. Hence my suggested query quoted above.
Dave