Archive for the ‘RESTful’ Category

Linking to New Zealand Legislation

Saturday, January 12th, 2008

The web page Public Access to Legislation - Creating links to the New Zealand Legislation website gives information on how to link to New Zealand Legislation.

The legislative documents are identified by:

  • the information type (Act, Regulation, Bill, SOP)
  • the legislation type or category (public, local, members, government, imperial etc)
  • the year
  • the number, padded with initial zeros to 4 digits. For Bills, the number will also include the Bar number and split letter (if applicable).

And a legislative document can currently be linked to in the following ways:

In the same way that I want to link to photo sharing sites from within my web application there will be occasions when I want to link to legislation, standards and regulation documents.

For example in the context of a web based building project it could be useful to link to the Building Act 2004 Table of Content which gives an overview of the individual sections of the Building Act.

This is useful as a general reference but there will be occasions where I want to show a provision in a specific context relevant to the project. For example a building project needs to be issued with a building consent which can lapse after a period of time.

When showing the status of a project which has not yet started building it would be useful to indicate if its building consent is about to expire and if it is then link to the relevant provision to clarify the situation.

Currently there are two simple ways of linking to the specific provision, open it in the same page or open it in a new page.

Both of these approaches are a bit rough for todays modern Ajax-based web applications which would ideally take a smoother approach. I.e. take just the relevant content and slide it into the page at the required location, in this case inserting just the following:

“A building consent lapses and is of no effect if the building work to which it relates does not commence within—
(a) 12 months after the date of issue of the building consent; or
(b) any further period that the building consent authority may allow.”

This Ajax insertion can be achieved by first using a customized HTML reader which extracts the relevant content from the original provisions page.

The simpler display rendered by the customized HTML reader would also be more appropriate for a mobile phone based web application.

Note that in January 2008, as part of the PAL Project, a new site for accessing New Zealand legislation will be available.

The PAL Project stores the legislation documents as XML fragments that are combined for publication as HTML and PDF. It is likely that the documents will also be available as XML.

If the XML document is available then it should be simpler to access the content of the specific provisions when using the customized HTML reader discussed above.

A further simplification would be to provide a REST based web service for accessing the provisions. This would allow the content of the provision “Lapse of Building Consent” to be accessed via a URI similar to the following http://www.legislation.govt.nz/act/public/2004/se/072se52.xml.

Linking to Photo Sharing Sites

Saturday, January 5th, 2008

I have users with photos published on photo sharing sites such as Flickr, Fotopic, ImageShack, Livejournal, Photobucket, Picasaweb, SmugMug, Webshots and others.

What I want to do is provide these users with the ability to link these published photos to projects managed by our web application. Within our application only the published URL to the image would be stored.

The Flickr API, with its support for REST, is the ideal site to use as a proof of concept. At least one other site, 23 also implements the Flickr API, making it easy to support both 23 and Flickr.

The Ajax based Flickr Related Tag Browser provides a good example of how to use the Flickr API to browse and select photos by tag. Within our application a user wold browse their Flickr account and search by photo album, tag or date to retrieve specific photos which would illustrate the project site itself, tasks to be accomplished, problems associated with a task or as visual confirmation that a task had been completed.

As an example I have two projects that I am about to start.

  • The first is to widen a driveway, add a front gate and landscape the front garden to link in with the new driveway and gate.
  • The second is to complete the garage at the back of the property, which includes adding a couple of rooms that will link up with the existing studio kitchen and main room.

The photos for these two different projects I have tagged gate and garage respectively on my Flickr account.

The default Flickr web pages that open for

  • http://www.flickr.com/photos/richard3kbo/tags/gate/ and
  • http://www.flickr.com/photos/richard3kbo/tags/garage/

by themselves give good overviews of the two different project sites.

Linking specific photos to project tasks helps illustrate and clarify these tasks.

Using photos published on Flickr and similar sites allows our users to continue using the photo sharing sites they are used to and which have more features for image processing and sharing than our site.

A Semantic Web Architecture for a Rails Hosted Environment

Saturday, October 20th, 2007

Last week-end I installed ActiveRDF on my Mac OS X Powerbook, together with the Sparql, RDFLite and Redland adapters. Ideally I am working towards setting up an environment that allows me to build RESTful Semantic Web Applications that support reasoning over RDF data and implement a SPARQL query end point. Support for OpenID authentication, integrated with FOAF, is also at the top of the list.

On the Powerbook I could also install the ActiverRDF adapters for Sesame and Jena to give me the functionality that I am after but that only works in my development environment. Sesame and Jena are Java based. When it comes to deploying an application onto the web my options are currently more limited. 3kbo is deployed into hosted environment which supports PHP, Python, Ruby and Ruby On Rails and PERL, but no Java. (There is C/C++, limited to my local user account.)

Currently there are two PHP SPARQL implementations, ARC and RAP. RAP also provides a reasoning engine InfModel, with support for owl:sameAs and owl:inverseOf.

So at this stage the architecture that is emerging is an ActiveRDF RESTful Ruby On Rails application that uses RAP as the triple store, SPARQL query engine and reasoning engine. To integrate Rails with PHP I am planning to implement a RESTful PHP interface that acts as a facade to RAP.