2012/4/15 Dave Reynolds <[email protected]> > On 13/04/12 21:36, Andrés Zules wrote: > >> 2012/4/10 Dave >> Reynolds<dave.e.reynolds@**gmail.com<[email protected]> >> > >> >> On 10/04/12 16:09, Andrés Zules wrote: >>> >>> 2012/4/10 Dave Reynolds<dave.e.reynolds@**gma**il.com<http://gmail.com> >>> <dave.e.reynolds@gmail.**com <[email protected]>> >>> >> > 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<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<http://www.co-ode.org/ontologies/pizza/pizza.owl#FourSeasons> >> ) >> DefaultOWLObjectProperty( >> http://www.co-ode.org/**ontologies/pizza/pizza.owl#**hasTopping<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 >
Thanks Dave. I understand "_:b" now, also you are right. The query isn't correct. I write a new query: PREFIX pizza:<http://www.co-ode.org/ontologies/pizza/pizza.owl#> > PREFIX owl:<http://www.w3.org/2002/07/owl#> > PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> > SELECT * > FROM <http://www.co-ode.org/ontologies/pizza/pizza.owl#> > WHERE { > ?Y rdfs:subClassOf ?X . > ?X owl:someValuesFrom pizza:MushroomTopping > } The query's result from sparqler --- http://sparql.org/sparql.html and from protege are the same but from jena the results are many more, I think that the Reasoner produces extra results. https://lh6.googleusercontent.com/-CPGT22JYut8/T4sFV5J3sJI/AAAAAAAAAKo/vCaOBS0tBdk/s903/PizzaQuery.png I learn too much with your help. Thank you very much. - - - Andrés
