Summary: subqueries get you some of what you want, but only category queries follow hierarchies automatically.
Raving wrote: > As an interested onlooker hoping to one day see SMW on the wikis I > regularly use, Contact their admins! Vote early and often! :-) > I have a couple of queries about how potentially useful > this extension is. For purposes of these queries, I'll use Keiko > Matsui, Japanese jazz composer and musician, as an example. > > Can relationships and/or their objects be gathered into defined > heirarchies? If I assign a relationship [[born in::Tokyo]] to Keiko > Matsui, can "Tokyo" be heirarchically defined as being within Japan, Yes to "defined", but not really "hierarchically defined". The Tokyo page can have the property [[located in::Japan]] and browsing will reveal a located_in hierarchy (try http://ontoworld.org/wiki/Special:Browse/Japan ). > which would then be similarly defined as being within Asia? I'd like to > see "Keiko Matsui" show up automatically in lists of "People born in > Japan" and "People born in Asia" without manually also assigning the > relationships [[born in::Japan]] and [[born in::Asia]]. Using subqueries (http://ontoworld.org/wiki/Help:Semantic_search#Subqueries ), this query [[born in::<q>[[located in::Japan]]</q>]] will find every page with a Born_in relation to a page that in turn has a Located_in relation to Japan. Try it at http://ontoworld.org/wiki/Special:Ask , it should find Ken Watanabe. Subquerying is pretty nifty and buys a lot. But it doesn't automatically "follow" the Located_in relationship. So [[born in::<q>[[located in::Asia]]</q>]] won't find anyone, even though ontoworld's Japan page says it's located in Asia. You would have to put [[located in::Asia]] on each Japanese city's page, or you would have to explicitly nest another subquery to follow three levels: [[born in::<q>[[located in::<q>[[located in::Asia]]</q>]]</q>]] Also, if all you knew of someone was they were born in Japan, that first query won't find that person, unless the Japan page says Japan itself is [[located in::Japan]]. So either you craft complex queries to catch all the levels of Relation:Located_in, or you add extra redundant Located_in relations to pages to make the simple subquery work. SMW *is* aware of hierarchies of categories. Querying for [[Category:Person]] will find people in the subcategories of person, e.g. Architect. So if SMW's magic handling of categories could be applied to other relations, you could write a query that "follows" the Located_in relationship. I think a more formal expression of your reasonable expectation is that Relation:Located_in is transitive (owl:TransitiveProperty) and reflexive (??), therefore the subquery [[Located in::Japan]] should find everything located in things that are located in things ... that are located in Japan, and also find Japan itself. As I said in my first reply, maybe you could export the RDF and import it into some ontological wonder AI system. By the way, someone wrote interesting text at http://ontoworld.org/wiki/Relation:Located_in explaining why Located_in *isn't* transitive. E.g. Edirne province is located in Turkey, Turkey is both located in Europe and located in Asia, but Edirne province is not located in Asia, only Europe. Saying something is "hierarchical" isn't nearly precise enough, read http://www.w3.org/2001/sw/BestPractices/OEP/SimplePartWhole/ and http://en.wikipedia.org/wiki/Mereology (I haven't :-) ) > Similarly, a person who was /born in /Tokyo should automatically be > considered to be /from /Tokyo, just like those who were not born there > but later moved there. So is it possible to define "born in" as a > heirarchical subset of "from"? In SMW you can add annotations to relation pages for these sort of meta-relationships (e.g. look at http://ontoworld.org/wiki/Relation:Family_member ), but SMW queries won't magically use them. > Having assigned the relationship [[born > in::Tokyo]], I'd like to see "Keiko Matsui" show up in a list of "People > from Tokyo" without also manually assigning the relationship > [[from::Tokyo]]. Not within SMW. As above, you either make more complex queries, or mechanically put redundant information in pages to make simpler queries give the right answers. > Finally, is there an easy way to assign multiple relationships to the > same object? Keiko Matsui is not only a [[composer of::jazz]] but also > a [[musician of::jazz]] and a [[performer of::jazz]]. Is there a way to > put all three relationships on the same link? Yes, amazingly and undocumentedly, [[composer of::musician of::performer of::jazz]] works. I think the help used to document this weird chaining, but it's gone from http://ontoworld.org/wiki/Help:Annotation That style would confuse a lot of human editors. > Or would I have to create > one real and two false links, like [[composer of::jazz|]][[musician > of::jazz|]][[performer of::jazz]]? Would that even work? Yes although I believe you need whitespace after the pipe symbol, thus [[composer of::jazz| ]][[musician of::jazz| ]][[performer of::jazz]] works, and is a more obvious way to annotate than the "chaining" above. > Or would it > be possible to nest the relationships, like [[composer > of::jazz|[[musician of::jazz|[[performer of::jazz]]]]]]? I'm not sure what you expect that to achieve. These are great questions. -- =S Page ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Semediawiki-user mailing list Semediawiki-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-user