- From: Jacek Kopecky <jacek.kopecky@deri.org>
- Date: Wed, 04 Jul 2007 15:50:16 +0200
- To: Steve Harris <swh@ecs.soton.ac.uk>
- Cc: Danny Ayers <danny.ayers@gmail.com>, al@jku.at, semantic-web@w3.org
Steve, good idea, that grouping. Could it be extended for grouping (or arraying) deeper than 1 level? Or even recursively? Could get interesting if every part could have subparts that could have subparts etc. In that case I guess even CONSTRUCTXML would have to be extended, something like: CONSTRUCTXML <catalogue> <product id="{?prodid}"> {CONSTRUCTXML NAMED part <part name="{?partname}"> {CONSTRUCTXML REF part WITH ?prodid=?partname} </part> WHERE { ?prodid hasPart ?partName } } </product> </catalogue> WHERE { ?prodid rdf:type Product } And then it might have to deal with handling loops in the data. Best regards, Jacek On Wed, 2007-07-04 at 14:12 +0100, Steve Harris wrote: > > But the results table will be: > > > > 1 wheel > > 1 engine > > 1 chassis > > 2 antenna > > 2 receiver > > I've run into this problem a lot as well. I can imagine a SPARQL > syntax extension like: > > SELECT DISTINCT ?prodid ?partname > WHERE { ?prodid rdf:type :Product ; > :hasPart ?partName . } > GROUP BY ?prodid > > which could return something like: > ... > <result> > <binding name="prodid"><literal>1</literal></binding> > <binding name="partname"> > <literal>wheel</literal> > <literal>engine</literal> > <literal>chassis</literal> > </binding> > </result> > ... > > If you have it in that form it's a lot easier to do the kind of XSLT > transforms we're talking about. > > That sort of trick may catch SQL users off-guard, it might be worth > writing ARRAY(?partname) or similar. I think it would be pretty handy > given the random and surprising cardinality that RDF predicates often > have in the wild though. > > - Steve >
Received on Wednesday, 4 July 2007 13:50:33 UTC