<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss1full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns="http://purl.org/rss/1.0/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0"><channel rdf:about="http://blogs.talis.com/n2"><title>n²</title><link>http://blogs.talis.com/n2</link><description>All about developing with the Talis Platform</description><dc:language>en</dc:language><image rdf:resource="http://blogs.talis.com/n2/wp-content/plugins/podpress/images/powered_by_podpress.jpg" /><dc:rights>©</dc:rights><dc:creator>ian.davies@talis.com</dc:creator><dc:date>2009-11-01T15:50:46-08:00</dc:date><sy:updatePeriod xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">hourly</sy:updatePeriod><sy:updateFrequency xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">1</sy:updateFrequency><itunes:keywords xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" /><itunes:subtitle xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" /><itunes:summary xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">All about developing with the Talis Platform</itunes:summary><itunes:author xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" /><itunes:category xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" text="Society &amp; Culture" /><itunes:owner xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
			<itunes:name />
			<itunes:email>ian.davies@talis.com</itunes:email>
		</itunes:owner><itunes:block xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">No</itunes:block><itunes:explicit xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">no</itunes:explicit><itunes:image xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" href="http://blogs.talis.com/n2/wp-content/plugins/podpress/images/powered_by_podpress_large.jpg" /><items><rdf:Seq><rdf:li rdf:resource="http://blogs.talis.com/n2/?p=887" /><rdf:li rdf:resource="http://blogs.talis.com/n2/?p=872" /><rdf:li rdf:resource="http://blogs.talis.com/n2/?p=854" /><rdf:li rdf:resource="http://blogs.talis.com/n2/?p=836" /><rdf:li rdf:resource="http://blogs.talis.com/n2/?p=818" /><rdf:li rdf:resource="http://blogs.talis.com/n2/?p=791" /><rdf:li rdf:resource="http://blogs.talis.com/n2/?p=770" /><rdf:li rdf:resource="http://blogs.talis.com/n2/?p=746" /><rdf:li rdf:resource="http://blogs.talis.com/n2/?p=722" /><rdf:li rdf:resource="http://blogs.talis.com/n2/?p=659" /></rdf:Seq></items><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/talis/n2" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /></channel><image rdf:about="http://blogs.talis.com/n2/wp-content/plugins/podpress/images/powered_by_podpress.jpg"><url>http://blogs.talis.com/n2/wp-content/plugins/podpress/images/powered_by_podpress.jpg</url><title>n²</title><link>http://blogs.talis.com/n2</link></image><item rdf:about="http://blogs.talis.com/n2/?p=887"><title>Introducing Pynappl</title><link>http://feedproxy.google.com/~r/talis/n2/~3/_ZM8-P1ajLQ/887</link><dc:subject>Uncategorized</dc:subject><dc:creator>Ian Davis</dc:creator><dc:date>2009-11-01T15:41:08-08:00</dc:date><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>Over the summer I spent some time working on a Python library for working with the <a href="http://www.talis.com/platform">Talis Platform</a>. I&#8217;ve spent a lot of time developing the PHP-based <a href="http://code.google.com/p/moriarty/">Moriarty</a> library and I&#8217;ve been wanting to apply that experience to other languages. Leigh has made good progress on the Ruby front with <a href="http://blogs.talis.com/n2/archives/290">Pho</a> and we have a nascent Java-based client: <a href="http://code.google.com/p/penry/">Penry</a>. Considering Python&#8217;s excellent RDF support it seemed the natural choice to tackle next.</p>
<p><a href="http://code.google.com/p/pynappl/">Pynappl</a> is the resulting library. It&#8217;s still very early in its evolution and so has lots of rough edges, gaps and rather dubious design choices.  So far Pynappl&#8217;s feature set has been driven by the real applications I have been working with so there is a distinct bias towards data loading and management of stores. The Store class is the workhorse of the library and contains methods for loading RDF, running SPARQL queries, scheduling jobs and reading and writing of field/predicate maps and query profiles.</p>
<p>In keeping with my general philosophy for building RESTful applications, the HTTP based methods on the Store class make it very obvious that you are working with a fallible network by returning a tuple containing the HTTP reswponse and the body of the response. Its up to you to use or ignore the response as you see fit for your application. Many methods attempt to interpret the results of the method call but this can be switched off using an argument called &#8220;raw&#8221;. For example this code takes advantage of the interpretation and parsing of the SPARQL results:</p>
<pre><code>store = pynappl.Store(store_uri, username, password)
(response, body) = store.select("select * where {?s a ?o} limit 10")
(sparql_header, results) = body
for result in results:
    print "%s (a %s)" % (str(result['s']), str(result['o']))</code></pre>
<p>This can be switched off to get at the raw response body:</p>
<pre><code>(response, body) = store.select("select * where {?s a ?o} limit 10", True)
print body</code></pre>
<p>Also included is a command line application called <var>tstore</var> that wraps up a lot of these operations, including waiting for batch operations to complete. For example, to reset a store and load data into it takes just two lines:</p>
<pre><code>./tstore --store mystore --user username --password xxxx reset --wait
./tstore --store mystore --user username --password xxxx store -f data.rdf</code></pre>
<p>Please take a look at Pynappl and let me know what you think or of you&#8217;d like to get involved and help out.</p>
<p><strong>About Pynappl&#8230;</strong> Pynappl is a simple open source Python library for working with the <a href="http://www.talis.com/platform">Talis Platform</a>. Currently it is focussed mainly on managing data loading and manipulation of Talis Platform stores. Pynappl is an early alpha and is substantially incomplete (we&#8217;re looking for interested contributors. You can read <a href="http://code.google.com/p/pynappl/">more about Pynappl at its Google Code project page</a></p>
<img src="http://feeds.feedburner.com/~r/talis/n2/~4/_ZM8-P1ajLQ" height="1" width="1"/>]]></content:encoded><description>Over the summer I spent some time working on a Python library for working with the Talis Platform. I&amp;#8217;ve spent a lot of time developing the PHP-based Moriarty library and I&amp;#8217;ve been wanting to apply that experience to other languages. Leigh has made good progress on the Ruby front with Pho and we have a [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.talis.com/n2/archives/887/feed</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://blogs.talis.com/n2/archives/887</feedburner:origLink></item><item rdf:about="http://blogs.talis.com/n2/?p=872"><title>Using Moriarty for Serving Linked Data</title><link>http://feedproxy.google.com/~r/talis/n2/~3/K4CX1Ml8gx4/872</link><dc:subject>Projects</dc:subject><dc:creator>Ian Davis</dc:creator><dc:date>2009-11-01T14:31:20-08:00</dc:date><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>Although Moriarty is a general purpose library for building applications with the Talis Platform (and tried and tested in <a href="http://www.talis.com/prism">Talis Prism</a> and <a href="http://www.talis.com/aspire">Talis Aspire</a>) one of the most common uses is simply to provide a browsable interface for linked data held in a Talis Platform store. Typically these scripts take the URI sent by the web browser and use a SPARQL query or the Talis Platform&#8217;s describe service to fetch linked data about that URI. They then style that as HTML or send it directly back as RDF. There are a series of technical details they all need to deal with: 303 redirects, content negotiation, converting RDF to HTML etc.</p>
<p>I&#8217;ve worked on more comprehensive libraries (e.g. <a href="http://code.google.com/p/paget">Paget</a>) to manage this kind of publishing but I thought the simple case of fetching and styling the data would make a good example of how to use Moriarty. I spent a bit of time this afternoon putting an example script together based on several I&#8217;ve written in the past. You can find the result in the <a href="http://code.google.com/p/moriarty/source/browse/#svn/trunk/examples/dataspace">dataspace subdirectory of the examples folder</a>. That subdirectory contains four files:</p>
<ul>
<li>dataspace.php &mdash; this is the example script. It contains the logic to fetch the relevant description, handle content negotiation of the best output format and styling the result appropriately. It&#8217;s not designed to be called directly, but to be included from a configuration file&#8230;</li>
<li>index.php &mdash; this is an example configuration file. It is designed to be dropped into a web server directory and then intercept all requests beginning with that URI. It contains the configuration describing which Talis Platform store to use, where cache files can be written and where to find Moriarty and ARC2. The last thing it does is to load dataspace.php which then handles the browser request.</li>
<li>sample.htaccess &mdash; this is a sample .htaccess file for Apache webservers. It redirects all requests via index.php.</li>
<li>plain.tmpl.html &mdash; this is the default template used to render the HTML views. This can be overridden in the configuration.</li>
</ul>
<p>Using the example script is simple: just copy index.php to the root directory of your linked data space. If you&#8217;re using Apache then you need to copy sample.htaccess into the same directory and rename it to .htaccess. Edit index.php so it refers to your store and your URIs and that&#8217;s it! You can see it in action with the default template on <a href="http://iandavis.com/id/me">my own linked data space</a>.</p>
<p><strong>About Moriarty&#8230;</strong> Moriarty is a simple PHP library for accessing the <a href="http://www.talis.com/platform">Talis Platform</a>. It follows the Platform API very closely and wraps up many common tasks into convenient classes while remaining very lightweight. It also provides some simple RDF classes that are based on the excellent <a href="http://arc.semsol.org/">ARC2</a> class library. Moriarty is being developed by small community of developers and is in continual beta, subject to a slow stream of updates. You can read <a href="http://n2.talis.com/wiki/Moriarty">more about Moriarty on the n&#178; wiki</a> or visit its <a href="http://code.google.com/p/moriarty/">Google Code project</a></p>
<img src="http://feeds.feedburner.com/~r/talis/n2/~4/K4CX1Ml8gx4" height="1" width="1"/>]]></content:encoded><description>Although Moriarty is a general purpose library for building applications with the Talis Platform (and tried and tested in Talis Prism and Talis Aspire) one of the most common uses is simply to provide a browsable interface for linked data held in a Talis Platform store. Typically these scripts take the URI sent by the [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.talis.com/n2/archives/872/feed</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://blogs.talis.com/n2/archives/872</feedburner:origLink></item><item rdf:about="http://blogs.talis.com/n2/?p=854"><title>SPARQL 1.1 Early Access Features</title><link>http://feedproxy.google.com/~r/talis/n2/~3/SMCG4_yCybc/854</link><dc:subject>Uncategorized</dc:subject><dc:creator>Leigh Dodds</dc:creator><dc:date>2009-10-20T02:56:08-07:00</dc:date><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>In yesterday&#8217;s monthly Talis Platform release we started rolling out some early access support for the SPARQL 1.1 query language. We&#8217;ve been monitoring the activity around the development of SPARQL extensions for some time and have been watching the Working Group&#8217;s activity to get a feel for which new features are to be included in the forthcoming revision to the language. For those of you interested in some background on that then Lee Feigenbaum has <a href="http://www.slideshare.net/LeeFeigenbaum/sparql2-status">a nice presentation that summarizes the working groups current thinking</a>.</p>
<p>One major missing feature from SPARQL 1.0 was support for aggregates, i.e. the ability to count, sum and group results. These features have already been implemented by a number of triple stores and this work will get standardised as part of SPARQL 1.1. Because of our confidence in this feature being added to the specification; the existing implementation experience; and in response to <a href="http://www.jenitennison.com/blog/node/127">customer feedback</a> we have decided to release early access support for these specific features as an experimental enhancement to the Platform SPARQL endpoint. </p>
<p>The documentation on <a href="http://n2.talis.com/wiki/Main_Page">the developer wiki</a> has been updated to start to itemize the <a href="http://n2.talis.com/wiki/SPARQL_Extensions">supported SPARQL extensions</a>.</p>
<p>Users should be aware that the syntax of the extensions may be subject to change as we&#8217;ll be attempting to track the progress of the working group as they clarify the specification of these features for inclusion in the standard. We&#8217;ll provide notice of any expected changes.</p>
<p>Users should also be aware that while the basic functionality of aggregates is supported in a number of other implementations, care should be taken if queries are intended to be portable across different triplestores and/or services. For example, the Talis Platform contains some mirrors of other datasets so queries written to use the new functionality may not be portable across other services due to the basic feature not being supported or due to minor syntactic differences.</p>
<p>With the warnings out of the way, here are some simple examples of the extensions in practice. The first query uses the BBC programmes and music data hosted in the platform, and asks for the number of albums release by the Prodigy. The query uses the <code>count()</code> function to count up the number of album titles. The results of the count are assigned to a variable called <code>?count</code> in the SELECT clause using the new &#8220;SELECT expression&#8221; syntax.</p>
<pre>
<code>
#How many albums have been released by The Prodigy?
PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
PREFIX dc: &lt;http://purl.org/dc/elements/1.1/&gt;
PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/&gt;
PREFIX mo: &lt;http://purl.org/ontology/mo/&gt;
PREFIX rel: &lt;http://purl.org/vocab/relationship/&gt;
PREFIX rev: &lt;http://purl.org/stuff/rev#&gt;
SELECT (count(?title) as ?count) WHERE {
  ?group a mo:MusicGroup;
      foaf:name "The Prodigy";
       foaf:made ?album.
   ?album dc:title ?title.
}
</code>
</pre>
<p><a href="http://api.talis.com/stores/bbc-backstage/services/sparql?query=%23List+number+of+albums+released+by+The+Prodigy%0D%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0D%0APREFIX+dc%3A+%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%3E%0D%0APREFIX+foaf%3A+%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%0D%0APREFIX+mo%3A+%3Chttp%3A%2F%2Fpurl.org%2Fontology%2Fmo%2F%3E%0D%0APREFIX+rel%3A+%3Chttp%3A%2F%2Fpurl.org%2Fvocab%2Frelationship%2F%3E%0D%0APREFIX+rev%3A+%3Chttp%3A%2F%2Fpurl.org%2Fstuff%2Frev%23%3E%0D%0ASELECT+(count(%3Ftitle)+as+%3Fcount)+WHERE+{%0D%0A++%3Fgroup+a+mo%3AMusicGroup%3B%0D%0A++++++foaf%3Aname+%22The+Prodigy%22%3B%0D%0A+++++++foaf%3Amade+%3Falbum.%0D%0A+++%3Falbum+dc%3Atitle+%3Ftitle.%0D%0A}">Results</a>.</p>
<p>The second example is a variant of one of the <a href="http://blogs.talis.com/n2/archives/818">example queries that can be used against the Edubase data</a>. In this case the query retrieves the number of schools closed in each parliamentary constituency in 2008, ordering the results in descending order. The new <code>GROUP BY</code> keyword is used to group the results by the label of the constituency.</p>
<pre>
<code>
#How many schools closed in each parliamentary constituency in 2008?
#In descending order of number of closures
prefix sch-ont:  &lt;http://education.data.gov.uk/ontology/school#&gt;
prefix xsd:     &lt;http://www.w3.org/2001/XMLSchema#&gt;
prefix rdfs:    &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
SELECT ?label (count(?school) as ?count) WHERE {
  ?school a sch-ont:School;
     sch-ont:establishmentName ?name ;
     sch-ont:establishmentStatus sch-ont:EstablishmentStatus_Closed ;
     sch-ont:closeDate ?date ;
     sch-ont:parliamentaryConstituency ?cons .
  ?cons rdfs:label ?label.
  FILTER (?date &gt; "2008-01-01"^^xsd:date &amp;&amp; ?date &lt; "2009-01-01"^^xsd:date)
}
GROUP BY ?label
ORDER BY DESC(?count)
</code>
</pre>
<p><a href="http://api.talis.com/stores/govuk-education/services/sparql?query=prefix+sch-ont%3A++%3Chttp%3A%2F%2Feducation.data.gov.uk%2Fontology%2Fschool%23%3E%0D%0Aprefix+xsd%3A+++++%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0D%0Aprefix+rdfs%3A++++%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0D%0ASELECT+%3Flabel+(count(%3Fschool)+as+%3Fcount)+WHERE+{%0D%0A++%3Fschool+a+sch-ont%3ASchool%3B%0D%0A+++++sch-ont%3AestablishmentName+%3Fname+%3B%0D%0A+++++sch-ont%3AestablishmentStatus+sch-ont%3AEstablishmentStatus_Closed+%3B%0D%0A+++++sch-ont%3AcloseDate+%3Fdate+%3B%0D%0A+++++sch-ont%3AparliamentaryConstituency+%3Fcons+.%0D%0A++%3Fcons+rdfs%3Alabel+%3Flabel.%0D%0A++FILTER+(%3Fdate+%3E+%222008-01-01%22^^xsd%3Adate+%26%26+%3Fdate+%3C+%222009-01-01%22^^xsd%3Adate)%0D%0A}%0D%0AGROUP+BY+%3Flabel%0D%0AORDER+BY+DESC(%3Fcount)%0D%0A">Results</a>.</p>
<p>We can revise this query to only include those constituencies in which at least 10 schools have closed. To do this we need to filter the results to just those where the count is equal to or greater than 10. The new <code>HAVING</code> keyword allows an expression to be applied to the result set before it is returned:</p>
<pre>
<code>
prefix sch-ont:  &lt;http://education.data.gov.uk/ontology/school#&gt;
prefix xsd:     &lt;http://www.w3.org/2001/XMLSchema#&gt;
prefix rdfs:    &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
SELECT ?label (count(?school) as ?count) WHERE {
  ?school a sch-ont:School;
     sch-ont:establishmentName ?name ;
     sch-ont:establishmentStatus sch-ont:EstablishmentStatus_Closed ;
     sch-ont:closeDate ?date ;
     sch-ont:parliamentaryConstituency ?cons .
  ?cons rdfs:label ?label.
  FILTER (?date &gt; "2008-01-01"^^xsd:date &amp;&amp; ?date &lt; "2009-01-01"^^xsd:date)
}
GROUP BY ?label
HAVING (?count &gt;= 10)
ORDER BY DESC(?count)
</code>
</pre>
<p><a href="http://api.talis.com/stores/govuk-education/services/sparql?query=prefix+sch-ont%3A++%3Chttp%3A%2F%2Feducation.data.gov.uk%2Fontology%2Fschool%23%3E%0D%0Aprefix+xsd%3A+++++%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0D%0Aprefix+rdfs%3A++++%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0D%0ASELECT+%3Flabel+(count(%3Fschool)+as+%3Fcount)+WHERE+{%0D%0A++%3Fschool+a+sch-ont%3ASchool%3B%0D%0A+++++sch-ont%3AestablishmentName+%3Fname+%3B%0D%0A+++++sch-ont%3AestablishmentStatus+sch-ont%3AEstablishmentStatus_Closed+%3B%0D%0A+++++sch-ont%3AcloseDate+%3Fdate+%3B%0D%0A+++++sch-ont%3AparliamentaryConstituency+%3Fcons+.%0D%0A++%3Fcons+rdfs%3Alabel+%3Flabel.%0D%0A++FILTER+(%3Fdate+%3E+%222008-01-01%22^^xsd%3Adate+%26%26+%3Fdate+%3C+%222009-01-01%22^^xsd%3Adate)%0D%0A}%0D%0AGROUP+BY+%3Flabel%0D%0AHAVING+(%3Fcount+%3E%3D+10)%0D%0AORDER+BY+DESC(%3Fcount)%0D%0A">Results</a>.</p>
<p>The <a href="http://n2.talis.com/wiki/SPARQL_Extensions">SPARQL extensions</a> page includes a few more examples of the syntax and a list of the operators now supported in the extended query language. Any feedback or questions, then please leave a comment below.</p>
<img src="http://feeds.feedburner.com/~r/talis/n2/~4/SMCG4_yCybc" height="1" width="1"/>]]></content:encoded><description>In yesterday&amp;#8217;s monthly Talis Platform release we started rolling out some early access support for the SPARQL 1.1 query language. We&amp;#8217;ve been monitoring the activity around the development of SPARQL extensions for some time and have been watching the Working Group&amp;#8217;s activity to get a feel for which new features are to be included in [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.talis.com/n2/archives/854/feed</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://blogs.talis.com/n2/archives/854</feedburner:origLink></item><item rdf:about="http://blogs.talis.com/n2/?p=836"><title>SPARQLing data.gov.uk: Transport Data</title><link>http://feedproxy.google.com/~r/talis/n2/~3/jIVEI1wSxiA/836</link><dc:subject>Uncategorized</dc:subject><dc:creator>Leigh Dodds</dc:creator><dc:date>2009-10-10T07:26:04-07:00</dc:date><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>This is the second in my series of posts about using SPARQL to access the Linked Data being published from data.gov.uk. In the first article I<a href="http://blogs.talis.com/n2/archives/818"> looked at the Edubase data</a>. In this second post I wanted to briefly look at some of the data from the Department of Transport. This dataset, which consists of around 45 million triples provides data about traffic counts on UK roads. Jeni Tennison has previously <a href="http://www.jenitennison.com/blog/node/115">written up how she approached the dataset conversion and published it online</a> as part of the data.gov.uk initiative, so her blog post is a useful starting point for background on the structure and content of the dataset.</p>
<p>The SPARQL endpoint for the transport data in data.gov.uk is at: <a href="http://services.data.gov.uk/transport/sparql">http://services.data.gov.uk/transport/sparql</a>.</p>
<p>Each of the road traffic monitoring points in the dataset has latitude and longitude details available, so it is possible to ask for all collection points that occur on a particular road. Here&#8217;s how to do that for the M5:</p>
<pre>
<code>
#List the uri, latitude and longitude for road traffic monitoring points on the M5
PREFIX road: &lt;http://transport.data.gov.uk/0/ontology/roads#&gt;
PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
PREFIX geo: &lt;http://geo.data.gov.uk/0/ontology/geo#&gt;
PREFIX wgs84: &lt;http://www.w3.org/2003/01/geo/wgs84_pos#&gt;
PREFIX xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt;
SELECT ?point ?lat ?long WHERE {
  ?x a road:Road.
  ?x road:number "M5"^^xsd:NCName.
  ?x geo:point ?point.
  ?point wgs84:lat ?lat.
  ?point wgs84:long ?long.
}
</code>
</pre>
<p><a href="http://services.data.gov.uk/transport/sparql?query=%0D%0A%23List+the+uri%2C+latitude+and+longitude+for+road+traffic+monitoring+points+on+the+M5%0D%0APREFIX+road%3A+%3Chttp%3A%2F%2Ftransport.data.gov.uk%2F0%2Fontology%2Froads%23%3E%0D%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0D%0APREFIX+geo%3A+%3Chttp%3A%2F%2Fgeo.data.gov.uk%2F0%2Fontology%2Fgeo%23%3E%0D%0APREFIX+wgs84%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2003%2F01%2Fgeo%2Fwgs84_pos%23%3E%0D%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0D%0ASELECT+%3Fpoint+%3Flat+%3Flong+WHERE+{%0D%0A++%3Fx+a+road%3ARoad.%0D%0A++%3Fx+road%3Anumber+%22M5%22^^xsd%3ANCName.%0D%0A++%3Fx+geo%3Apoint+%3Fpoint.%0D%0A++%3Fpoint+wgs84%3Alat+%3Flat.%0D%0A++%3Fpoint+wgs84%3Along+%3Flong.%0D%0A}">Results</a>.</p>
<p>To modify the query to look at a different road, just change the query to refer to another road name, e.g. the <a href="http://services.data.gov.uk/transport/sparql?query=%0D%0A%23List+the+uri%2C+latitude+and+longitude+for+road+traffic+monitoring+points+on+the+M5%0D%0APREFIX+road%3A+%3Chttp%3A%2F%2Ftransport.data.gov.uk%2F0%2Fontology%2Froads%23%3E%0D%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0D%0APREFIX+geo%3A+%3Chttp%3A%2F%2Fgeo.data.gov.uk%2F0%2Fontology%2Fgeo%23%3E%0D%0APREFIX+wgs84%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2003%2F01%2Fgeo%2Fwgs84_pos%23%3E%0D%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0D%0ASELECT+%3Fpoint+%3Flat+%3Flong+WHERE+{%0D%0A++%3Fx+a+road%3ARoad.%0D%0A++%3Fx+road%3Anumber+%22B237%22^^xsd%3ANCName.%0D%0A++%3Fx+geo%3Apoint+%3Fpoint.%0D%0A++%3Fpoint+wgs84%3Alat+%3Flat.%0D%0A++%3Fpoint+wgs84%3Along+%3Flong.%0D%0A}">B237</a> or the <a href="http://services.data.gov.uk/transport/sparql?query=%0D%0A%23List+the+uri%2C+latitude+and+longitude+for+road+traffic+monitoring+points+on+the+M5%0D%0APREFIX+road%3A+%3Chttp%3A%2F%2Ftransport.data.gov.uk%2F0%2Fontology%2Froads%23%3E%0D%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0D%0APREFIX+geo%3A+%3Chttp%3A%2F%2Fgeo.data.gov.uk%2F0%2Fontology%2Fgeo%23%3E%0D%0APREFIX+wgs84%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2003%2F01%2Fgeo%2Fwgs84_pos%23%3E%0D%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0D%0ASELECT+%3Fpoint+%3Flat+%3Flong+WHERE+{%0D%0A++%3Fx+a+road%3ARoad.%0D%0A++%3Fx+road%3Anumber+%22A4%22^^xsd%3ANCName.%0D%0A++%3Fx+geo%3Apoint+%3Fpoint.%0D%0A++%3Fpoint+wgs84%3Alat+%3Flat.%0D%0A++%3Fpoint+wgs84%3Along+%3Flong.%0D%0A}">A4</a>.</p>
<p>If you&#8217;d prefer not to deal with <a href="http://www.w3.org/TR/rdf-sparql-XMLres/">the SPARQL XML Results format</a>, then you can add an parameter to the url to request the results in <a href="http://www.w3.org/TR/rdf-sparql-json-res/">the SPARQL JSON results format</a> (<code>output=json</code>). Here are <a href="http://services.data.gov.uk/transport/sparql?query=%0D%0A%23List+the+uri%2C+latitude+and+longitude+for+road+traffic+monitoring+points+on+the+M5%0D%0APREFIX+road%3A+%3Chttp%3A%2F%2Ftransport.data.gov.uk%2F0%2Fontology%2Froads%23%3E%0D%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0D%0APREFIX+geo%3A+%3Chttp%3A%2F%2Fgeo.data.gov.uk%2F0%2Fontology%2Fgeo%23%3E%0D%0APREFIX+wgs84%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2003%2F01%2Fgeo%2Fwgs84_pos%23%3E%0D%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0D%0ASELECT+%3Fpoint+%3Flat+%3Flong+WHERE+{%0D%0A++%3Fx+a+road%3ARoad.%0D%0A++%3Fx+road%3Anumber+%22A4%22^^xsd%3ANCName.%0D%0A++%3Fx+geo%3Apoint+%3Fpoint.%0D%0A++%3Fpoint+wgs84%3Alat+%3Flat.%0D%0A++%3Fpoint+wgs84%3Along+%3Flong.%0D%0A}&amp;output=json">the points on the A4 as JSON</a>.</p>
<p>If you query further you can find all of the traffic counts associated with a particular location, each of these has a timestamp, the direction the traffic was travelling, etc. The data is ripe for visualisation, e.g. plotting the points on a map, building an animation to show traffic changes over time, etc.</p>
<p>The dataset also includes identifiers for different types of road and motor vehicle. These are published as SKOS concept schemes (i.e. a category of stuff). SKOS concept schemes are hierarchical, so lets see what schemes are in the data, and what their top concept is:</p>
<pre>
<code>
#List SKOS concept schemes, their top concepts and labels
PREFIX skos: &lt;http://www.w3.org/2004/02/skos/core#&gt;
SELECT ?scheme ?topconcept ?label WHERE {
  ?scheme a skos:ConceptScheme;
    skos:hasTopConcept ?topconcept.
  ?topconcept skos:prefLabel ?label.
}
</code>
</pre>
<p><a href="http://services.data.gov.uk/transport/sparql?query=PREFIX+skos%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2004%2F02%2Fskos%2Fcore%23%3E%0D%0ASELECT+%3Fscheme+%3Ftopconcept+%3Flabel+WHERE+{%0D%0A++%3Fscheme+a+skos%3AConceptScheme%3B%0D%0A++++skos%3AhasTopConcept+%3Ftopconcept.%0D%0A++%3Ftopconcept+skos%3AprefLabel+%3Flabel.%0D%0A}">Results</a>.</p>
<p>The above query will work on any dataset as it just uses generic SKOS vocabulary. You could run it on any SPARQL endpoint to see if it contains some SKOS concept schemes. </p>
<p>One of the schemes in the dataset is a categorization of roads. Lets retrieve the concepts in that scheme:</p>
<pre>
<code>
PREFIX skos: &lt;http://www.w3.org/2004/02/skos/core#&gt;
SELECT ?category ?label WHERE {
  ?category skos:inScheme ;
   skos:prefLabel ?label.
}
</code>
</pre>
<p><a href="http://services.data.gov.uk/transport/sparql?query=PREFIX+skos%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2004%2F02%2Fskos%2Fcore%23%3E%0D%0ASELECT+%3Fcategory+%3Flabel+WHERE+{%0D%0A++%3Fcategory+skos%3AinScheme+%3Chttp%3A%2F%2Ftransport.data.gov.uk%2F0%2Fcategory%2Froad%3E%3B%0D%0A+++skos%3AprefLabel+%3Flabel.%0D%0A}">Results</a>.</p>
<p>If we wanted to look at the concepts in the vehicle scheme (http://transport.data.gov.uk/0/category/vehicle), then we can just change the relevant URI in the query and <a href="http://services.data.gov.uk/transport/sparql?query=PREFIX+skos%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2004%2F02%2Fskos%2Fcore%23%3E%0D%0ASELECT+%3Fcategory+%3Flabel+WHERE+{%0D%0A++%3Fcategory+skos%3AinScheme+%3Chttp%3A%2F%2Ftransport.data.gov.uk%2F0%2Fcategory%2Fvehicle%3E%3B%0D%0A+++skos%3AprefLabel+%3Flabel.%0D%0A}%0D%0A">retrieve the results</a>.</p>
<p>Based on that information it should be possible to find traffic counts for specific types of vehicle on specific roads. I&#8217;ll leave that as an exercise for the reader!</p>
<img src="http://feeds.feedburner.com/~r/talis/n2/~4/jIVEI1wSxiA" height="1" width="1"/>]]></content:encoded><description>This is the second in my series of posts about using SPARQL to access the Linked Data being published from data.gov.uk. In the first article I looked at the Edubase data. In this second post I wanted to briefly look at some of the data from the Department of Transport. This dataset, which consists of [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.talis.com/n2/archives/836/feed</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://blogs.talis.com/n2/archives/836</feedburner:origLink></item><item rdf:about="http://blogs.talis.com/n2/?p=818"><title>SPARQLing data.gov.uk: Edubase Data</title><link>http://feedproxy.google.com/~r/talis/n2/~3/4IsOefZFVTE/818</link><dc:subject>Tutorials</dc:subject><dc:subject>datagovuk</dc:subject><dc:subject>SPARQL</dc:subject><dc:creator>Leigh Dodds</dc:creator><dc:date>2009-10-06T04:16:39-07:00</dc:date><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>Last week the Cabinet Office issued <a href="http://blogs.cabinetoffice.gov.uk/digitalengagement/post/2009/09/30/Calling-Open-Data-Developers-We-need-your-help.aspx">a call for Open Data Developer</a>s to sign-up to get a preview of the forthcoming UK Government public data website. The site includes a directory of existing datasets plus a growing number of datasets that have been converted to RDF and which will shortly be available as Linked Data. This data is being stored in the Talis Platform providing developers with access to SPARQL endpoints as a means to query the data; we&#8217;ll also be including search and other access mechanisms at a later date.</p>
<p>In this series of postings I wanted to show some example SPARQL queries that can be used to access the data. If you&#8217;re new to SPARQL then you might want to look at Lee Feigenbaum&#8217;s<a href="http://www.cambridgesemantics.com/2008/09/sparql-by-example/"> SPARQL by Example</a> tutorial, or <a href="http://www.slideshare.net/ldodds/sparql-tutorial">my own short slide deck that covers all the basic syntax</a>.</p>
<p>The first dataset I wanted to highlight is an extract of the <a href="http://www.edubase.gov.uk">Edubase</a> dataset available from the Department of Children, Schools and Families. The conversion was carried out by the team at HP Labs and has been loaded into a Talis Platform store. The public facing SPARQL endpoint is available from: <a href="http://services.data.gov.uk/education/sparql">http://services.data.gov.uk/education/sparql</a>. </p>
<p>Here are some sample SPARQL queries you can use against the data:</p>
<pre><code>
#1. Select the names of schools in the Administrative District of the City of London
# Ordering results by name of the school
prefix sch-ont:  &lt;http://education.data.gov.uk/ontology/school#&gt;
SELECT ?name WHERE {
  ?school a sch-ont:School;
     sch-ont:establishmentName ?name;
     sch-ont:districtAdministrative
        &lt;http://education.data.gov.uk/placeholder-id/administrativeDistrict/City-of-London&gt; ;
}
ORDER BY ?name
</code></pre>
<p><a href="http://services.data.gov.uk/education/sparql?query=prefix+sch-ont%3A++%3Chttp%3A%2F%2Feducation.data.gov.uk%2Fontology%2Fschool%23%3E%0D%0ASELECT+%3Fname+WHERE+{%0D%0A++%3Fschool+a+sch-ont%3ASchool%3B+%0D%0A+++++sch-ont%3AestablishmentName+%3Fname%3B%0D%0A+++++sch-ont%3AdistrictAdministrative%0D%0A++++++++%3Chttp%3A%2F%2Feducation.data.gov.uk%2Fplaceholder-id%2FadministrativeDistrict%2FCity-of-London%3E+%3B%0D%0A}%0D%0AORDER+BY+%3Fname%0D%0A%0D%0A">Results</a></p>
<pre><code>
#2. Which schools in the BANES area have a nursery?
prefix sch-ont:  &lt;http://education.data.gov.uk/ontology/school#&gt;
prefix xsd:     &lt;http://www.w3.org/2001/XMLSchema#&gt;
SELECT ?name WHERE {
  ?school a sch-ont:School;
     sch-ont:establishmentName ?name;
     sch-ont:districtAdministrative
        &lt;http://education.data.gov.uk/placeholder-id/administrativeDistrict/Bath-and-North-East-Somerset&gt; ;
     sch-ont:nurseryProvision "true"^^xsd:boolean
}
ORDER BY ?name
</code></pre>
<p><a href="http://services.data.gov.uk/education/sparql?query=prefix+sch-ont%3A++%3Chttp%3A%2F%2Feducation.data.gov.uk%2Fontology%2Fschool%23%3E%0D%0Aprefix+xsd%3A+++++%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0D%0ASELECT+%3Fname+WHERE+{%0D%0A++%3Fschool+a+sch-ont%3ASchool%3B+%0D%0A+++++sch-ont%3AestablishmentName+%3Fname%3B%0D%0A+++++sch-ont%3AdistrictAdministrative%0D%0A++++++++%3Chttp%3A%2F%2Feducation.data.gov.uk%2Fplaceholder-id%2FadministrativeDistrict%2FBath-and-North-East-Somerset%3E+%3B%0D%0A+++++sch-ont%3AnurseryProvision+%22true%22^^xsd%3Aboolean%0D%0A}%0D%0AORDER+BY+%3Fname%0D%0A">Results</a></p>
<pre><code>
#3. Select the names and addresses of schools in the Administrative District of the City of London
# Ordering results by name of the school
# Note: we use OPTIONAL here as not every school has an address listed in the data
prefix sch-ont:  &lt;http://education.data.gov.uk/ontology/school#&gt;
SELECT ?name ?address1 ?address2 ?postcode ?town WHERE {
  ?school a sch-ont:School;
     sch-ont:establishmentName ?name;
     sch-ont:districtAdministrative
        &lt;http://education.data.gov.uk/placeholder-id/administrativeDistrict/City-of-London&gt; .

  OPTIONAL {
   ?school sch-ont:address ?address .
  ?address sch-ont:address1 ?address1 ;
      sch-ont:address2 ?address2 ;
      sch-ont:postcode ?postcode ;
      sch-ont:town ?town .
  }
}
ORDER BY ?name
</code></pre>
<p><a href="http://services.data.gov.uk/education/sparql?query=prefix+sch-ont%3A++%3Chttp%3A%2F%2Feducation.data.gov.uk%2Fontology%2Fschool%23%3E%0D%0ASELECT+%3Fname+%3Faddress1+%3Faddress2+%3Fpostcode+%3Ftown+WHERE+{%0D%0A++%3Fschool+a+sch-ont%3ASchool%3B+%0D%0A+++++sch-ont%3AestablishmentName+%3Fname%3B%0D%0A+++++sch-ont%3AdistrictAdministrative%0D%0A++++++++%3Chttp%3A%2F%2Feducation.data.gov.uk%2Fplaceholder-id%2FadministrativeDistrict%2FCity-of-London%3E+.%0D%0A%0D%0A++OPTIONAL+{%0D%0A+++%3Fschool+sch-ont%3Aaddress+%3Faddress+.%0D%0A%0D%0A++%3Faddress+sch-ont%3Aaddress1+%3Faddress1+%3B%0D%0A++++++sch-ont%3Aaddress2+%3Faddress2+%3B%0D%0A++++++sch-ont%3Apostcode+%3Fpostcode+%3B%0D%0A++++++sch-ont%3Atown+%3Ftown+.%0D%0A++}%0D%0A}%0D%0AORDER+BY+%3Fname%0D%0A">Results</a></p>
<pre><code>
#4. Select the name, lowest and highest age ranges, capacity and pupil:teacher ratio
# for all schools in the Bath &amp; North East Somerset district
# Again we use OPTIONAL to allow for missing data items.
prefix sch-ont:  &lt;http://education.data.gov.uk/ontology/school#&gt;
SELECT ?name ?lowage ?highage ?capacity ?ratio WHERE {
  ?school a sch-ont:School;
     sch-ont:establishmentName ?name;
     sch-ont:districtAdministrative
        &lt;http://education.data.gov.uk/placeholder-id/administrativeDistrict/Bath-and-North-East-Somerset&gt; .
     OPTIONAL {
       ?school sch-ont:statutoryLowAge ?lowage ;
     }

     OPTIONAL {
       ?school sch-ont:statutoryHighAge ?highage ;
     }

     OPTIONAL {
       ?school sch-ont:schoolCapacity ?capacity ;
     }

     OPTIONAL {
       ?school sch-ont:pupilTeacherRatio ?ratio
     }
}
ORDER BY ?name
</code></pre>
<p><a href="http://services.data.gov.uk/education/sparql?query=prefix+sch-ont%3A++%3Chttp%3A%2F%2Feducation.data.gov.uk%2Fontology%2Fschool%23%3E%0D%0ASELECT+%3Fname+%3Flowage+%3Fhighage+%3Fcapacity+%3Fratio+WHERE+{%0D%0A++%3Fschool+a+sch-ont%3ASchool%3B+%0D%0A+++++sch-ont%3AestablishmentName+%3Fname%3B%0D%0A+++++sch-ont%3AdistrictAdministrative%0D%0A++++++++%3Chttp%3A%2F%2Feducation.data.gov.uk%2Fplaceholder-id%2FadministrativeDistrict%2FBath-and-North-East-Somerset%3E+.%0D%0A+++++OPTIONAL+{%0D%0A+++++++%3Fschool+sch-ont%3AstatutoryLowAge+%3Flowage+%3B%0D%0A+++++}%0D%0A+++++%0D%0A+++++OPTIONAL+{%0D%0A+++++++%3Fschool+sch-ont%3AstatutoryHighAge+%3Fhighage+%3B%0D%0A+++++}%0D%0A%0D%0A+++++OPTIONAL+{%0D%0A+++++++%3Fschool+sch-ont%3AschoolCapacity+%3Fcapacity+%3B%0D%0A+++++}%0D%0A%0D%0A+++++OPTIONAL+{%0D%0A+++++++%3Fschool+sch-ont%3ApupilTeacherRatio+%3Fratio%0D%0A+++++}+++++%0D%0A}%0D%0AORDER+BY+%3Fname">Results</a></p>
<pre><code>
#5. What is the uri, name, and opening date of the oldest school in the UK?
prefix sch-ont:  &lt;http://education.data.gov.uk/ontology/school#&gt;
SELECT ?school ?name ?date WHERE {
  ?school a sch-ont:School;
     sch-ont:establishmentName ?name;
     sch-ont:openDate ?date.
}
ORDER BY ASC(?date)
LIMIT 1
</code></pre>
<p><a href="http://services.data.gov.uk/education/sparql?query=prefix+sch-ont%3A++%3Chttp%3A%2F%2Feducation.data.gov.uk%2Fontology%2Fschool%23%3E%0D%0ASELECT+%3Fschool+%3Fname+%3Fdate+WHERE+{%0D%0A++%3Fschool+a+sch-ont%3ASchool%3B+%0D%0A+++++sch-ont%3AestablishmentName+%3Fname%3B%0D%0A+++++sch-ont%3AopenDate+%3Fdate.%0D%0A}%0D%0AORDER+BY+ASC(%3Fdate)%0D%0ALIMIT+1%0D%0A">Results</a></p>
<pre><code>
#6. Select the name, easting and northing for the 100 newest schools in the UK.
# Can be used to plot them on a map
prefix sch-ont:  &lt;http://education.data.gov.uk/ontology/school#&gt;
SELECT ?school ?name ?date ?easting ?northing WHERE {
  ?school a sch-ont:School;
     sch-ont:establishmentName ?name;
     sch-ont:openDate ?date ;
     sch-ont:easting ?easting ;
     sch-ont:northing ?northing .
}
ORDER BY DESC(?date)
LIMIT 100
</code></pre>
<p><a href="http://services.data.gov.uk/education/sparql?query=prefix+sch-ont%3A++%3Chttp%3A%2F%2Feducation.data.gov.uk%2Fontology%2Fschool%23%3E%0D%0ASELECT+%3Fschool+%3Fname+%3Fdate+%3Feasting+%3Fnorthing+WHERE+{%0D%0A++%3Fschool+a+sch-ont%3ASchool%3B+%0D%0A+++++sch-ont%3AestablishmentName+%3Fname%3B%0D%0A+++++sch-ont%3AopenDate+%3Fdate+%3B%0D%0A+++++sch-ont%3Aeasting+%3Feasting+%3B%0D%0A+++++sch-ont%3Anorthing+%3Fnorthing+.%0D%0A}%0D%0AORDER+BY+DESC(%3Fdate)%0D%0ALIMIT+100%0D%0A%0D%0A">Results</a></p>
<pre><code>
#7. Select the uri, name, easting and northing for all schools opened in 2008
prefix sch-ont:  &lt;http://education.data.gov.uk/ontology/school#&gt;
prefix xsd:     &lt;http://www.w3.org/2001/XMLSchema#&gt;
SELECT ?school ?name ?date ?easting ?northing WHERE {
  ?school a sch-ont:School;
     sch-ont:establishmentName ?name;
     sch-ont:openDate ?date ;
     sch-ont:easting ?easting ;
     sch-ont:northing ?northing .
  FILTER (?date &gt; "2008-01-01"^^xsd:date &amp;&amp; ?date &lt; "2009-01-01"^^xsd:date)
}
</code></pre>
<p><a href="http://services.data.gov.uk/education/sparql?query=prefix+sch-ont%3A++%3Chttp%3A%2F%2Feducation.data.gov.uk%2Fontology%2Fschool%23%3E%0D%0Aprefix+xsd%3A+++++%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0D%0ASELECT+%3Fschool+%3Fname+%3Fdate+%3Feasting+%3Fnorthing+WHERE+{%0D%0A++%3Fschool+a+sch-ont%3ASchool%3B+%0D%0A+++++sch-ont%3AestablishmentName+%3Fname%3B%0D%0A+++++sch-ont%3AopenDate+%3Fdate+%3B%0D%0A+++++sch-ont%3Aeasting+%3Feasting+%3B%0D%0A+++++sch-ont%3Anorthing+%3Fnorthing+.%0D%0A++FILTER+(%3Fdate+%3E+%222008-01-01%22^^xsd%3Adate+%26%26+%3Fdate+%3C+%222009-01-01%22^^xsd%3Adate)%0D%0A}%0D%0A">Results</a></p>
<pre><code>
#8. Select the uri, name, and the reason for closing for all schools that are currently
# scheduled for closure. The reason is a URI from a controlled vocabulary in the ontology.
prefix sch-ont:  &lt;http://education.data.gov.uk/ontology/school#&gt;
prefix xsd:     &lt;http://www.w3.org/2001/XMLSchema#&gt;
SELECT ?school ?name ?reason WHERE {
  ?school a sch-ont:School;
     sch-ont:establishmentName ?name ;
     sch-ont:establishmentStatus sch-ont:EstablishmentStatus_Open__but_proposed_to_close ;
     sch-ont:reasonEstablishmentClosed ?reason .
}
</code></pre>
<p><a href="http://services.data.gov.uk/education/sparql?query=prefix+sch-ont%3A++%3Chttp%3A%2F%2Feducation.data.gov.uk%2Fontology%2Fschool%23%3E%0D%0Aprefix+xsd%3A+++++%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0D%0ASELECT+%3Fschool+%3Fname+%3Freason+WHERE+{%0D%0A++%3Fschool+a+sch-ont%3ASchool%3B+%0D%0A+++++sch-ont%3AestablishmentName+%3Fname+%3B%0D%0A+++++sch-ont%3AestablishmentStatus+sch-ont%3AEstablishmentStatus_Open__but_proposed_to_close+%3B%0D%0A+++++sch-ont%3AreasonEstablishmentClosed+%3Freason+.%0D%0A}%0D%0A">Results</a></p>
<pre><code>
#9. In which parliamentary constituencies did schools close in 2008?
prefix sch-ont:  &lt;http://education.data.gov.uk/ontology/school#&gt;
prefix xsd:     &lt;http://www.w3.org/2001/XMLSchema#&gt;
prefix rdfs:    &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
SELECT DISTINCT ?cons ?label WHERE {
  ?school a sch-ont:School;
     sch-ont:establishmentName ?name ;
     sch-ont:establishmentStatus sch-ont:EstablishmentStatus_Closed ;
     sch-ont:closeDate ?date ;
     sch-ont:parliamentaryConstituency ?cons .
  ?cons rdfs:label ?label.
  FILTER (?date &gt; "2008-01-01"^^xsd:date &amp;&amp; ?date &lt; "2009-01-01"^^xsd:date)
}
ORDER BY ?cons
</code></pre>
<p><a href="http://services.data.gov.uk/education/sparql?query=prefix+sch-ont%3A++%3Chttp%3A%2F%2Feducation.data.gov.uk%2Fontology%2Fschool%23%3E%0D%0Aprefix+xsd%3A+++++%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0D%0Aprefix+rdfs%3A++++%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0D%0ASELECT+DISTINCT+%3Fcons+%3Flabel+WHERE+{%0D%0A++%3Fschool+a+sch-ont%3ASchool%3B+%0D%0A+++++sch-ont%3AestablishmentName+%3Fname+%3B%0D%0A+++++sch-ont%3AestablishmentStatus+sch-ont%3AEstablishmentStatus_Closed+%3B%0D%0A+++++sch-ont%3AcloseDate+%3Fdate+%3B%0D%0A+++++sch-ont%3AparliamentaryConstituency+%3Fcons+.%0D%0A++%3Fcons+rdfs%3Alabel+%3Flabel.%0D%0A++FILTER+(%3Fdate+%3E+%222008-01-01%22^^xsd%3Adate+%26%26+%3Fdate+%3C+%222009-01-01%22^^xsd%3Adate)%0D%0A}%0D%0AORDER+BY+%3Fcons%0D%0A%0D%0A">Results</a></p>
<pre><code>
#10. In which parliamentary constituencies did schools open in 2008?
prefix sch-ont:  &lt;http://education.data.gov.uk/ontology/school#&gt;
prefix xsd:     &lt;http://www.w3.org/2001/XMLSchema#&gt;
prefix rdfs:    &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
SELECT DISTINCT ?cons ?label WHERE {
  ?school a sch-ont:School;
     sch-ont:establishmentName ?name ;
     sch-ont:openDate ?date ;
     sch-ont:parliamentaryConstituency ?cons .
  ?cons rdfs:label ?label.
  FILTER (?date &gt; "2008-01-01"^^xsd:date &amp;&amp; ?date &lt; "2009-01-01"^^xsd:date)
}
ORDER BY ?cons
</code></pre>
<p><a href="http://services.data.gov.uk/education/sparql?query=prefix+sch-ont%3A++%3Chttp%3A%2F%2Feducation.data.gov.uk%2Fontology%2Fschool%23%3E%0D%0Aprefix+xsd%3A+++++%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0D%0Aprefix+rdfs%3A++++%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0D%0ASELECT+DISTINCT+%3Fcons+%3Flabel+WHERE+{%0D%0A++%3Fschool+a+sch-ont%3ASchool%3B+%0D%0A+++++sch-ont%3AestablishmentName+%3Fname+%3B%0D%0A+++++sch-ont%3AopenDate+%3Fdate+%3B%0D%0A+++++sch-ont%3AparliamentaryConstituency+%3Fcons+.%0D%0A++%3Fcons+rdfs%3Alabel+%3Flabel.%0D%0A++FILTER+(%3Fdate+%3E+%222008-01-01%22^^xsd%3Adate+%26%26+%3Fdate+%3C+%222009-01-01%22^^xsd%3Adate)%0D%0A}%0D%0AORDER+BY+%3Fcons%0D%0A%0D%0A">Results</a></p>
<p>Hopefully thats enough to get you started. If you want a bit more background on the modelling and a look at the ontology, then read <a href="http://groups.google.com/group/uk-government-data-developers/msg/21e75f669aa05329">this posting to the uk-government-data mailing list by Stuart Williams</a>.</p>
<img src="http://feeds.feedburner.com/~r/talis/n2/~4/4IsOefZFVTE" height="1" width="1"/>]]></content:encoded><description>Last week the Cabinet Office issued a call for Open Data Developers to sign-up to get a preview of the forthcoming UK Government public data website. The site includes a directory of existing datasets plus a growing number of datasets that have been converted to RDF and which will shortly be available as Linked Data. [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.talis.com/n2/archives/818/feed</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">10</slash:comments><feedburner:origLink>http://blogs.talis.com/n2/archives/818</feedburner:origLink></item><item rdf:about="http://blogs.talis.com/n2/?p=791"><title>Vocamp Glasgow 2009</title><link>http://feedproxy.google.com/~r/talis/n2/~3/sAL1J-Nx564/791</link><dc:subject>Events</dc:subject><dc:subject>conference</dc:subject><dc:subject>ontologies</dc:subject><dc:subject>owl</dc:subject><dc:subject>scotland</dc:subject><dc:subject>swig</dc:subject><dc:subject>vocabularies</dc:subject><dc:subject>vocamp</dc:subject><dc:creator>kwijibo</dc:creator><dc:date>2009-09-17T07:33:06-07:00</dc:date><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>This week saw the first <a href="http://vocamp.org/wiki/Vocamp_Glasgow">Vocamp</a> in Scotland, held at the University of Strathclyde, Glasgow.</p>
<p><a href="http://www.flickr.com/photos/55579041@N00/3928504584/" title="Vocamp Glasgow 2009 by keithalexander, on Flickr"><img src="http://farm3.static.flickr.com/2574/3928504584_4a4cfe24b4.jpg" width="500" height="375" alt="Vocamp Glasgow 2009" /></a></p>
<p>Attendees came from a wide range  of different and interesting problem-spaces and domains and gave a lot of great presentations on their work. The range was too broad, perhaps, for us to find enough commonality to collaborate on creating/fixing any vocabularies (the focus of the previous vocamps I&#8217;ve attended), but it was great to have together so many people with an interest in the semantic web in the locality, and the presentations were all really good.</p>
<p><a href="http://www.csd.abdn.ac.uk/~jpan/">Jeff Pan</a> and <a href="http://www.csd.abdn.ac.uk/people/homepage.php?userid=ethomas">Edward Thomas</a> from Aberdeen University presented some great tutorials that covered a lot of ground, from RDFa, OWL2 and data-modeling methodology with Protegè.<br />
<a href="http://www.flickr.com/photos/55579041@N00/3928505248/" title="Jeff Pan on OWL 2 by keithalexander, on Flickr"><img src="http://farm3.static.flickr.com/2451/3928505248_b6b0e95e53.jpg" width="500" height="375" alt="Jeff Pan on OWL 2" /></a>. (I especially liked the slide  explaining <a href="http://www.flickr.com/photos/55579041@N00/3928504300/">how machines understand markup</a>.)</p>
<p><a href="http://nxg.me.uk/">Norman Gray</a> and <a href="http://www.dcs.gla.ac.uk/~schalmers/index.shtml">Stuart Chalmers</a> presented their work on creating SKOS mappings between astronomy vocabularies.</p>
<p><a href="http://www.flickr.com/photos/55579041@N00/3927721793/" title="Norman Gray on vocabulary mapping with SKOS by keithalexander, on Flickr"><img src="http://farm3.static.flickr.com/2575/3927721793_4a7e61b2ed.jpg" width="500" height="375" alt="Norman Gray on vocabulary mapping with SKOS" /></a></p>
<p><a href="http://eduspaces.net/jennyu/">Jenny Ure</a> from Edinburgh University talked about some of her work on the Socio-technical aspect of collaborative ontologies and knowledge systems.</p>
<p><a href="http://www.flickr.com/photos/55579041@N00/3928504420/" title="Jenny Ure by keithalexander, on Flickr"><img src="http://farm3.static.flickr.com/2654/3928504420_04616bfe0c.jpg" width="500" height="375" alt="Jenny Ure" /></a></p>
<p><a href="http://www.ukgovweb.org/profile/PeterWinstanley">Peter Winstanley</a> talked about some of the data  curated by the Scottish Government, and showcased  Semantic Mediawiki for ontology development, and some different options for ontology visualisation. </p>
<p>Peter also pointed to the Communities Of Practice  for local Government <a href="http://www.communities.idea.gov.uk/c/1123216/home.do">Scottish Group: Shared Representation using Semantic Technologies </a>, inviting anyone with an interest in Semantic technologies to join and contribute to the discussion forums.</p>
<p><a href="http://www.flickr.com/photos/55579041@N00/3928504862/" title="Peter Winstanley on Ontology visualisation and Scottish Gov Data by keithalexander, on Flickr"><img src="http://farm3.static.flickr.com/2580/3928504862_36e89acc7f.jpg" width="500" height="375" alt="Peter Winstanley on Ontology visualisation and Scottish Gov Data" /></a></p>
<p><a href="http://sboucher.blogspot.com/">Serge Boucher</a> from Brussels talked about some of the exciting possibilities for location and context-aware semantic web services.</p>
<p><a href="http://www.flickr.com/photos/55579041@N00/3928504960/" title="Serge Boucher on Location Based Semantic Services by keithalexander, on Flickr"><img src="http://farm3.static.flickr.com/2526/3928504960_69715a642b.jpg" width="500" height="375" alt="Serge Boucher on Location Based Semantic Services" /></a></p>
<p><a href="http://cdlr.strath.ac.uk/people/dunsireg.htm"> Gordon Dunsire</a> from the Centre for Digital Library Research  presented on vocabularies, standards, and linked data in the library domain, making particular mention of the dramatic tale of the development of the <a href="http://id.loc.gov/authorities/">Library of Congress Subject Headings Dataset</a>.</p>
<p><a href="http://www.flickr.com/photos/55579041@N00/3928505102/" title="Gordon Dunsire on  Linked Data, vocabularies, and library metadata by keithalexander, on Flickr"><img src="http://farm3.static.flickr.com/2617/3928505102_d19a67d705.jpg" width="500" height="375" alt="Gordon Dunsire on  Linked Data, vocabularies, and library metadata" /></a></p>
<p><a href="http://www.computing.dundee.ac.uk/ac_staff/staffdetails.asp?313">Martin Dempster</a> from University of Dundee presented his research into Assistive Technologies helping people that have difficulties talking to communicate, his use of ontologies to manage the data in his prototype system, and consuming data from popular social web 2.0 sites to generate conversational choices.</p>
<p><a href="http://www.flickr.com/photos/55579041@N00/3927723139/" title="Martin Dempster on Semantic enhanced Assistive Technology by keithalexander, on Flickr"><img src="http://farm3.static.flickr.com/2495/3927723139_a2807599c7.jpg" width="500" height="375" alt="Martin Dempster on Semantic enhanced Assistive Technology" /></a></p>
<p>The event was hosted and facilitated by <a href="http://personal.strath.ac.uk/paola.dimaio/">Paola Di Maio</a> from the University of Strathclyde; thanks to Paola for organising the event, the university for laying on wifi and tea and coffee, and Talis for sponsoring the lunches.</p>
<img src="http://feeds.feedburner.com/~r/talis/n2/~4/sAL1J-Nx564" height="1" width="1"/>]]></content:encoded><description>This week saw the first Vocamp in Scotland, held at the University of Strathclyde, Glasgow.

Attendees came from a wide range  of different and interesting problem-spaces and domains and gave a lot of great presentations on their work. The range was too broad, perhaps, for us to find enough commonality to collaborate on creating/fixing any [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.talis.com/n2/archives/791/feed</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://blogs.talis.com/n2/archives/791</feedburner:origLink></item><item rdf:about="http://blogs.talis.com/n2/?p=770"><title>Notes on Cross-Domain Ajax</title><link>http://feedproxy.google.com/~r/talis/n2/~3/8motH3O5HPI/770</link><dc:subject>Ideas and Experiments</dc:subject><dc:subject>Projects</dc:subject><dc:subject>Tips and Tricks</dc:subject><dc:subject>Tutorials</dc:subject><dc:subject>ajax</dc:subject><dc:subject>analytics</dc:subject><dc:subject>cross-domain</dc:subject><dc:subject>hacks</dc:subject><dc:subject>http</dc:subject><dc:subject>javascript</dc:subject><dc:subject>php</dc:subject><dc:subject>scripting</dc:subject><dc:subject>tracking</dc:subject><dc:creator>Danny Ayers</dc:creator><dc:date>2009-07-30T16:23:26-07:00</dc:date><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<h3>Background</h3>
<p>I asked for a little project I could get my teeth into, <a href="http://www.ldodds.com/">Leigh</a> suggested something very tasty. An analytics app, along the lines of <a href="http://www.google.com/analytics/">Google Analytics</a> or the (very impressive) open source <a href="http://piwik.org/">Piwik</a>. Basically tracking things like page visits, referers, outbound clicks and so on. The difference from the existing apps being taking advantage of semweb goodness, specifically a <a href="http://www.talis.com/platform/">Talis Platform</a> store as a backend.</p>
<p>What this required was something that would run in the browser when someone visited a given Web page and pass on relevant data to a server which would push that data into the store. A script discretely embedded on the page of interest picks up the activity and posts it to the server-side logging system. There wasn&#8217;t really a sensible choice other than to use Javascript client-side, and to keep things reasonably portable server-side I opted for PHP. The server-side processing is relatively straightforward (although I&#8217;m not actually capturing much yet), but the browser-server comms part turned out to be a real doozy.</p>
<p>It&#8217;s not difficult to call a HTTP server from inside Javascript wrapped in HTML loaded in a browser. The snag is that the security model common to popular browsers blocks access to server domains other than the one that originated the page containing the Javascript. I got some code running from <code>http://hyperdata.org</code> that nicely delivered some basic logging of visits to pages on <code>http://hyperdata.org</code> (including the <a>Wiki</a> I have there &#8211; though it took a while to find the right template&#8230;). Problems started when I tried the same script in pages hosted under <code>http://danny.ayers.name</code>. Browser no likey, wrapping the server call in a <code>try...catch</code> block and throwing up an <code>alert(error)</code> always revealed <strong>Exception&#8230; &#8220;Access to restricted URI denied&#8221; code: &#8220;1012&#8243;</strong> &#8211; this is the <a href="https://developer.mozilla.org/En/Same_origin_policy_for_JavaScript">same origin policy</a>. What follows are the workarounds for this. Googling the titles here will provide a variety of sample code that implements the solutions. I&#8217;ve opted for Hidden Form, it being straightforward for my purposes and standards-friendly.</p>
<h3>Cross-domain proxy</h3>
<p>Conceptually the easiest, this approach uses a server-side pipeline that lives on the same domain as the delivered pages containing the Javascript. It essentially echos calls from the delivering server to the remote server that does the work. This didn&#8217;t seem a good choice for the analytics app as every end-user would require such a proxy on their own server.</p>
<ul>
<li><strong>Pros:</strong> straightforward; independent of browser vagaries; spec friendly</li>
<li><strong>Cons:</strong> needed for every host delivering pages with embedded scripts (if all the servers involved are yours, this is probably a good choice)</li>
</ul>
<h3>Tag Overload Hacks</h3>
<p>When a typical browser hits HTML tags <code>&lt;script&gt;</code> and <code>&lt;img&gt;</code> <em>(any others?)</em> it will quite happily do a HTTP GET on them, irrespective of domain. There&#8217;s been a fair bit of finesse applied around the use of <code>&lt;script&gt;</code> &#8211; notably the elegant but brain-boiling <a href="http://bob.pythonmac.org/archives/2005/12/05/remote-json-jsonp/">JSONP</a> (JSON with Padding) which passes around scripts padded to be non-executable and involves callbacks. <em>Somehow.</em> I won&#8217;t comment further on this, except to say I understood it for about 5 minutes then lost it again when I went to make a coffee. I&#8217;m told <a href="http://jquery.com/">jQuery</a> will do something similar automagically if you choose <code>datatype: "json"</code> and <code>method: "get"</code>.</p>
<p>The <code>&lt;img&gt;</code> approach has been around seemingly forever &#8211; it&#8217;s also known as a <a href="http://en.wikipedia.org/wiki/Web_bug">Web Bug</a>. Usually you have a 1&#215;1 pixel image in the page of interest (probably inserted dynamically through DOM calls), every time the page is loaded that image&#8217;s URI gets a GET. The trick for tracking is to append the image URI with a bunch of query parameters and have your server intercept the GET call. Apparently this is how Google Analytics does its stuff.</p>
<ul>
<li><strong>Pros:</strong> good library support</li>
<li><strong>Cons:</strong> limited to GETs; rather an ugly hack</li>
</ul>
<h3>Flash Proxy</h3>
<p>Most people suggested this when I was asking around Twitter and the jQuery mailing list. Turns out there&#8217;s a really convenient library that does all the hard work (Google &#8220;flXHR&#8221;). But I&#8217;m afraid I prefer to give Flash a miss when there are open standards available, so I didn&#8217;t investigate.</p>
<ul>
<li><strong>Pros:</strong> easy (apparently) with library support</li>
<li><strong>Cons:</strong> uses proprietary stuff</li>
</ul>
<h3>Hidden Form</h3>
<p>When I first saw references to this I overlooked it &#8211; it seemed to demand an iFrame and ugly hackery. But then (largely thanks to this discussion of <a href="http://am.net/resources/javascript/CrossDomainAJAX.adpx">cross-domain Ajax</a>) I realised it was almost certainly the best bet for the analytics app. Essentially you dynamically push a <code>&lt;form&gt;</code> into the HTML DOM with your data as input values, then call a <code>form.submit()</code>. Most references to this I found did involve an iFrame to receive the HTTP response &#8211; necessary if you&#8217;re doing a mashup or something, but not if you only need to <code>POST</code> data off to the server. In this latter circumstance you need to get the server to return a <code>204 No Content</code> status code, but that&#8217;s trivial in PHP (<code>header('HTTP/1.1 204 No Content');</code>), otherwise the browser will try to load the target URI material.  </p>
<ul>
<li><strong>Pros:</strong> supports and is very simple for POSTing to server; standards-friendly in this context</li>
<li><strong>Cons:</strong> gets uglier if you want a response</li>
</ul>
<p>I&#8217;ve not properly doc&#8217;d my app code yet (and the functionality is a very long way from complete, let alone tidied up), but you can find it all via my latest <a href="http://hyperdata.org/wiki/wiki/Ttracker">Wiki</a> &#8211; there&#8217;s an example of the Javascript in <a href="http://danny.ayers.name/test.html">test.html</a> (just before the closing <code>&lt;/body&gt;</code> tag). I&#8217;ve only tested it on Firefox so far, but I reckon there&#8217;s a good chance of the LazyWeb giving me solutions to any cross-browser issues.</p>
<p>Many thanks for all the helpful suggestions: from <a href="http://groups.google.com/group/jquery-en/browse_thread/thread/0b68f4fc5dd9c196">this thread on the jQuery mailing list</a> and Twitterers <a href="http://twitter.com/rjw">@rjw</a> <a href="http://twitter.com/flensed">@flensed</a> <a href="http://twitter.com/gridinoc">@gridinoc</a> <a href="http://twitter.com/weblivz">@weblivz</a> <a href="http://twitter.com/JeniT">@JeniT</a> <a href="http://twitter.com/jQueryHowto">@jQueryHowto</a>.</p>
<p>I&#8217;d love to hear of any other solutions to cross-domain Ajax, please drop in comments, <a href="mailto:danny.ayers@gmail.com">mail me</a> or <a href="http://twitter.com/danja">tweet me</a>.</p>
<img src="http://feeds.feedburner.com/~r/talis/n2/~4/8motH3O5HPI" height="1" width="1"/>]]></content:encoded><description>Background
I asked for a little project I could get my teeth into, Leigh suggested something very tasty. An analytics app, along the lines of Google Analytics or the (very impressive) open source Piwik. Basically tracking things like page visits, referers, outbound clicks and so on. The difference from the existing apps being taking advantage of [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.talis.com/n2/archives/770/feed</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">1</slash:comments><feedburner:origLink>http://blogs.talis.com/n2/archives/770</feedburner:origLink></item><item rdf:about="http://blogs.talis.com/n2/?p=746"><title>Visualising BBC Programme Categories</title><link>http://feedproxy.google.com/~r/talis/n2/~3/ygA74h4flLM/746</link><dc:subject>Ideas and Experiments</dc:subject><dc:subject>Tips and Tricks</dc:subject><dc:subject>bbc</dc:subject><dc:subject>SPARQL</dc:subject><dc:subject>visualisation</dc:subject><dc:creator>Leigh Dodds</dc:creator><dc:date>2009-07-17T01:14:15-07:00</dc:date><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>Whilst I was exploring the BBC programmes data looking for possible demonstration applications I thought it might be interesting to try and create a visualisation of the relationships between different categories of BBC programmes The BBC datasets use SKOS as a categorization scheme, with separate taxonomies for <a href="http://www.bbc.co.uk/programmes/formats">formats</a> (e.g. documentaries, animation, etc) and <a href="http://www.bbc.co.uk/programmes/genres">genres</a> (e.g. childrens programmes, science fiction, etc). If you poke around a little, you can also see a nascent category system for <a href="http://www.bbc.co.uk/programmes/places">places</a> and <a href="http://www.bbc.co.uk/programmes/people">people</a>, although there doesn&#8217;t seem to be much data there at present (and what is there seems to change regularly).</p>
<p>For my purposes, the genre classifications looked most interesting. Episodes are associated with their genre category via the <a href="http://www.bbc.co.uk/ontologies/programmes/2009-04-17.shtml#category">po:category</a> property. As I was interested in finding relationships between genres, what I was looking for was a way to relate together individual categories, other than by the obvious super/sub-category relationship. </p>
<p>It occured to me that if two categories were associated with the same episode, then this could be viewed as a declaration of some implicit relationship between the categories. Extracting this in SPARQL is straight-forward, as we just need to match episodes that have more than one category:</p>
<pre><code>
SELECT ?categoryLabel ?relatedLabel WHERE
{
  ?episode a po:Episode;
    po:category ?category;
    po:category ?related. 

  ?category a po:Genre;
    rdfs:label ?categoryLabel. 

  ?related a po:Genre;
    rdfs:label ?relatedLabel. 

  FILTER (?category != ?related)
}
ORDER BY ?categoryLabel
</code></pre>
<p>In the above SPARQL query we match any episode that has at least two categories (because we use two <code>po:category</code> patterns), and where those categories are different (in the FILTER). This excludes the unwanted result where the <code>?category</code> and <code>?related</code> variables are bound to the same value. I didn&#8217;t bother with pruning out duplicates as this could easily be done on the client-side.</p>
<p>In order to visualise the results, I decided to use MooWheel. This provides a simple Javascript visualisation toolkit for presenting connections between a set of resources. <a href="http://www.unwieldy.net/projects/moowheel/">MooWheel</a> can be configured using a JSON data structure, so generating a a MooWheel visualisation from a SPARQL query is relatively straight-forward: the query results can be retrieved as SPARQL/JSON which can then be massaged into the appropriate JSON structure to generate the MooWheel visualisation. Check out <a href="http://api.talis.com/stores/bbc-demo/items/demos/lib/subject-relations.js">the source code of the demonstration</a> for sample code to do this (look at the <code>success</code> callback).</p>
<p>My first attempt at a visualisation simple executed the above query across the entire BBC dataset. This generated a huge wheel of connections between the categories, but ultimately the visualisation wasn&#8217;t that useful. So I decided to refine the visualisation to generate separate category wheels for each of the main BBC TV channels. This involved refining the SPARQL query to include an extra triple pattern to limit Episodes to just those associated with a specific channel (<code>po:masterbrand</code>). The following revised query restricts results to BBC 1:</p>
<pre><code>
SELECT ?categoryLabel ?relatedLabel WHERE
{
  ?episode a po:Episode;
    po:masterbrand ;
    po:category ?category;
    po:category ?related. 

  ?category a po:Genre;
    rdfs:label ?categoryLabel. 

  ?related a po:Genre;
    rdfs:label ?relatedLabel. 

  FILTER (?category != ?related)
}
ORDER BY ?categoryLabel
</code></pre>
<p>The <a href="http://api.talis.com/stores/bbc-demo/items/demos/subject-relations.html">results of this visualisation</a> is much more interesting. </p>
<p>Each of the BBC channels has a different range of programming and this emphasis is really clear in the visualisation. Compare for example BBC 1 and BBC 3, or either with BBC 4. For those of us in the UK who have already internalised this, there may not be a great deal of new information here, but its nice to see how this feature of the dataset can be easily surfaced with very little effort. There&#8217;s more analysis that could be done here though, particularly if the BBC open up their programme archives. For example, how do the range of programme categories for a channel change over time? Which programmes actually link the different categories together? Could other visualisations provide more insight into the programming than a simple relationship wheel? For example, could a treemap style visualisation give some indication of the amount of schedule time devoted to a particular category of programme?</p>
<p>Why not see what you can come up with?</p>
<img src="http://feeds.feedburner.com/~r/talis/n2/~4/ygA74h4flLM" height="1" width="1"/>]]></content:encoded><description>Whilst I was exploring the BBC programmes data looking for possible demonstration applications I thought it might be interesting to try and create a visualisation of the relationships between different categories of BBC programmes The BBC datasets use SKOS as a categorization scheme, with separate taxonomies for formats (e.g. documentaries, animation, etc) and genres (e.g. [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.talis.com/n2/archives/746/feed</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://blogs.talis.com/n2/archives/746</feedburner:origLink></item><item rdf:about="http://blogs.talis.com/n2/?p=722"><title>Presenting BBC and NASA data using Freemix and SPARQL</title><link>http://feedproxy.google.com/~r/talis/n2/~3/DD69_3YvOaA/722</link><dc:subject>Tips and Tricks</dc:subject><dc:subject>Tutorials</dc:subject><dc:subject>bbc</dc:subject><dc:subject>freemix</dc:subject><dc:subject>morph</dc:subject><dc:subject>nasa</dc:subject><dc:subject>SPARQL</dc:subject><dc:creator>Leigh Dodds</dc:creator><dc:date>2009-07-16T03:55:12-07:00</dc:date><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>One of the most interesting applications I saw at the recent Semantic Technology conference was <a href="http://freemix.it/">Freemix</a>. The application, which is currently in limited beta, allows anyone to easily create customized views over data that they upload into the system. There&#8217;s also the usual networking features providing an additional social dimension to data sharing and publishing. As I understand it Zepheira have plans for expanding the range of features in all sorts of ways, including new visualisations, the ability to merge and remix data from several sources, and naturally enough a commercial version that can be deployed within the enterprise.</p>
<p>The core of Freemix is <a href="http://www.simile-widgets.org/exhibit/">Simile Exhibit</a> and a drag and drop interface for building up an Exhibit presentation over data that the user has uploaded. Data can be presented in several different ways, including simple tabular spreadsheets and in the Exhibit JSON format. Exhibit provides a number of different existing views suitable for presenting data, including lists, tables, maps, timelines, etc. As a web developer its straight-forward to build up your own Exhibits; Freemix takes this to the next level, making it trivial to build a presentation in just a few clicks, without the need to learn any markup: you just have to understand your own data.</p>
<p>Naturally enough I was curious to know whether Freemix could be used to build presentations of Linked Data, and specifically whether I could feed it with data from the Talis Platform. I&#8217;ve been working with the BBC data quite extensively recently, and have been compiling <a href="http://nasa.dataincubator.org">a space flight dataset</a>. So I thought I&#8217;d use those as my test cases. Both of these datasets are in Platform stores, so I explored the options for extracting data using a SPARQL query in order to build a presentation in Freemix. It turns out its really easy.</p>
<p>Freemix supports importing JSON data from a URL, so I knew that in theory I could write a SPARQL query against a Platform store and use the SPARQL protocol request URL as the import target. As I didn&#8217;t want to extract the whole dataset, just some interesting subset for my presentation, a SPARQL CONSTRUCT query seemed like the best option. Like Exhibit, Freemix requires a relatively flat data structure &#8212; i.e. resources with properties, rather than a true directed graph. This means that within the CONSTRUCT query I would need to simplify the graph structure, removing some of the richer modelling, to re-shape the data to fit Freemix&#8217;s expectations.</p>
<p>Here&#8217;s a query I came up with for my NASA data:</p>
<pre><code>
PREFIX rdfs:
PREFIX dc:
PREFIX space:
PREFIX xsd:
PREFIX foaf: </code>

CONSTRUCT {
?spacecraft foaf:name ?name;
space:agency ?agency;
space:mass ?mass;
foaf:homepage ?homepage;
space:launched ?launched;
dc:description ?description;
space:discipline ?label.
}
WHERE {
?launch space:launched ?launched.

?spacecraft foaf:name ?name;
space:agency ?agency;
space:mass ?mass;
foaf:homepage ?homepage;
space:launch ?launch;
dc:description ?description;
space:discipline ?discipline.

?discipline rdfs:label ?label.

FILTER (?launched &gt; "2005-01-01"^^xsd:date)
}
</pre>
<p></code></p>
<p>The query finds all spacecraft launched since 2005, extracting the name, agency, mass, etc. The labels of the disciplines (subject categories) and the launch dates which are originally associated with separate resources in the underlying graph, are re-presented here as properties of the spacecraft itself. Not ideal in a modelling or data interchange perspective, but a reasonable trade-off for shaping data for presentation purposes.</p>
<p>So far so good. The Talis Platform supports a range of output options from CONSTRUCT queries including both RDF/XML and <a href="http://n2.talis.com/wiki/RDF_JSON_Specification">RDF/JSON</a>. Unfortunately Freemix doesn't support RDF/JSON as an input option although this would make a nice addition to the range of import options. In order to convert from the RDF/XML to the Exhibit/JSON format for Freemix I used the <a href="http://morph.talis.com">Talis Morph service</a>. Morph is a simple service that provides a number of options for converting between semantic web formats. RDF/XML to Exhibit/JSON is one of those options, so all I needed to do was pipe <a href="http://api.talis.com/stores/space/services/sparql?query=PREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0D%0APREFIX+dc%3A+%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%3E%0D%0APREFIX+space%3A+%3Chttp%3A%2F%2Fpurl.org%2Fnet%2Fschemas%2Fspace%2F%3E%0D%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0D%0APREFIX+foaf%3A+%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%0D%0A%0D%0ACONSTRUCT+{%0D%0A++%3Fspacecraft+foaf%3Aname+%3Fname%3B%0D%0A++++++++++++++space%3Aagency+%3Fagency%3B%0D%0A++++++++++++++space%3Amass+%3Fmass%3B%0D%0A++++++++++++++foaf%3Ahomepage+%3Fhomepage%3B%0D%0A++++++++++++++space%3Alaunched+%3Flaunched%3B%0D%0A++++++++++++++dc%3Adescription+%3Fdescription%3B%0D%0A++++++++++++++space%3Adiscipline+%3Flabel.++++++++%0D%0A}%0D%0AWHERE+{%0D%0A++%3Flaunch+space%3Alaunched+%3Flaunched.%0D%0A%0D%0A++%3Fspacecraft+foaf%3Aname+%3Fname%3B%0D%0A++++++++++++++space%3Aagency+%3Fagency%3B%0D%0A++++++++++++++space%3Amass+%3Fmass%3B%0D%0A++++++++++++++foaf%3Ahomepage+%3Fhomepage%3B%0D%0A++++++++++++++space%3Alaunch+%3Flaunch%3B%0D%0A++++++++++++++dc%3Adescription+%3Fdescription%3B%0D%0A++++++++++++++space%3Adiscipline+%3Fdiscipline.%0D%0A%0D%0A+++%3Fdiscipline+rdfs%3Alabel+%3Flabel.%0D%0A%0D%0A+++FILTER+(%3Flaunched+%3E+%222005-01-01%22^^xsd%3Adate)%0D%0A}">the original SPARQL query URL</a> through the morph service to get <a href="http://morph.talis.com/?data-uri%5B%5D=http%3A%2F%2Fapi.talis.com%2Fstores%2Fspace%2Fservices%2Fsparql%3Fquery%3DPREFIX%2Brdfs%253A%2B%253Chttp%253A%252F%252Fwww.w3.org%252F2000%252F01%252Frdf-schema%2523%253E%250D%250APREFIX%2Bdc%253A%2B%253Chttp%253A%252F%252Fpurl.org%252Fdc%252Felements%252F1.1%252F%253E%250D%250APREFIX%2Bspace%253A%2B%253Chttp%253A%252F%252Fpurl.org%252Fnet%252Fschemas%252Fspace%252F%253E%250D%250APREFIX%2Bxsd%253A%2B%253Chttp%253A%252F%252Fwww.w3.org%252F2001%252FXMLSchema%2523%253E%250D%250APREFIX%2Bfoaf%253A%2B%253Chttp%253A%252F%252Fxmlns.com%252Ffoaf%252F0.1%252F%253E%250D%250A%250D%250ACONSTRUCT%2B%7B%250D%250A%2B%2B%253Fspacecraft%2Bfoaf%253Aname%2B%253Fname%253B%250D%250A%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2Bspace%253Aagency%2B%253Fagency%253B%250D%250A%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2Bspace%253Amass%2B%253Fmass%253B%250D%250A%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2Bfoaf%253Ahomepage%2B%253Fhomepage%253B%250D%250A%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2Bspace%253Alaunched%2B%253Flaunched%253B%250D%250A%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2Bdc%253Adescription%2B%253Fdescription%253B%250D%250A%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2Bspace%253Adiscipline%2B%253Flabel.%2B%2B%2B%2B%2B%2B%2B%2B%250D%250A%7D%250D%250AWHERE%2B%7B%250D%250A%2B%2B%253Flaunch%2Bspace%253Alaunched%2B%253Flaunched.%250D%250A%250D%250A%2B%2B%253Fspacecraft%2Bfoaf%253Aname%2B%253Fname%253B%250D%250A%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2Bspace%253Aagency%2B%253Fagency%253B%250D%250A%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2Bspace%253Amass%2B%253Fmass%253B%250D%250A%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2Bfoaf%253Ahomepage%2B%253Fhomepage%253B%250D%250A%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2Bspace%253Alaunch%2B%253Flaunch%253B%250D%250A%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2Bdc%253Adescription%2B%253Fdescription%253B%250D%250A%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2Bspace%253Adiscipline%2B%253Fdiscipline.%250D%250A%250D%250A%2B%2B%2B%253Fdiscipline%2Brdfs%253Alabel%2B%253Flabel.%250D%250A%250D%250A%2B%2B%2BFILTER%2B%28%253Flaunched%2B%253E%2B%25222005-01-01%2522%5E%5Exsd%253Adate%29%250D%250A%7D&amp;input=rdf-xml&amp;output=exhibit-json&amp;callback=">my final import target for Freemix</a>.</p>
<p>You can <a href="http://freemix.it/dataprofile/ldodds/spacecraft-launches-since-2005/">view the imported data</a> on <a href="http://freemix.it/profiles/ldodds/">my Freemix homepage</a>. And here's <a href="http://freemix.it/freemix/ldodds/spacecraft-launches-2005-09/">a presentation of that same data</a>. As you can see the presentation provides a list and table views, piecharts that break down launches by agency and discipline, and also a timeline view of the launches. This was incredibly quick to put together.</p>
<p>I tried the same approach with some BBC data. So here's <a href="http://freemix.it/freemix/ldodds/episodes-of-dr-who-series-1-4/">a simple Dr Who episode guide as a Freemix</a>. The presentation options are a little more limited here, partly because there aren't as many natural facets to the BBC data, but also because Freemix doesn't (yet?) offer the ability to, e.g. create a coverflow presentation of images, or a tag cloud over blocks of text. The ability to mark fields as numbers and sort tables by multiple fields would also be useful. Having said that, trying searching for "Rose" in the search box to see which episodes descriptions mention her; note that the series facet on the left also automatically updates.</p>
<p>As you can see from the SPARQL query, some massaging of the graph structure was required to include series titles against each episodes.</p>
<pre><code>
PREFIX foaf:
PREFIX rdfs:
PREFIX po:
PREFIX dc:
PREFIX freemix: </code>

CONSTRUCT {

?episode a po:Episode;
foaf:depiction ?depiction;
freemix:seriesTitle ?seriestitle;
dc:title ?title;

po:position ?position;
po:short_synopsis ?syn.
}
WHERE
{
po:series ?series.

?series dc:title ?seriestitle;
po:episode ?episode.

?episode a po:Episode;
foaf:depiction ?depiction;
dc:title ?title;
po:position ?position;
po:short_synopsis ?syn.

}
</code></pre>
<p>My only other issue with Freemix is the live-ness of the data. Ideally instead of having to import data directly into the system, it should instead be fetched from source either on demand or on a regular basis. I suspect this is the kind of feature that will end up in a commercial version of the product.</p>
<p>Overall though I was quite pleased with how easy it was to create these kinds of presentations. I'm convinced that for Linked Data to truly hit the mainstream we need simple tools like Freemix that let all of us easily compile and create custom presentations of data. Obviously, we also need to be able to easily select the data that we want to display, and very few people will want to bother with SPARQL queries. So I think there is some interesting work to be done to create SPARQL query builders that tie into browsers, e.g. so I can select the data facets I'm interested in as I browse and then choose to represent those facets in different ways.</p>
<img src="http://feeds.feedburner.com/~r/talis/n2/~4/DD69_3YvOaA" height="1" width="1"/>]]></content:encoded><description>One of the most interesting applications I saw at the recent Semantic Technology conference was Freemix. The application, which is currently in limited beta, allows anyone to easily create customized views over data that they upload into the system. There&amp;#8217;s also the usual networking features providing an additional social dimension to data sharing and publishing. [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.talis.com/n2/archives/722/feed</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://blogs.talis.com/n2/archives/722</feedburner:origLink></item><item rdf:about="http://blogs.talis.com/n2/?p=659"><title>Data Migration using SPARQL and Changesets</title><link>http://feedproxy.google.com/~r/talis/n2/~3/3GEVY_SztTg/659</link><dc:subject>Tips and Tricks</dc:subject><dc:subject>Tutorials</dc:subject><dc:creator>kwijibo</dc:creator><dc:date>2009-07-10T01:25:21-07:00</dc:date><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>A tagline sometimes used for RDF is “self-describing data”. Sometimes though, you make your data describe itself badly; perhaps you’ve used a vocabulary term that has since been deprecated, or perhaps you’ve found a term which is more widely supported, or more appropriate to the data; maybe there was a typo in the script you generated your triples with. At any rate, it’s pretty common to have to fix your data, and if you have a live application with fresh ‘bad’ triples being created all the time, and a lot of bad triples to fix anyway, this can get tricky.</p>
<p>We&#8217;re having to do this in a project at the moment, and this is the method <a href="http://www.virtualchaos.co.uk/">Nad</a> and I came up with. We separated out adding <em>good triples</em> and removing <em>bad triples</em> into separate stages because our application will continue to function the same with both good and bad triples, but, once we rollout the code that expects the good triples, we <em>need</em> the good triples, whereas the bad triples can be removed at our leisure.</p>
<h3>Adding New Good Triples</h3>
<p>So, say for example, one of the things we want to fix is using <code>dcterms:creator</code> instead of <code>dc:creator</code>. We can get the good triples by querying for:</p>
<pre>
    CONSTRUCT {
    # good
                ?s &lt;http://purl.org/dc/terms/creator&gt; ?o
    } WHERE {
    # bad
                ?s &lt;http://purl.org/dc/elements/1.1/creator&gt; ?o
    }
</pre>
<p>And posting that back into the store. (First make sure that your application won&#8217;t do anything too weird if you add in these triples without changing any code).</p>
<p>If there are a lot of triples in the store, you may not be able to retrieve and post them all at once. To scale to large numbers of triples, just page through the results at, say, 1000 triples at a time by adding <code>LIMIT 1000 OFFSET 0 </code> and incrementing the OFFSET by the LIMIT (1000) until you don&#8217;t get  triples back anymore.</p>
<p>Wrap this little procedure up in a script because you&#8217;ll need to run it again.</p>
<h3>Deploy Code</h3>
<p>As soon as you have finished adding the new /good/ triples, deploy your new code that uses <code>dcterms:creator</code> instead of <code>dc:creator</code>. </p>
<p>Now run the <em>add good triples</em> script again. This is because, while you were deploying the code, users may have been plugging away at your app, happily creating more bad old triples. Running the script again will add good triples for any of these bad triples that have been created meantime. And because you&#8217;ve now deployed your code changes, the application won&#8217;t create any more bad triples.</p>
<p>All we have left to do is get rid of the bad old triples. With any luck (and a bit of foresight, and testing), your application will function perfectly well with both bad and good triples in the store, so we can take our time a bit getting rid of the bad triples.</p>
<h3>Removing Bad Old Triples</h3>
<p>We&#8217;ll write a SPARQL query to give us back the triples we want to remove, and then we&#8217;ll create a Changeset to remove them:</p>
<pre>
    CONSTRUCT {
    # bad
             ?s &lt;http://purl.org/dc/elements/1.1/creator&gt; ?o
    } WHERE {

    # bad
            ?s &lt;http://purl.org/dc/elements/1.1/creator&gt; ?o
    # good
            ?s &lt;http://purl.org/dc/terms/creator&gt; ?o

    }
</pre>
<p>(<ins>you should apply a LIMIT, but, so long as you are waiting for each changeset batch to succeed before sending the next one, you don&#8217;t need to page &#8211; just get back the first 1000 until you don&#8217;t get anything back.</ins> It&#8217;s worth remembering that the number of triples in a changeset document will be about ten-fold the number of triples you are removing, so you may need to make the limit a bit smaller than before).</p>
<p>An important point on the platform&#8217;s Changesets API: if you send more than <strong>14 changesets in a batch</strong> (ie, in the same document), they will be performed <em>asynchronously</em> and you should get back an <strong>HTTP 202 Accepted</strong> status code. A potential problem is that, if you are trying to <strong>remove a statement that doesn&#8217;t exist</strong> then all the changes in that batch will fail, but you will still get back a 202 Accepted (because the platform hasn&#8217;t tried processing them yet). You need a way of knowing if the batch has failed or not. One way to do this is to include in your batch of changes, the addition of a triple you can then poll the store for to see if it exists or not. </p>
<p>If you&#8217;re using PHP, you can use Moriarty to create your changesets:</p>
<pre>
    <code>
#php
define('STORE_URI', 'http://api.talis.com/stores/sandbox1');
$markerURI =  STORE_URI.'/items/'.time();
$time = time();

$rdfToAdd = " &lt;{$markerURI}&gt; &lt;http://purl.org/dc/terms/created&gt; \&quot;{$time}\&quot; . ";

$args = array(
    'before' =&gt; $rdfToRemove, // got this from the CONSTRUCT described above
    'after' =&gt; $rdfToAdd, // this is the marker triple
);
$cs = new Changeset($args);
$store = new Store(STORE_URI); // you will probably need to add your login credentials - see the moriarty docs
$response = $store-&gt;get_metabox()-&gt;apply_changeset($cs);

if(!$response-&gt;is_success()){
    //log error, and stop
    log_error("Changeset failed: ".$response-&gt;status_code ."\n " . $response-&gt;body ." \n  Changeset: \n" . $cs-&gt;to_rdfxml());
    break;
}

    </code>
</pre>
<p>At this point, you may also want to poll the store for the existence of your marker triple to see if the  batch has been processed. Since we minted  the marker URI in the store&#8217;s URI space, we can just try to dereference it; as soon as we get back a 200 or 303 response, we can move on, but if we still get back a 404 after say 10 seconds, the changeset has probably failed and we need to log that and investigate.</p>
<p>If everything goes OK, you can then make double sure you&#8217;ve got rid of all the bad triples by running a quick ASK query against your store&#8217;s SPARQL service.</p>
<pre>
    <code>
        ASK {
            # bad
            ?s &lt;http://purl.org/dc/elements/1.1/creator&gt; ?o
        }
    </code>
</pre>
<p>And if you get back FALSE, you&#8217;re finished. </p>
<p>Well done!</p>
<img src="http://feeds.feedburner.com/~r/talis/n2/~4/3GEVY_SztTg" height="1" width="1"/>]]></content:encoded><description>A tagline sometimes used for RDF is “self-describing data”. Sometimes though, you make your data describe itself badly; perhaps you’ve used a vocabulary term that has since been deprecated, or perhaps you’ve found a term which is more widely supported, or more appropriate to the data; maybe there was a typo in the script you [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.talis.com/n2/archives/659/feed</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">4</slash:comments><feedburner:origLink>http://blogs.talis.com/n2/archives/659</feedburner:origLink></item></rdf:RDF>
