One of the tenants of linked data is that IRIs should be resolvable (it’s the 4th or 5th star, depending on which notation you are looking at)
There are two approaches to doing this:
- Create a server specifically to handle the linked data
- Create a resolver underneath an existing server
The main consideration is probably how many data sets you are resolving, and what association you want to promote. For example, the University of Southampton are exposing all their data at the University level – so having a central resolver (http://opendata.southampton.ac.uk) makes sense for them.
For OARJ, I can use the OpenDepot.org association…. thus it was easier for me to create a resolver within the opendepot.org server – so OARJ IRIs become something like http://opendepot.org/opendata/organisation/EDINA
The resolver script is http://opendepot.org/opendata/ and the standard Apache environment variable ‘PATH_INFO’ contains the rest if the IRI.
The code for the resolver is remarkably simple:
use XML::LibXML; ## define $host ## get the full RDF document from the server: $dom ## get an XML Document that contains the RDF root element (complete with namespaces): $rdf # Get the <:RDF> element from $rdf $child = $rdf->firstChild; # for all XPAth stuff, we need to define the namespace $xpc = XML::LibXML::XPathContext->new; $xpc->registerNs('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'); # We need the general "about" node with output $iri = "$host/reference/linked/1.0/oarj_ontology.rdf"; # XPath queries are through the XML::XPath object @nodes = $xpc->findnodes("/rdf:RDF/rdf:Description[\@rdf:about=\"$iri\"]", $dom); $child->appendChild($nodes) if $nodes; # and now find the specific rdf:Description we want $class = &get_first_pathinfo_item; # will be "organisation" or "network" or.... $t = &get_second_pathinfo_item; # will be the name of the record **IRI encoded!** $iri = "$host/opendata/$class/$t"; @nodes=(); @nodes = $xpc->findnodes("/rdf:RDF/rdf:Description[\@rdf:about=\"$iri\"]", $dom); $child->appendChild($nodes) if $nodes; print $dom->toString;
Obviously there are wrappers around that, but its a good basis.