Re: Practical issues arising from the "null relative URIs"-hack

Reto,

I tottally agree. There is no reason why this issue could not be
solved without using non-standard relative URIs in RDF.

We use Jena's Model instead of Graph in combination with JAX-RS, but
the idea is the same:
http://lists.w3.org/Archives/Public/public-ldp/2012Aug/0000.html

In our Graphity Linked Data platform (LDP-compliance is not our goal
given the state of this spec) we simply POST resources to a container
as blank nodes. The container has a URI template of it's members
attached to it. Then matching resource property value is used to build
the URI (and resolved against base URI to make it absolute). So in the
case of

  _:item a sioc:Item ;
    dct:identifier "42" .

POSTed to

  <http://localhost/items> a sioc:Container ;
    gp:itemTemplate "/items/{identifier}" . # simplified; the actual
mechanism for this involves OWL resource classes

the final RDF that actually gets stored is

  <http://localhost/items/42> a sioc:Item ;
    sioc:has_container <http://localhost/items> ;
    dct:identifier "42" .

Alternatively, every stored information resource gets a unique UUID
value, which can be used in the URI template if there is no better
choice ("/items/{uuid}").


Martynas
graphityhq.com

On Tue, Mar 25, 2014 at 3:28 PM, Reto Gmür <reto@apache.org> wrote:
> Hi,
>
>
> More than one year has passed since Pierre-Antoine Champin explained why
> specifying LDP using the concept of "null relative URI" is problematic [1].
> Unfortunately the concept of "null relative URI" is still in the latest
> version of the spec. This ties the LDP spec to some RDF serializations and
> probably violates RFC3986 according to which the *sender* is responsible for
> making sure that a base URI for the relative references can be established.
>
> But the main point that LDP is no longer defined in terms of the abstract
> RDF syntax shows to be problematic when using higher level abstraction
> frameworks such as JAX-RS (the java standard for REST) to implement and LDP
> server or client.
>
> A method that returns an RDF representation of a Resource would typically be
> defined like this:
>
> @GET
> public Graph getResourceDescription();
>
> The JAX-RS runtime (more specifically so called MessageBodyWriters) will
> take care of serializing the returned graph into the format preferred by the
> client.
>
> One would define a method that handles post requests with an RDF Graph as
> message body like this:
>
> @POST
> public Response postResourceDescritption(Graph graph);
>
> Unfortunately this doesn't work to handle LDP POST requests as the message
> body cannot be converted to an RDF Graph until some application logic
> defined the URI for the new resource. All work around are quite horrible.
> One would be to have a type RelativeGraph to which text/turtle can be
> deserialized without a base URI, another one would be to take a String as
> argument and take care of the deserialization in the application code.
>
>
> Pierre-Antoine original solution proposal included the usage of BNodes. As
> some people have strong feelings against BNodes this elegant approach might
> have been precociously discarded by some.
>
> A quick fix would be to simply define "null relative URI" (which is
> currently undefined both in LDP as well as in RFC 3986/3987) as
> http://www.w3.org/ns/ldp/null-relative/.
>
>
> Cheers,
> Reto
>
>
>
> 1. http://lists.w3.org/Archives/Public/public-ldp-wg/2013Mar/0077.html

Received on Tuesday, 25 March 2014 15:14:40 UTC