<?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>Internet Alchemy &#187; paget</title>
	<atom:link href="http://blog.iandavis.com/tags/paget/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.iandavis.com</link>
	<description>blog.iandavis.com</description>
	<lastBuildDate>Sun, 06 Jun 2010 12:24:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=3.0-alpha</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>The Web is RMR not MVC</title>
		<link>http://blog.iandavis.com/2008/12/the-web-is-rmr-not-mvc</link>
		<comments>http://blog.iandavis.com/2008/12/the-web-is-rmr-not-mvc#comments</comments>
		<pubDate>Sat, 06 Dec 2008 10:21:38 +0000</pubDate>
		<dc:creator>Ian Davis</dc:creator>
				<category><![CDATA[Links]]></category>
		<category><![CDATA[konstrukt]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[paget]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[rmr]]></category>
		<category><![CDATA[tonic]]></category>

		<guid isPermaLink="false">http://iandavis.com/blog/?p=1306</guid>
		<description><![CDATA[Last year I wrote a short post titled MVC Obscures the Mechanics of the Web that drew together some other peoples writings on why MVC is poorly matched to the web. I didn&#8217;t give an alternative though, apart from indirectly in the comments. Now Paul James has written a succinct description of that alternative and [...]]]></description>
			<content:encoded><![CDATA[<p>Last year I wrote a short post titled <a href="http://iandavis.com/blog/2007/09/mvc-obscures-the-mechanics-of-the-web">MVC Obscures the Mechanics of the Web</a> that drew together some other peoples writings on why MVC is poorly matched to the web. I didn&#8217;t give an alternative though, apart from indirectly in the comments. Now Paul James has written a succinct description of that alternative and christened it <a href="http://www.peej.co.uk/articles/rmr-architecture.html">RMR &#8211; Resource Method Representation</a>.</p>
<p>In RMR (which is simply REST as seen on the Web) the user interacts with resources using representations via restricted set of methods. As Paul explains, typically this is implemented as a set of classes representing the resources, a set of Response classes and some kind of routing to tie it all together. This is how frameworks like <a href="http://tonic.sourceforge.net/">Tonic</a> (written by Paul) and <a href="http://code.google.com/p/konstrukt/">Konstrukt</a> work. It&#8217;s also how my RDF framework <a href="http://code.google.com/p/paget/">Paget</a> works, although that is very immature at the moment and doesn&#8217;t cover responses very well.</p>
<p>Here&#8217;s to banishing MVC from the web :)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.iandavis.com/2008/12/the-web-is-rmr-not-mvc/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Paget Iteration 2</title>
		<link>http://blog.iandavis.com/2008/11/paget-iteration-2</link>
		<comments>http://blog.iandavis.com/2008/11/paget-iteration-2#comments</comments>
		<pubDate>Mon, 10 Nov 2008 10:55:18 +0000</pubDate>
		<dc:creator>Ian Davis</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[linked data]]></category>
		<category><![CDATA[moriarty]]></category>
		<category><![CDATA[paget]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[rdf]]></category>

		<guid isPermaLink="false">http://iandavis.com/blog/?p=1268</guid>
		<description><![CDATA[A few weeks ago I released a small PHP framework for publishing linked data (see my earlier post Publishing Linked Data with PHP). Since then I have made a lot of changes to the code and ended up completely changing the application flow.
Previously all the behaviour was specified by a configuration array with a dispatcher [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago I released <a href="http://code.google.com/p/paget/">a small PHP framework</a> for publishing <a href="http://linkeddata.org/">linked data</a> (see my earlier post <a href="http://iandavis.com/blog/2008/09/publishing-linked-data-with-php">Publishing Linked Data with PHP</a>). Since then I have made a lot of changes to the code and ended up completely changing the application flow.</p>
<p>Previously all the behaviour was specified by a configuration array with a dispatcher class. I found that was limiting the flexibility I needed and the &#8220;simple&#8221; configuration array was becoming decidedly complex. The Dispatcher class has been replaced by a new <a href="http://code.google.com/p/paget/source/browse/trunk/paget_urispace.class.php">UriSpace</a> class which is responsible for identifying the resources identified by a group of URIs. Applications can create classes derived from UriSpace to encapsulate the behaviour of their resources. Resources are split into three categories: documents that can be served straight up, abstract resources and descriptions of abstract resources. The last two are where the interesting bits of Paget lie. An application will typically override the get_description method to return a custom description derived from <a href="http://code.google.com/p/paget/source/browse/trunk/paget_resourcedescription.class.php">ResourceDescription</a>. This class does all the hard work of finding triples about the requested abstract resource.</p>
<p>A class derived from ResourceDescription can override several methods to customise the RDF returned:</p>
<dl>
<dt>get_resources</dt>
<dd>This method returns an array of resource URIs that the description will consider when generating its RDF. The default behaviour is simply to chop the file extension off of the description&#8217;s URI. So, the description at <code>http://iandavis.com/id/me.rdf</code> will have a resource of <code>http://iandavis.com/id/me</code>.</dd>
<dt>get_generators</dt>
<dd>This returns a list of generators that seed the triples in the descrpition. The ResourceDescription class calls each generator&#8217;s add_triples method once for each resource returned by the get_resources method. Paget has some pre-defined generators that can <a href="http://code.google.com/p/paget/source/browse/trunk/paget_filegenerator.class.php">read triples from a local file</a> or from a <a href="http://code.google.com/p/paget/source/browse/trunk/paget_filegenerator.class.php">platform store</a>. The default behaviour is to do nothing.</dd>
<dt>get_augmentors</dt>
<dd>This returns a list of augmentors that add triples to the description. Paget comes with a few built-in augmentors to <a href="http://code.google.com/p/paget/source/browse/trunk/paget_storeaugmentor.class.php">augment with RDF from a platform store</a>, <a href="http://code.google.com/p/paget/source/browse/trunk/paget_simplepropertylabeller.class.php">annotate properties with human readable labels</a> and even <a href="http://code.google.com/p/paget/source/browse/trunk/paget_simpleinferencer.class.php">do some limited inferencing</a>. By default the simple property labeller is returned as an augmentor.</dd>
<dt>get_label</dt>
<dd>This just calculates a sensible label for the description that could be used in the title of a web page or a link. The default behaviour is to look for an rdfs:label, dc:title or foaf:name for the primary resource in the description (which is the first one returned by get_resources). Applications could override this to use whatever heuristics make sense for their data.</dd>
<dt>get</dt>
<dd>This is the dispatch point for HTTP GET requests. At a later date I hope to handle other methods too, but for now Paget is a read only system</dd>
<dt>get_html</dt>
<dd>This is called by the get method to generate an HTML representation of the description. By default it uses Paget&#8217;s <a href="http://code.google.com/p/paget/source/browse/trunk/paget_simplehtmlrepresentation.class.php">SimpleHtmlRepresentation</a> class but this is the point at which most customisations will take place for rendering linked data.</dd>
</dl>
<p>The HTML output from Paget has been revised too. The basic layout of the page is handled by the <a href="http://code.google.com/p/paget/source/browse/trunk/paget_simplehtmlrepresentation.class.php">SimpleHtmlRepresentation</a> class but some type-specific logic has been broken out into a number of &#8220;widgets&#8221;. There&#8217;s one for <a href="http://code.google.com/p/paget/source/browse/trunk/paget_ontologywidget.class.php">OWL ontologies</a>, <a href="http://code.google.com/p/paget/source/browse/trunk/paget_termwidget.class.php">RDF classes and properties</a> and a general one that can render any <a href="http://code.google.com/p/paget/source/browse/trunk/paget_datawidget.class.php">RDF data</a>. The html representation chooses an appropriate widget based in the type of the primary resource being rendered. I&#8217;m thinking about adding widgets for people and various other common classes. This is all very early and experimental. Ideally I would like the page to adapt itself completely dynamically based on the underlying data. Switching on the class of a resource is rather simplistic, but it will do as a starter.</p>
<p>Here&#8217;s an example of how I&#8217;m using Paget in my personal data space <a href="http://iandavis.com/id/me">http://iandavis.com/id/me</a>. All the data is held in a <a href="http://n2.talis.com/wiki/Store">Talis Platform store</a>. I handle requests to http://iandavis.com/id/ with some .htaccess rules that ensure every request is handled by a file called index.php which contains the code hooking the space up to Paget. In index.php I create a subclass of UriSpace called StoreBackedUriSpace that maps the URIs beneath http://iandavis.com/id/ to resources and their descriptions. That class creates instances of StoreBackedResourceDescription that use a StoreDescribeGenerators to fetch the descriptions from the platform store. The entire code for index.php (less PHP includes etc) is shown here:</p>
<pre><code>
class StoreBackedUriSpace extends PAGET_UriSpace {
  function get_description($uri) {
    return new StoreBackedResourceDescription($uri);
  }
}

class StoreBackedResourceDescription extends PAGET_ResourceDescription {
  function get_generators() {
    return array( new PAGET_StoreDescribeGenerator("http://api.talis.com/stores/iand") );
  }
}

$space = new StoreBackedUriSpace();
$space->dispatch();

</code></pre>
<p>That&#8217;s basically the pattern for publishing data using Paget: derive a class from UriSpace and override the get_description method to return a custom ResourceDescription. I do that to publish some vocabularies on vocab.org such as <a href="http://vocab.org/bio/0.1">Bio</a> and <a href="http://vocab.org/whisky/terms">Whisky</a>. The UriSpace for those locations returns a resource description class that uses the FileGenerator class to read the schemas from local RDF documents and the simple property labeller and the simple inferencer to augment the results. My other deployment, at <a href="http://placetime.com/">placetime.com</a>, uses a custom resource description for each type of resource with custom generators that create the raw triples based on the requested URI. </p>
<p>So far it seems that Paget is flexible enough to deal with these varied scenarios of data publishing. The next step is to start looking at editing of the data and providing more application functionality.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.iandavis.com/2008/11/paget-iteration-2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Publishing Linked Data With PHP</title>
		<link>http://blog.iandavis.com/2008/09/publishing-linked-data-with-php</link>
		<comments>http://blog.iandavis.com/2008/09/publishing-linked-data-with-php#comments</comments>
		<pubDate>Tue, 30 Sep 2008 19:21:09 +0000</pubDate>
		<dc:creator>Ian Davis</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[moriarty]]></category>
		<category><![CDATA[paget]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[platform]]></category>
		<category><![CDATA[rdf]]></category>

		<guid isPermaLink="false">http://iandavis.com/blog/?p=1226</guid>
		<description><![CDATA[For a while now I&#8217;ve been experimenting with writing my own little PHP applications that run against the Talis Platform. Most of these have never been seen in public because they&#8217;re mainly just for scratching an itch I have at the time. I&#8217;ve also used a lot of them to validate my own thinking around [...]]]></description>
			<content:encoded><![CDATA[<p>For a while now I&#8217;ve been experimenting with writing my own little PHP applications that run against the <a href="http://www.talis.com/platform/">Talis Platform</a>. Most of these have never been seen in public because they&#8217;re mainly just for scratching an itch I have at the time. I&#8217;ve also used a lot of them to validate my own thinking around the types of services that the platform needs to provide to build interesting applications. The core of most of those applications became <a href="http://code.google.com/p/moriarty/">Moriarty</a> my PHP library for accessing the platform. I use Moriarty extensively now to kick start any development I do. I&#8217;m even using it to write PHP scripts for running at the command line. I&#8217;m not sure that PHP is going to usurp Perl from my toolbox, but it&#8217;s certainly becoming my language of choice for working with RDF.</p>
<p>I&#8217;ve been looking carefully at the core patterns that my PHP applications have been following to see if there&#8217;s anything else I could pull out. This is generally how I prefer to build new libraries: extracting them from several different projects. Assuming you know how your library is going to work before you&#8217;ve written any applications is almost always wrong. I like using libraries that have distilled the essence of repeated attempts at solving the same problem. That&#8217;s why I never think about modularization of a codebase until I need to.</p>
<p>I&#8217;ve been gravitating towards <a href="http://konstrukt.dk/">Konstrukt</a> because it appears to be the least intrusive of the PHP web application frameworks out there and it keeps fairly true to REST principles. I used it to build <a href="http://n2.talis.com/wiki/Kniblet">Kniblet</a> as part of a platform tutorial. However, there are some quirks that it has that I don&#8217;t like. For example, to return anything other than HTML requires you to throw an exception. That mechanism works quite well for most applications but doesn&#8217;t really suit data-rich applications that have multiple output formats.</p>
<p>It&#8217;s with this in mind that I&#8217;ve started a new PHP web application framework called <a href="http://code.google.com/p/paget">Paget</a>. Calling it a framework is somewhat of an overstatement. It&#8217;s a few classes that make it easy to publish RDF as linked data. It&#8217;s very primitive at the moment, but it&#8217;s quite versatile.</p>
<p>It uses a simple configuration array that is passed to a dispatcher that handles the request. The application&#8217;s default behaviour is specified using this configuration. One part sets up a series of regular expressions that match URI paths handled by the application and map them to the resources it provides. The data about each resource is obtained by using one or more &#8220;generators&#8221;. These are simply classes that generate RDF for the given resource. Paget runs each generator to gather the RDF data describing the resource and then handles the serving up of that data according to linked data principles. Right now that&#8217;s just enough behaviour to function as a generic linked data publishing framework.</p>
<p>I have three different deployments of Paget that are publishing three RDF data sets using different generators. Each of these was quite trivial to set up, being a few lines of confiiguration. For my own site&#8217;s data space I wrote a generator that fetched RDF directly from one of my platform stores (<a href="http://api.talis.com/stores/iand">this one</a>) and served it up as HTML and various flavours of RDF. See, for example, <a href="http://iandavis.com/id/me">http://iandavis.com/id/me</a> which is URI that identifies me.</p>
<p>My second deployment was for <a href="http://placetime.com/">PlaceTime</a>, a URI space that I have operated since 2003. It provides RDF data for timelike entities like instants and intervals and spacelike points. However, it hasn&#8217;t been fully linked data compliant (mainly because it pre-dated the decision on httpRange-14). I wrote a generator for each type of entity that creates trivial RDF for each valid URI in the space. Some examples:</p>
<ul>
<li><a href="http://placetime.com/instant/gregorian/2003-05-19T08:00:00Z">http://placetime.com/instant/gregorian/2003-05-19T08:00:00Z</a> &#8211; an instant in time</li>
<li><a href="http://placetime.com/interval/gregorian/1970-06-15T19:31:00Z/P1D">http://placetime.com/interval/gregorian/1970-06-15T19:31:00Z/P1D</a> &#8211; an interval in time</li>
<li><a href="http://placetime.com/geopoint/wgs84/X-126.817Y46.183">http://placetime.com/geopoint/wgs84/X-126.817Y46.183</a> &#8211; a point in space</li>
</ul>
<p>Finally, I created a generator that reads a local RDF file. I then used it to serve up the <a href="http://vocab.org/whisky/terms">whisky vocabulary</a> that Tom, I and several others created at the recent <a href="http://vocamp.org/wiki/VoCampOxford2008">VoCamp Oxford</a></p>
<p>Admittedly, all these datasets and spaces look pretty similar but this is still early days for Paget. I have some ideas for future development that will flesh out Paget into a fully-fledged RDF driven application framework. For example: as well as generators I plan to add filters, augmenters and transformers that alter the generated data in arbitrary fashions. These could be used to trim the data down, or to  convert it to a more usable structure.  I can imagine that it would be very useful to be able to pull in more RDF from arbitrary locations on the Web to supplement data in the initial set, e.g. with schema information or additional details. In my opinion that&#8217;s one of the significant differences between the web of data and the web of documents: the web of data is going to enable more information to be brought automatically together for the user rather than forcing them to seek it out.</p>
<p>Paget&#8217;s HTML rendering of RDF is very primitive at the moment, making only basic attempts to make it human readable. It&#8217;s still extremely tabular which is hardly a great use of structured information. One area that I&#8217;ve been interested in exploring is that of dynamic user interfaces that adapt to the underlying data automatically. RDF is particularly amenable to building these kinds of interfaces because of its uniform data model. A lot of work on this was done by the <a href="http://www.w3.org/2005/04/fresnel-info/">Fresnel project</a> and it would be interesting to apply some of the learnings from that project to building dynamic web applications. My goal here is to code as little specific behaviour into the application as possible, instead making the application detect patterns in the data and provide suitable user interface behaviours at runtime. This is really the only way we&#8217;re going to be able to build true open world applications, i.e. those that are tolerant of missing data and can adapt to new and unanticipated data.</p>
<p>What I&#8217;m still experimenting with is whether these user interface additions should be server-side or passed on to the client. Some of the augmentations could make more sense when actioned by the client based on user activity.</p>
<p>There&#8217;s lots to research here and hopefully some of these ideas will make it into Paget very soon.</p>
<p><strong>Update:</strong> see my <a href="http://iandavis.com/blog/2008/11/paget-iteration-2">follow up post</a> that describes the major revisions I made to Paget after this was written</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.iandavis.com/2008/09/publishing-linked-data-with-php/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
