<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: RDF Query Languages</title>
	<atom:link href="http://eric.van-der-vlist.com/blog/2004/01/19/520_rdf_query_languages/feed/" rel="self" type="application/rss+xml" />
	<link>http://eric.van-der-vlist.com/blog/2004/01/19/520_rdf_query_languages/</link>
	<description>XML, apiculture et pré-vergers</description>
	<pubDate>Thu, 04 Dec 2008 19:15:11 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Jan Grosse</title>
		<link>http://eric.van-der-vlist.com/blog/2004/01/19/520_rdf_query_languages/#comment-7</link>
		<dc:creator>Jan Grosse</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://eric.van-der-vlist.com/blog/?p=8#comment-7</guid>
		<description>Hi Eric,

you can get tripels as a result from a query if you do something like this:

---------------------------------------------------------------------
SELECT ?s, ?p, ?o
FROM source.rdf
WHERE (?person, vcard:N, ?b),
      (?b, vcard:Given, ?name),
      (?s, ?p, ?o)
AND ((?s eq ?person) &#38;&#38; (?p eq vcard:N) &#38;&#38; (?o eq ?b)) &#124;&#124;
    ((?s eq ?b) &#38;&#38; (?p eq vcard:Given) &#38;&#38; (?o eq ?name))
USING vcard FOR http://www.w3.org/2001/vcard-rdf/3.0
---------------------------------------------------------------------

The triple-pattern (?s, ?p, ?o) in the WHERE-clause ensures that you
retrieve triples from the original rdf-model.

The variables must be bound correctly to the corresponding tripels
(?person, N, ?b) and (?b, Given, ?name). this is done in the (quite
complex) AND-Clause.

As result you get the tripels {(person, N, b), (b, Given, name)} that describe the given name of the persons in the rdf-model.

........

Otherwise, if you want to flatten the name structure of a person from
(person, N, b), (b, Given, name) to (person, givenName, name) that means you want tripels of the form (person, givenName, name) as a result you have to do something tricky like this:

Insert a triple (givenName, someproperty, uniqueid) to your rdf-model and execute following query:

SELECT ?person, ?gn ?givenName
FROM source.rdf
WHERE (?person, vcard:N, ?b),
      (?b, vcard:given, ?givenName),
      (?gn, someproperty, uniqueid)
USING vcard FOR ...

The variable ?gn is bound to the new property givenName.
Now you get new tripels containing the flattened name information.</description>
		<content:encoded><![CDATA[<p>Hi Eric,</p>
<p>you can get tripels as a result from a query if you do something like this:</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
SELECT ?s, ?p, ?o<br />
FROM source.rdf<br />
WHERE (?person, vcard:N, ?b),<br />
      (?b, vcard:Given, ?name),<br />
      (?s, ?p, ?o)<br />
AND ((?s eq ?person) &amp;&amp; (?p eq vcard:N) &amp;&amp; (?o eq ?b)) ||<br />
    ((?s eq ?b) &amp;&amp; (?p eq vcard:Given) &amp;&amp; (?o eq ?name))<br />
USING vcard FOR <a href="http://www.w3.org/2001/vcard-rdf/3.0" rel="nofollow">http://www.w3.org/2001/vcard-rdf/3.0</a><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>The triple-pattern (?s, ?p, ?o) in the WHERE-clause ensures that you<br />
retrieve triples from the original rdf-model.</p>
<p>The variables must be bound correctly to the corresponding tripels<br />
(?person, N, ?b) and (?b, Given, ?name). this is done in the (quite<br />
complex) AND-Clause.</p>
<p>As result you get the tripels {(person, N, b), (b, Given, name)} that describe the given name of the persons in the rdf-model.</p>
<p>&#8230;&#8230;..</p>
<p>Otherwise, if you want to flatten the name structure of a person from<br />
(person, N, b), (b, Given, name) to (person, givenName, name) that means you want tripels of the form (person, givenName, name) as a result you have to do something tricky like this:</p>
<p>Insert a triple (givenName, someproperty, uniqueid) to your rdf-model and execute following query:</p>
<p>SELECT ?person, ?gn ?givenName<br />
FROM source.rdf<br />
WHERE (?person, vcard:N, ?b),<br />
      (?b, vcard:given, ?givenName),<br />
      (?gn, someproperty, uniqueid)<br />
USING vcard FOR &#8230;</p>
<p>The variable ?gn is bound to the new property givenName.<br />
Now you get new tripels containing the flattened name information.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Danny</title>
		<link>http://eric.van-der-vlist.com/blog/2004/01/19/520_rdf_query_languages/#comment-8</link>
		<dc:creator>Danny</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://eric.van-der-vlist.com/blog/?p=8#comment-8</guid>
		<description>Nearly forgot - Neil Deakin's ReoPath is the latest, and I think most developed, of several attempts at an RDF version of XPath :

http://topicalla.mozdev.org/</description>
		<content:encoded><![CDATA[<p>Nearly forgot - Neil Deakin&#8217;s ReoPath is the latest, and I think most developed, of several attempts at an RDF version of XPath :</p>
<p><a href="http://topicalla.mozdev.org/" rel="nofollow">http://topicalla.mozdev.org/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Danny</title>
		<link>http://eric.van-der-vlist.com/blog/2004/01/19/520_rdf_query_languages/#comment-9</link>
		<dc:creator>Danny</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://eric.van-der-vlist.com/blog/?p=8#comment-9</guid>
		<description>Hi Eric,
I've (re)done some RSS (/OCS) aggregator code using Jena (+XSLT front end for non-RDF RSS), and had planned to use RDQL as the primary query mechanisms (eventually hidden by UI). I can't remember the details, but it was possible to get the results into a usable triple form. I've not had much chance to play recently, but when I last looked I got a little stuck on date-based queries.

RSS 1.0 has dates in elements as W3CDTF strings, but I couldn't find a neat way of doing "select items where date &#62; last week" as comparators in (Jena) RDQL only appear to work on numbers (I've not looked into using xsd datatypes in comparisons yet, but I suspect that won't be possible either).

For now I've got a workaround where when the item is loaded into the RDF Model, an additional triple is added with the date as the number of milliseconds since 1970-01-01. Not neat.</description>
		<content:encoded><![CDATA[<p>Hi Eric,<br />
I&#8217;ve (re)done some RSS (/OCS) aggregator code using Jena (+XSLT front end for non-RDF RSS), and had planned to use RDQL as the primary query mechanisms (eventually hidden by UI). I can&#8217;t remember the details, but it was possible to get the results into a usable triple form. I&#8217;ve not had much chance to play recently, but when I last looked I got a little stuck on date-based queries.</p>
<p>RSS 1.0 has dates in elements as W3CDTF strings, but I couldn&#8217;t find a neat way of doing &#8220;select items where date &gt; last week&#8221; as comparators in (Jena) RDQL only appear to work on numbers (I&#8217;ve not looked into using xsd datatypes in comparisons yet, but I suspect that won&#8217;t be possible either).</p>
<p>For now I&#8217;ve got a workaround where when the item is loaded into the RDF Model, an additional triple is added with the date as the number of milliseconds since 1970-01-01. Not neat.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric van der Vlist</title>
		<link>http://eric.van-der-vlist.com/blog/2004/01/19/520_rdf_query_languages/#comment-10</link>
		<dc:creator>Eric van der Vlist</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://eric.van-der-vlist.com/blog/?p=8#comment-10</guid>
		<description>&lt;p&gt;Hi Dan,&lt;/p&gt;&lt;p&gt;You're right that it's an API issue, but the query implementations I have used (starting with Guha's rdfDB) give focus on getting the table of variables binding rather than getting the subgraph.&lt;/p&gt;&lt;p&gt;Thinking about it, that's probably what Dave has in mind when he says that his new Redland query API will return triples as well as table of resources.&lt;/p&gt;&lt;p&gt;Anyway, I am not sure that it's exactly what I need here: more than getting the result back as triples, I'd like to be able to keep them in the database as a sub-graph on which I could run other queries and that can finally serialize as RDF/XML.&lt;/p&gt;&lt;p&gt;Ideally, the subgraph should be manipulated at query level rather than at API level since one may need to join the subgraph to the outer graph. That could be done like you can "select into" in SQL...&lt;/p&gt;&lt;p&gt;Thanks for your answer that has clarified my understanding both RDQL and my own needs.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Hi Dan,</p>
<p>You&#8217;re right that it&#8217;s an API issue, but the query implementations I have used (starting with Guha&#8217;s rdfDB) give focus on getting the table of variables binding rather than getting the subgraph.</p>
<p>Thinking about it, that&#8217;s probably what Dave has in mind when he says that his new Redland query API will return triples as well as table of resources.</p>
<p>Anyway, I am not sure that it&#8217;s exactly what I need here: more than getting the result back as triples, I&#8217;d like to be able to keep them in the database as a sub-graph on which I could run other queries and that can finally serialize as RDF/XML.</p>
<p>Ideally, the subgraph should be manipulated at query level rather than at API level since one may need to join the subgraph to the outer graph. That could be done like you can &#8220;select into&#8221; in SQL&#8230;</p>
<p>Thanks for your answer that has clarified my understanding both RDQL and my own needs.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Brickley</title>
		<link>http://eric.van-der-vlist.com/blog/2004/01/19/520_rdf_query_languages/#comment-11</link>
		<dc:creator>Dan Brickley</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://eric.van-der-vlist.com/blog/?p=8#comment-11</guid>
		<description>&lt;p&gt;
Versa is well worth studying. We are in early days for RDF query, and can do with any/all experience w.r.t. the design tradeoffs involved (www-rdf-rules@w3.org would be grateful for any such findings, I'm sure).
&lt;/p&gt;&lt;p&gt;
The RDQL-like approach is popular in part because it is conceptually very simple: a query is a graph with bits labelled as missing, and the resultset is bindings of that graph to your data.
&lt;/p&gt;&lt;p&gt;
I think there is an answer to your 'where are the triples' query: the response to a query can either be conceptualised as a matched subgraph, or as a more SQL-like tabular resultset. You can transform the latter to the former by plugging values back into the original query clauses.
&lt;/p&gt;&lt;p&gt;
Guha was quite clear about this back in http://www.w3.org/TandS/QL/QL98/pp/enabling.html and I believe RDQL systems are in the same tradition. The proposal is that we think of RDF queries as "simply an RDF model (i.e., a directed labelled graph), some of whose resources and properties may represent variables."
&lt;/p&gt;&lt;p&gt;
Following from that, the idea is that there are two outputs to every query, ie.:
&lt;/p&gt;&lt;blockquote&gt;&lt;ol&gt;&lt;li&gt;
A subgraph (of the KB against which the query is issued) which matches the query.
&lt;/li&gt;&lt;li&gt;A table of sets of legal bindings for the variables, i.e., when these bindings are applied to the variables in the query, we get (1).
&lt;/li&gt;&lt;/ol&gt;&lt;/blockquote&gt;&lt;p&gt;
Since you can get to the former from the latter, you can always find your way back to the 'triples' view. I have no idea offhand whether RDQL implementations offer convenience API calls to support this transformation, but it should be pretty easy. For each row, make some RDF statements by plugging in your result values to the the template-ized RDF statements in the 'WHERE' clause of the query. This story is probably complicated a bit by datatype-based constraints etc., but not much.
&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>
Versa is well worth studying. We are in early days for RDF query, and can do with any/all experience w.r.t. the design tradeoffs involved (www-rdf-rules@w3.org would be grateful for any such findings, I&#8217;m sure).
</p>
<p>
The RDQL-like approach is popular in part because it is conceptually very simple: a query is a graph with bits labelled as missing, and the resultset is bindings of that graph to your data.
</p>
<p>
I think there is an answer to your &#8216;where are the triples&#8217; query: the response to a query can either be conceptualised as a matched subgraph, or as a more SQL-like tabular resultset. You can transform the latter to the former by plugging values back into the original query clauses.
</p>
<p>
Guha was quite clear about this back in <a href="http://www.w3.org/TandS/QL/QL98/pp/enabling.html" rel="nofollow">http://www.w3.org/TandS/QL/QL98/pp/enabling.html</a> and I believe RDQL systems are in the same tradition. The proposal is that we think of RDF queries as &#8220;simply an RDF model (i.e., a directed labelled graph), some of whose resources and properties may represent variables.&#8221;
</p>
<p>
Following from that, the idea is that there are two outputs to every query, ie.:
</p>
<blockquote><ol>
<li>
A subgraph (of the KB against which the query is issued) which matches the query.
</li>
<li>A table of sets of legal bindings for the variables, i.e., when these bindings are applied to the variables in the query, we get (1).
</li>
</ol>
</blockquote>
<p>
Since you can get to the former from the latter, you can always find your way back to the &#8216;triples&#8217; view. I have no idea offhand whether RDQL implementations offer convenience API calls to support this transformation, but it should be pretty easy. For each row, make some RDF statements by plugging in your result values to the the template-ized RDF statements in the &#8216;WHERE&#8217; clause of the query. This story is probably complicated a bit by datatype-based constraints etc., but not much.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric van der Vlist</title>
		<link>http://eric.van-der-vlist.com/blog/2004/01/19/520_rdf_query_languages/#comment-12</link>
		<dc:creator>Eric van der Vlist</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://eric.van-der-vlist.com/blog/?p=8#comment-12</guid>
		<description>Sesame seems very interesting, thanks Dave!</description>
		<content:encoded><![CDATA[<p>Sesame seems very interesting, thanks Dave!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Beckett</title>
		<link>http://eric.van-der-vlist.com/blog/2004/01/19/520_rdf_query_languages/#comment-13</link>
		<dc:creator>Dave Beckett</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://eric.van-der-vlist.com/blog/?p=8#comment-13</guid>
		<description>You should look into Sesame's SERQL which allows you to do the conjunctive
triple queries like the above but also CONSTRUCT a set of triples that
you can then re-apply.  Triples in, triples out - like SQL tables in, tables out.

I found the docs at
http://sesame.aidministrator.nl/publications/users/ch05s06.html</description>
		<content:encoded><![CDATA[<p>You should look into Sesame&#8217;s SERQL which allows you to do the conjunctive<br />
triple queries like the above but also CONSTRUCT a set of triples that<br />
you can then re-apply.  Triples in, triples out - like SQL tables in, tables out.</p>
<p>I found the docs at<br />
<a href="http://sesame.aidministrator.nl/publications/users/ch05s06.html" rel="nofollow">http://sesame.aidministrator.nl/publications/users/ch05s06.html</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
