<?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>Johns Blog &#187; Tracker</title>
	<atom:link href="http://blogs.gnome.org/johncarr/tag/tracker/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.gnome.org/johncarr</link>
	<description>Making your brain invert and fall out of your ear since 2007</description>
	<lastBuildDate>Tue, 11 Aug 2009 09:59:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Playing with RDF</title>
		<link>http://blogs.gnome.org/johncarr/2009/05/15/playing-with-rdf/</link>
		<comments>http://blogs.gnome.org/johncarr/2009/05/15/playing-with-rdf/#comments</comments>
		<pubDate>Fri, 15 May 2009 14:48:08 +0000</pubDate>
		<dc:creator>John Carr</dc:creator>
				<category><![CDATA[Nerd]]></category>
		<category><![CDATA[Conduit]]></category>
		<category><![CDATA[GNOME]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[RDF]]></category>
		<category><![CDATA[Tracker]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/johncarr/?p=118</guid>
		<description><![CDATA[I&#8217;ve been playing with the master branch of tracker and i&#8217;m loving it &#8211; it looks like its finally reached the stage where I won&#8217;t just turn it straight off after a fresh install.
It now brings GNOME an RDF store with a SPARQL interface. Powerful joo-joo, but kinda scary if you haven&#8217;t seen it before. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing with the master branch of <a href="http://projects.gnome.org/tracker/">tracker</a> and i&#8217;m loving it &#8211; it looks like its finally reached the stage where I won&#8217;t just turn it straight off after a fresh install.</p>
<p>It now brings GNOME an RDF store with a SPARQL interface. Powerful joo-joo, but kinda scary if you haven&#8217;t seen it before. Most conversations about it lead to words like graphs, triples, ontologies&#8230; My eyes start to gloss over.. I need to learn by doing. So i&#8217;ve been playing with writing some python <a href="http://github.com/Jc2k/tralchemy/tree/master">wrappers</a> to hide tracker and just provide a familiar pythonic interface.</p>
<p>Any object type that tracker knows about will be available in python via the wonders of introspection. All properties of the class are available, with docstrings explaining the intent of the property and its type. Obviously you can get, set and delete and do simple queries. And behind the scenes are SPARQL queries in all their glory. Theres a lot still to do, but enough done that I can synchronise my address book to Tracker with Conduit (see my <a href="http://github.com/Jc2k/conduit/tree/tracker">tracker</a> branch).</p>
<p>So far it looks something like this (but its subject to very rapid change):</p>
<p><code>import tralchemy<br />
from tralchemy.nco import Contact</code></p>
<p><code># add a contact<br />
c = Contact.create()<br />
c.fullname = "John Carr"<br />
c.firstname = "John"<br />
c.nickname = "Jc2k"<br />
c.commit()</code></p>
<p><code># find all the people called John<br />
for c in Contact.get(firstname="John"):<br />
&nbsp;&nbsp;print c.uri, c.fullname</code></p>
<p><code># subscribe to any contact changes<br />
def callback(subjects):<br />
&nbsp;&nbsp;print subjects<br />
Contact.notifications.connect("SubjectsAdded", callback)</code></p>
<p><code># Will probably be just:<br />
Contact.added.connect(callback)</code></p>
<p>While get() is a nice way to do simple queries, what if you wanted to do something a little more complicated. It always feels messy when you have SQL or SPARQL nested in other code. Existing SQL ORM tools are a great place to start at avoiding this, but i quite like the LINQ style generator-to-SPARQL. Something like:</p>
<p><code><br />
q = Query(Contact.firstname for Contact in Store if Contact.nickname == 'Jc2k')<br />
</code></p>
<p>or</p>
<p><code><br />
q = Query(c.firstname for c in Store if c is Contact and c.nickname == 'Jc2k')<br />
</code></p>
<p>Hmm decisions. Hope to implement similar abstractions in JavaScript, C# (via LINQ) and Vala (via Magic). Anyone wanna share their cloning tech?</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/johncarr/2009/05/15/playing-with-rdf/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
