|
From: Jonathan H. <hen...@ya...> - 2005-04-26 19:14:09
|
Hi Richard, Thanks for your response. I've responded inline below: --- Richard Cyganiak <ri...@cy...> wrote: > Hi Jonathan, > > Am 26.04.2005 um 17:10 schrieb Jonathan Hendler: > [...] > > For example - in this case I want all all the mammals and their > > properties > > > > WHERE (?a, rdf:type, myns:Mammal) , (?b, rdfs:domain, ?a) > > > > ?a gives me instances of people and mammals > > but using the whole RDQL above doesn't work. > > Shouldn't ?b be the list of properties for at least Mammal, and maybe > > Persons > > too? > > No, because rdfs:domain connects properties to classes, not properties > to instances. It's > > myns:hasTeeth rdfs:domain myns:Mammal. > > and not > > myns:hasTeeth rdfs:domain ex:Richard. (where ex:richard is a > myns:Mammal). Right, so the problem seems to be the properties of subclasses. (?a rdf:type myns:mammal) , (?a rdf:type ?x), (?y rdfs:domain ?x) Is what I wanted. In the above case, ?a can be be instances of people or mammals, which I hope would be put into ?x. Then I would look for ?y (the properties) which have ?x (people and mammals as a domain) - but that doesn't seem to work either. Hmm. Even your query didn't work . I am using protege and it uses a different rdfs for a namespace, perhaps this is a problem. I used my own RDFS namespace but I guess rap didn't like it (it doesn't highlight as green when I print an html table) So I used createOntProperty() and addDomain to add the properties there. So that solved the first problem. > To get all properties of myns:Mammal, try this: > > WHERE (?property rdfs:domain myns:Mammal) > > To get all properties that are defined on some kind of mammal (like > myns:hasProperName), you would do something like this: I tried a new query and it worked. I didn't need to specify subClass because inferencing is on. WHERE (?a, rdf:type, myNS:Mammal) ,(?a, rdf:type, ?c) ,(?x, rdfs:domain, ?c) , (?a, ?x, ?y) This got the results I desired, because not only did I get properties, I was able to get the values of the properties. > WHERE (?property rdfs:domain ?class), (?class rdfs:subClassOf > myns:Mammal) > > (I didn't actually try anything of this.) > > Cheers, > Richard Thanks for the feedback. For you to show that something worked, that should have worked for me helped me figure out what the problem was! thanks again! |