<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  <head>
    <link href="/main.css" type="text/css" rel="stylesheet"/>
  </head>
  <body>
    <div id="left">
      <div class="sideregion">
        <a href="/">
          <img width="90" alt="Uche Ogbuji" height="120" border="0" src="/images/uche-lizbbq.png"/>
        </a>
      </div>
      <hr/>
      <div class="sidebox">
        <div>
          <a href="http://copia.ogbuji.net/files/uogbuji-pubkey.asc">Public key</a>
        </div>
        <div>
          <a href="/tech/">Tech projects</a>
        </div>
        <div>
          <a href="/tech/publications/">Tech publications</a>
        </div>
        <hr/>
        <div>
          <a href="http://copia.ogbuji.net/blog/">Copia (Weblog)</a>
        </div>
        <div>
          <a href="http://del.icio.us/uche">Bookmarks</a>
        </div>
        <div>
          <a href="mailto:uche@ogbuji.net">e-mail address</a>
        </div>
        <div>
          <a href="http://www.flickr.com/photos/21902936@N00/">Flickr (photos)</a>
        </div>
        <div>
          <a href="http://www.advogato.org/person/Uche/">My Diary</a>
        </div>
        <div>
          <a href="/tech/akara/nodes/2003-01-01/pyxml-akara">Python+XML Akara</a>
        </div>
        <div>
          <a href="http://www.oreillynet.com/weblogs/author/1054">O'Reilly Blog</a>
        </div>
        <div>
          <a href="http://www.xmlhack.com/">xmlhack</a>
        </div>
      </div>
      <div class="sideregion">
        <div>
          <a href="http://validator.w3.org/check/referer">
            <img width="88" alt="Valid HTML 4.01!" height="31" border="0" src="http://www.w3.org/Icons/valid-html401"/>
          </a>
        </div>
      </div>
      <div class="sideregion">
        <div style="text-size: x-small;">
          <a href="http://creativecommons.org/licenses/by-sa/1.0/">
            <img src="http://creativecommons.org/images/public/somerights.gif" alt="Creative Commons License" border="0"/>
          </a>
        </div>
      </div>
      <div class="sideregion">
This work is licensed under a
<a href="http://creativecommons.org/licenses/by-sa/1.0/">Creative Commons License</a>.
  </div>
    </div>
    <div id="middle">
      <h1/>
      <div>
        <p>title: Uche Ogbuji: Versa RDF Query Language
csslink: /main.css</p>

<h1>Uche Ogbuji: Versa, the RDF query language</h1>

<p>I am one of the developers of Versa, a query language for RDF. There are many other query languages for RDF, and probably will be at least until the community agrees to standardize. The Versa developers tried most of these and found them unsuitable for various practical reasons. In particular, Versa is designed to be integrated into other programming languages and systems. It is inspired in many ways by XPath, the very successful query language for XML.</p>

<h2>Local Resources</h2>

<p>
          <em>
            <a href="etc/versa-1.0.xml">The Versa specification</a>
          </em>: This is the formal specification for Versa</p>

<p>
          <em>
            <a href="versa-by-example">Versa by example</a>
          </em>: An introduction to Versa, by copious example</p>

<h2>Other Resources</h2>

<p>
          <em>
            <a href="http://lists.fourthought.com/mailman/listinfo/versa">The Versa mailing list</a>
          </em>: The mailing list for the RDF Inference Language (RIL) is the place to discuss or follow Versa, as Versa is the query portion of the larger RIL effort.</p>

<p>
          <em>
            <a href="http://copia.ogbuji.net/blog/keyword/versa">Copia postings on Versa</a>
          </em>
        </p>

<p>
          <em>
            <a href="http://en.wikipedia.org/wiki/Versa">Wikipedia article on Versa</a>
          </em>
        </p>

<p>Also see the articles on Versa listed below</p>

<h2>Why Versa?</h2>

<p>We designed Versa from a very different point of view than other RDF query languages, which are either based on SQL idioms or formal logic idioms. I think we gain some advantages from this fresh approach, including the following:</p>

<ul>
<li>
            <strong>Strong alignment with XML.</strong> From the start we designed Versa for integration into other XML processing technologies. For example, we use Versa directly from XSLT, in which we can process query results in XML form.</li>
<li>
            <strong>XPath-like idiom</strong>. The Versa syntax is inspired by XPath. We did have to make some key deviations in order to accommodate the fact that RDF is a graph rather than a hierarchy, but Versa chained traversals should be familiar to those who have worked with XPath location paths. Other matters such as the emphasis on function borrow strengths from XPath.</li>
<li>
            <strong>Extensibility</strong>. Versa borrows XPath's extension mechanism, allowing users to add needed features to Versa in a standard way.</li>
<li>
            <strong>Ease of learning</strong>. Many users have reported that they become proficient very quickly with Versa. Some other RDF query languages have the advantage of similarity to the popular SQL, but this doesn't help those with no SQL background. Also, RDF differs enough from SQL that it is easy to run into model mismatches that the syntax doesn't make clear.</li>
<li>
            <strong>Querying features</strong>. Versa offers features that are unfortunately sparse in RDF query languages, such as a full complement of logical and string operations.</li>
</ul>

<p>Andrew Kuchling had some kind words in his <a href="http://www.amk.ca/xml/rdf-notes.html">RDF scratch pad</a>.</p>

<blockquote>
  <p>Versa is an RDF query language invented by Uche Ogbuji and Mike Olson. I like the look of it; the Versa specification is brief, about 16 pages or so, and the query language is simple and nicely orthogonal. This is a nice change from the elephantine bulk of most other RDF query languages that I've looked at.</p>
</blockquote>

<p>Andreas Harth sent me the following note on Versa:</p>

<blockquote>
  <p>some folk on rdfig suggested to look into Versa for my problem with querying and extracting information out of my ontology. I am currently writing on my degree thesis and I was in need for a quick and easy way to extract some data out of the ontology to include it into the thesis document. <br/>
  Before that, I wrote some middleware using tomcat and Jena API which is okay. I considered for my problem the same approach but implementing it using Jena would take more time than I have. So I tried Versa, which looked familiar because of the similar syntax to xsl and bingo, it worked! <br/>
  _Many thanks for providing the 4versa query processor - and maybe even more important - the excellent documentation! I read some of your articles on developerworks and elsewhere, they are really cool. Again, thanks and keep up the good work!</p>
</blockquote>

<p>In <a href="http://www.xml.com/pub/a/2002/06/26/vocabularies.html">Cataloging XML Vocabularies</a>, Eric van der Vlist explains his choice of Versa as follows:</p>

<blockquote>
  <p>Some features of Versa, such as its ability to define aggregates, were missing from the RDF query languages which I have been using in the past and they are needed for this project.</p>
</blockquote>

<p>More recently, in <a href="http://eric.van-der-vlist.com/blog/568_SPARQL_Versus_Versa.item">"SPARQL Versus Versa"</a>, Eric writes:</p>

<blockquote>
  <p>As far as I know, there is only one RDF query language that support these features: 4Suite's Versa query language. <br/>
  Versa is so different from SPARQL that these two languages are as difficult to compare as, let's say the W3C XML Schema's XML syntax and the RELAX NG's compact syntax. <br/>
  Instead of trying to bend the well known SQL syntax to make it work on triples, Versa has defined a totally new language for the purpose of traversing triples data stores. <br/>
  The result is surprising. You won't find anything that will remind you of SQL and, to take an example from "Versa by example", to get a list of people's first names sorted by their age, you'd write: <code>"sortq(all(), ".-o:age-&gt;*", vsort:number) - o:fname -&gt; *"</code> <br/>
  If you insist and don't let the first surprise stop you, the second surprise is that this language is working incredibly well. During the (unfortunately too few) opportunities I have had to work with Versa, I have never been blocked by a limit of the language like I had been with rdfDB or would be with SPARQL.</p>
</blockquote>

<h2>Articles on Versa</h2>

<p>
          <a href="http://www-106.ibm.com/developerworks/xml/library/x-think10/index.html">Thinking XML 10 [column]: Jump-starting knowledge management with RDF, part 6: RDF Query using Versa</a>
        </p>

<p>2002-04   in <a href="http://www.ibm.com/developerworks">IBM developerWorks</a>
        </p>

<p>
          <a href="http://www.xml.com/pub/a/2005/07/20/versa.html">"Versa: Path-Based RDF Query Language"</a>
        </p>

<p>2005-07-20 in <a href="http://xml.com">XML.com</a>
        </p>

<h2>See also</h2>

<p>
          <em>
            <a href="http://protege.stanford.edu/conference/2004/posters/Maycotte.pdf">"RDF transportable organization databases"</a>
          </em> <a href="etc/Maycotte-overview.pdf">PDF], by Leonardo Maycotte, which describes a project where Versa was used to query RDF information authored in Protégé.  Here are local mirrors of [Maycotte's overview</a>, <a href="etc/Maycotte-rdfposter.pdf">his poster</a>, <a href="etc/Maycotte-rdfarticle.pdf">his poster in article form</a>, and the <a href="etc/Maycotte-rdfapp.tar.gz">source code for the referenced application</a>.</p>

<p>
          <em>
            <a href="http://139.91.183.30:9090/RDF/publications/tr308.pdf">A survey of RDF query and storage systems</a>
          </em>: Published by researchers at several European universities, covers Versa in the section on query languages (but not the 4Suite repository in the section on storage systems). <em>
            <a href="/tech/pubs/tr308.pdf">locally archived copy</a>
          </em>.</p>

<p>
          <em>
            <a href="http://www.xml.com/pub/a/2002/06/26/vocabularies.html">Cataloging XML Vocabularies</a>
          </em>: In this article on surveying XML vocabularies on the Web, Eric describes how he used 4Suite to manage search results, and Versa to query them.</p>

<p>
          <em>
            <a href="http://rdfstore.sourceforge.net/2002/06/24/rdf-query/">RDF Query and Rule languages Use Cases and Examples survey</a>
          </em>: A project to compare various RDF query languages by use cases. There are Versa examples for most of the use cases.</p>
</div>
    </div>
  </body>
</html>