Thanks Chris! P Sent from my iPhone
On Dec 16, 2010, at 5:45 PM, "Chris Wilper" <[email protected]> wrote: > Patrick, > > I don't think SPARQL can do that, but the iTQL (Mulgara-specific) walk > function should help in your case: > > http://docs.mulgara.org/itqlcommands/select.html#o1532 > > For example, if you have a tree where the relations are expressed via > fedora-rels-ext:isMemberOf arcs from child to parent, and the tree is > structured like this: > > demo:root > demo:child1 > demo:grandchild1a > demo:child2 > demo:grandchild2a > demo:grandchild2b > > ...then the following query would provide the path from a known > descendent (grandchild2b) to the root: > > select $child $parent from <#ri> > where walk ( > <info:fedora/demo:grandchild2b> > <fedora-rels-ext:isMemberOf> > $parent > and > $child > <fedora-rels-ext:isMemberOf> > $parent > ) > > ...expressed via the following tuples: > > "child","parent" > info:fedora/demo:child2,info:fedora/demo:root > info:fedora/demo:grandchild2b,info:fedora/demo:child2 > > Or, if you want to go from the top down (root and all descendents), > the following query: > > select $parent $child from <#ri> > where walk ( > $child > <fedora-rels-ext:isMemberOf> > <info:fedora/demo:root> > and > $child > <fedora-rels-ext:isMemberOf> > $parent > ) > > ...would expresss the structure of the entire tree as: > > "parent","child" > info:fedora/demo:root,info:fedora/demo:child1 > info:fedora/demo:root,info:fedora/demo:child2 > info:fedora/demo:child1,info:fedora/demo:grandchild1a > info:fedora/demo:child2,info:fedora/demo:grandchild2a > info:fedora/demo:child2,info:fedora/demo:grandchild2b > > I think the latter query is more like what you want, but may quickly > become expensive to run (memory and performance-wise), if the root has > a large number of descendents. > > - Chris > > On Thu, Dec 16, 2010 at 4:25 PM, Yott, Patrick <[email protected]> wrote: >> (fearing the brash laughter this might produce) >> >> Is there a way to perform a RI query that will retrieve all objects within a >> hierarchy? >> >> Consider this case. >> >> We might have a collection object for the chemistry department, which is in >> turn referenced in the RELS-EXT datastreams for 4 collection objects >> (Research Papers, Research Data, Theses, and Stuff). Each of these >> collection objects may (and will quite likely) be similarly referenced by >> additional, ‘deeper down the tree’ collection objects. >> >> I’d like to be able to generate a list of all the collection objects that >> form a tree based on the chemistry object. I can do this relatively easily >> if I create a “shadow” graph in SQL, but I’m not confident that its possible >> with a SPARQL query. >> >> As always, my thanks in advance! >> p >> >> >> Patrick M. Yott >> Digital Library Manager >> Northeastern University Libraries >> 360 Huntington Avenue, SL270 >> Boston, MA 02120 >> p 617.373.4194 >> f 617.373.5409 >> [email protected] > > ------------------------------------------------------------------------------ > Lotusphere 2011 > Register now for Lotusphere 2011 and learn how > to connect the dots, take your collaborative environment > to the next level, and enter the era of Social Business. > http://p.sf.net/sfu/lotusphere-d2d > _______________________________________________ > Fedora-commons-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/fedora-commons-users ------------------------------------------------------------------------------ Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d _______________________________________________ Fedora-commons-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/fedora-commons-users
