W3C home > Mailing lists > Public > www-rdf-interest@w3.org > April 2004

Re: getting rdf query results as an rdf graph

From: Jeen Broekstra <jeen@aduna.biz>
Date: Fri, 02 Apr 2004 13:15:09 +0200
Message-ID: <406D4B3D.5040408@aduna.biz>
To: leo@gnowsis.com
Cc: 'Phil Dawes' <pdawes@users.sourceforge.net>, www-rdf-interest@w3.org

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 

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 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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:44:49 UTC