Re: getting rdf query results as an rdf graph

Leo Sauermann wrote:

> A - Returning Graphs
> 
> I do it in jena all the time:
> 
> 	public String execQuery(String query)
> 		throws GnowsisException {
> 		QueryResults qres =
> RequestHandler.getHandler().execQuery(query);
> 		Model target = ModelFactory.createDefaultModel();
> 
> 		// do extraction of bindings
> 		while (qres.hasNext()) {
> 			ResultBinding b = (ResultBinding) qres.next();
> 			b.mergeTriples(target);
> 		}
> 
> 		// print target to string
> 		StringWriter s = new StringWriter();
> 		target.write(s, "RDF/XML-ABBREV");
> 		return s.toString();
> 	}

My knowledge of Jena is rather shallow, so perhaps it's a silly 
question, but: does this actually construct a subgraph of the original 
RDF graph being queried? If so, how do you reconstruct the appropriate 
paths between the retrieved variables? Because that is what 
SeRQL-construct queries do: they return a (transformed) subgraph 
instead of variable bindings.

>>Is this an uncommon approach?
>>Are there disadvantages to this approach compared to using a query
>>result format that binds variables to result values (e.g. rdql)?
> 
> 
> to my knowledge, RDQL is stone age.   When I tried out sesame a year ago,
> you could do a "SELECT * WHERE (x .. y... z)...." query and the return
> variables where not named and not ordered, so you could not know in
> which column which result was. the standard defined a query with a
> useless result.

Things have improved a bit since then. The RDQL implementations in, at 
least, Jena and Sesame now support an RDF syntax that explicitly 
couples variables with values, making it easier to process. See 
http://www.w3.org/2003/03/rdfqr-tests/recording-query-results.html.

Also, Sesame now supports the SeRQL query language (!= RDQL) which is 
a lot more expressive.

> second thing is "left outer join", so optional joins. It is a basic of
> RDQL that a big query fails when one triple misses, this is also bad.
> Something better will come, or perhaps I am not on the latest and
> optional joins are already implemented in sesame.

This is one thing in particular that is implemented in SeRQL.

> Nethertheless, a good publication architecture is needed. In january I
> published gnowsis at http://www.gnowsis.com/wiki/GnowSis/LeoSThesis
> which contains some stuff about "middleware for the semantic web
> desktop".
> 
> I appreciate any well-engineered approach in this direction, it is
> needed to explore these things. 
> 
> thanks for this post, a good thread.

Jeen
-- 
Jeen Broekstra          Aduna BV
Knowledge Engineer      Julianaplein 14b, 3817 CS Amersfoort
http://aduna.biz        The Netherlands
tel. +31(0)33 46599877  fax. +31(0)33 46599877

Received on Friday, 2 April 2004 06:15:51 UTC