<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>webr3.org &#187; Edinburgh</title>
	<atom:link href="http://webr3.org/blog/tag/edinburgh/feed/" rel="self" type="application/rss+xml" />
	<link>http://webr3.org/blog</link>
	<description>brain&#039;s on fire!</description>
	<lastBuildDate>Tue, 19 Jul 2011 15:38:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Virtuoso 6, SPARQL + GEO, Sample Queries</title>
		<link>http://webr3.org/blog/linked-data/virtuoso-6-sparqlgeo-and-linked-data/</link>
		<comments>http://webr3.org/blog/linked-data/virtuoso-6-sparqlgeo-and-linked-data/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 23:24:40 +0000</pubDate>
		<dc:creator>nathan</dc:creator>
				<category><![CDATA[linked data]]></category>
		<category><![CDATA[virtuoso]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Edinburgh]]></category>
		<category><![CDATA[Filter]]></category>
		<category><![CDATA[FOAF]]></category>
		<category><![CDATA[Group action]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[London]]></category>
		<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[New York City]]></category>
		<category><![CDATA[Oxford]]></category>
		<category><![CDATA[RDBMS]]></category>
		<category><![CDATA[rdf]]></category>
		<category><![CDATA[RDF Schema]]></category>
		<category><![CDATA[semantic web]]></category>
		<category><![CDATA[SPARQL]]></category>
		<category><![CDATA[text search]]></category>
		<category><![CDATA[United Kingdom]]></category>
		<category><![CDATA[World Wide Web]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[York]]></category>

		<guid isPermaLink="false">http://webr3.org/blog/?p=183</guid>
		<description><![CDATA[Along side a whole host of improvements, the latest version of Virtuoso (Virtuoso 6) has added support for Geo data! One small sentence, one huge leap for mankind; it's vastly importany IMHO because it brings a new kind of link to Linked Data; a location based one.
Very brief intro: SPARQL is a fantastic query language [...]]]></description>
			<content:encoded><![CDATA[<p>Along side a whole host of improvements, the latest version of Virtuoso (<a href="http://bit.ly/dgbAXS">Virtuoso 6</a>) has added support for Geo data! One small sentence, one huge leap for mankind; it's vastly importany IMHO because it brings a new kind of link to Linked Data; a location based one.</p>
<p>Very brief intro: SPARQL is a fantastic query language which works over RDF and thus Linked Data, Virtuoso amongst other things has a powerful QuadStore which can be queried via SPARQL, and Virtuoso's implementation of SPARQL + the extensive suite of extensions they have implemented makes it the most usable and powerful query langauge available (again, in my honest opinion). In short this combination was enough to make me drop normal RDBMS systems and never look back.</p>
<p>Rather than rambling on about how fantastic it is though; here are some Virtuoso specific sample SPARQL (+GEO) queries, which should hopefully wet your appetite and give you some inclination of what can be done.</p>
<h2>Basic Geo Lookups</h2>
<p><strong>Things within 20km of New York City : <a href="http://bit.ly/9IBiVW" target="_blank">RESULTS</a></strong><br />
<code>  SELECT DISTINCT ?resource ?label ?location<br />
  WHERE<br />
  {<br />
    &lt;http://dbpedia.org/resource/New_York_City> geo:geometry ?sourceGEO .<br />
    ?resource geo:geometry ?location ; rdfs:label ?label .<br />
    FILTER( bif:st_intersects( ?location, ?sourceGEO, 20 ) ) .<br />
    FILTER( lang(?label) = "en" )<br />
  }</code></p>
<p><strong>Distance between New York City and London, England : <a href="http://bit.ly/bYNfWO" target="_blank">RESULTS</a></strong><br />
<code>  SELECT (bif:st_distance(?nyl,?ll)) as ?distanceBetweenNewYorkCityAndLondon<br />
  WHERE<br />
  {<br />
    &lt;http://dbpedia.org/resource/New_York_City> geo:geometry ?nyl .<br />
    &lt;http://dbpedia.org/resource/London> geo:geometry ?ll .<br />
  }<br />
 </code></p>
<h2>Querying Time and Space</h2>
<p><strong>All Educational Institutions within 10km of Oxford, UK; ordered by date of establishment : <a href="http://bit.ly/biZEHA" target="_blank">RESULTS</a></strong><br />
<code>SELECT DISTINCT ?thing as ?uri ?thingLabel as ?name ?date as ?established ?matchGEO as ?location<br />
WHERE<br />
{<br />
&lt;http://dbpedia.org/resource/Oxford&gt; geo:geometry ?sourceGEO .<br />
?resource geo:geometry ?matchGEO .<br />
FILTER( bif:st_intersects( ?matchGEO, ?sourceGEO, 5 ) ) .<br />
?thing ?somelink ?resource ; &lt;http://dbpedia.org/ontology/established&gt; ?date ; rdfs:label ?thingLabel . FILTER( lang(?thingLabel) = "en" )<br />
} ORDER BY asc( ?date )<br />
</code><br />
<strong>Historical cross section of events related to Edinburgh and the surrounding area (within 30km) during the 19th century : <a href="http://bit.ly/dfZU43" target="_blank">RESULTS</a></strong><br />
<code>SELECT DISTINCT ?thing ?thingLabel ?dateMeaningLabel ?date ?matchGEO WHERE {<br />
{<br />
SELECT DISTINCT ?thing ?matchGEO<br />
WHERE<br />
{<br />
&lt;http://dbpedia.org/resource/Edinburgh&gt; geo:geometry ?sourceGEO .<br />
?resource geo:geometry ?matchGEO .<br />
FILTER( bif:st_intersects( ?matchGEO, ?sourceGEO, 30 ) ) .<br />
?thing ?somelink ?resource<br />
}<br />
}<br />
{?property rdf:type owl:DatatypeProperty ; rdfs:range xsd:date } .<br />
?thing ?dateMeaning ?date . FILTER( ?dateMeaning in( ?property ) ) . FILTER( ?date &gt;= xsd:gYear("1800") &amp;&amp; ?date &lt;= xsd:gYear("1900") )<br />
?dateMeaning rdfs:label ?dateMeaningLabel . FILTER( lang(?dateMeaningLabel) = "en" ) .<br />
?thing rdfs:label ?thingLabel . FILTER( lang(?thingLabel) = "en" )<br />
} ORDER BY asc( ?date )</code></p>
<h2>Transitivity and Inference (v5 compatible)</h2>
<p><strong>Finding the shortest route between two "things" (HTML and XML in the example) : <a href="http://bit.ly/cJjsBL" target="_blank">RESULTS</a></strong><br />
<code>SELECT ?route ?jump WHERE<br />
{<br />
 { SELECT ?x ?y WHERE { ?x foaf:page ?xpage ; ?predicate ?y . filter( isURI(?y) ) } }<br />
 OPTION ( TRANSITIVE, T_DISTINCT, T_SHORTEST_ONLY, t_in(?x), t_out(?y), t_max(10), t_step('path_id') as ?path, t_step(?x) as ?route, t_step('step_no') AS ?jump )<br />
 . FILTER ( ?y = &lt;http://dbpedia.org/resource/HTML> &#038;& ?x = &lt;http://dbpedia.org/resource/XML> )<br />
}<br />
</code></p>
<p><strong>..and all routes between the two "things" : <a href="http://bit.ly/cQV4AW" target="_blank">RESULTS</a></strong><br />
<code>SELECT ?route ?path ?jump WHERE<br />
{<br />
 { SELECT ?x ?y WHERE { ?x foaf:page ?xpage ; ?predicate ?y . filter( isURI(?y) ) } }<br />
 OPTION ( TRANSITIVE, T_NO_CYCLES, t_in(?x), t_out(?y), t_max(5), t_step('path_id') as ?path, t_step(?x) as ?route, t_step('step_no') AS ?jump )<br />
 . FILTER ( ?y = &lt;http://dbpedia.org/resource/HTML> &#038;& ?x = &lt;http://dbpedia.org/resource/XML> )<br />
}</code></p>
<p><strong>Traversing Ontologies and (Sub)Classes; all subclasses of Person down the hierarchy  : <a href="http://bit.ly/aZ0oOM">RESULTS</a></strong><br />
<code>SELECT DISTINCT ?x WHERE<br />
{<br />
 { SELECT ?x ?y WHERE { ?x rdfs:subClassOf ?y } }<br />
 OPTION ( TRANSITIVE, T_DISTINCT, t_in(?x), t_out(?y), t_step('path_id') as ?path, t_step(?x) as ?route, t_step('step_no') AS ?jump, T_DIRECTION 2 )<br />
 FILTER ( ?y = &lt;http://dbpedia.org/ontology/Person> )<br />
}</code></p>
<h2>Free text search, scores and IRI Ranks (v5 compatible)</h2>
<p><strong>Searching over labels, with text match scores and additional ranks for each iri / resource  : <a href="http://bit.ly/bMNweO">RESULTS</a></strong><br />
<code>SELECT ?s ?page ?label ?textScore (<LONG::IRI_RANK>(?s)) as ?iriRank WHERE {<br />
  ?s foaf:page ?page ; rdfs:label ?label . FILTER( lang(?label) = "en" ) .<br />
  ?label bif:contains 'adobe and flash' option (score ?textScore ) .<br />
}</code></p>
<p><strong>Virtuoso 6.1 (Open Source Edition) released. For features &#038; bug fix details see: <a href="http://bit.ly/dgbAXS">link</a></strong></p>
<p><img src="http://webr3.org/blog/wp-content/uploads/2010/02/spo.jpg" alt="spo" title="spo" width="600" height="250" class="alignnone size-full wp-image-226" /></p>
]]></content:encoded>
			<wfw:commentRss>http://webr3.org/blog/linked-data/virtuoso-6-sparqlgeo-and-linked-data/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

