You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@marmotta.apache.org by Frans Knibbe <fr...@geodan.nl> on 2016/04/26 16:14:07 UTC

dereferencing URIs

Hello,

I have just installed Marmotta in order to see which functionality it
provides, and I think I could use some help to get the dereferencing of
URIs working.

Say Marmotta runs at http://www.example.com. I have used the administration
GUI to import some sample data, with a context (graph URI) of
http://www.example.com/mydataset. The import was successful, I can see the
context in the Context Manager and I can download the data.

What doesn't work (yet) is dereferencing the URIs in my dataset. For
example, http://www.example.com/mydataset or
http://www.example.com/mydataset/myResource give HTTP 404 errors (produced
by Tomcat).

Is there a way to enable or configure URI dereferencing in Marmotta?

Greetings,
Frans

Re: dereferencing URIs

Posted by Rob Atkinson <ro...@metalinkage.com.au>.
Hi Frans

URI rewriting is a big deal IMHO - I am interested in exploring options to
add a more flexible layer to the platform.  Where I was working at CSIRO a
while back we developed a partial solution (there are some key use cases
around re-using rules sets - binding an known API template to a service
endpoint for a given URI root ought to be the primary mechanism IMHO).

Its at https://github.com/SISS/PID  (the wiki appears to be down).

Managing a complex set of rules - including optional parameters in any
order and content-negotiation is not scalable in apache rewrite. Maybe
other URI rewriting platforms would be better.

An example of URI rewriting rules that can be supported is at:
http://environment.data.gov.au/water/id/catchment/100862?_view=alternates&_format=html

(those links are generated by reasoning over VoiD descriptions of data sets
- annotated with the _view parameter from the Linked Data API, which
controls the information model being asked for in content-negotiation (as
opposed the the encoding - or MIME type).  Ideally I'd like the
URIrewriting to be controlled by the same data, instead of an out-of-band
XML artefact (the current CSIRO PID service).

Anyone interested in pursing this I'd be happy to join a team to work out a
path forward.

Cheers
Rob Atkinson




On Sat, 30 Apr 2016 at 00:02 Frans Knibbe <fr...@geodan.nl> wrote:

> Hello,
>
> The following addition to my Apache HTTPD configuration seems to work
> well:
>
> RewriteEngine on
> <Location "/mydataset">
>   RewriteRule ^
> http://www.example.org/marmotta/resource?uri=http://%{HTTP_HOST}%{REQUEST_URI}
> </Location>
>
> Regards,
> Frans
>
>
>
> 2016-04-29 13:02 GMT+02:00 Frans Knibbe <fr...@geodan.nl>:
>
>> Thank you Sergio, that certainly helps.
>>
>> I have just tested this approach, and after I found out my {BASE} value (
>> http://www.example.com/marmotta) I could successfully GET the resources
>> in the format specified in the Accept header.
>>
>> So I think that if I want the resource URIs to be dereferencable directly
>> I have to configure some HTTP query rewriting. I will give that a try.
>>
>> Greetings,
>> Frans
>>
>>
>>
>> 2016-04-26 17:40 GMT+02:00 Sergio Fernández <wi...@apache.org>:
>>
>>> Hi Frans,
>>>
>>> On Tue, Apr 26, 2016 at 4:14 PM, Frans Knibbe <fr...@geodan.nl>
>>> wrote:
>>>>
>>>> What doesn't work (yet) is dereferencing the URIs in my dataset. For
>>>> example, http://www.example.com/mydataset or
>>>> http://www.example.com/mydataset/myResource give HTTP 404 errors
>>>> (produced by Tomcat).
>>>>
>>>> Is there a way to enable or configure URI dereferencing in Marmotta?
>>>>
>>>
>>> Whenever either a context or a resource is not named (located) under the
>>> default namespace, http://www.example.com/context/... and
>>> http://www.example.com/resource/... respectively, Marmotta provides an
>>> alternative way to dereference them:
>>>
>>> * /context?graph=<URI>
>>> * /resource?uri=<URI>
>>>
>>> In your case:
>>>
>>> *
>>> http://www.example.com/context?graph=http%3A%2F%2Fwww.example.com%2Fmydataset
>>>
>>> *
>>> http://www.example.com/resource?uri=http%3A%2F%2Fwww.example.com%2Fmydataset%2FmyResource
>>>
>>> If you are interested about further background, that's the relevant
>>> documentation:
>>>
>>> * Graph Identification at SPARQL 1.1 Graph Store
>>> HTTP Protocol:
>>> https://www.w3.org/TR/sparql11-http-rdf-update/#graph-identification
>>>
>>> * https://bitbucket.org/srfgkmt/lmf/wiki/Principles-Linked-Media
>>>
>>> Hope that helps.
>>>
>>> Cheers,
>>>
>>> --
>>> Sergio Fernández
>>> Partner Technology Manager
>>> Redlink GmbH
>>> m: +43 6602747925
>>> e: sergio.fernandez@redlink.co
>>> w: http://redlink.co
>>>
>>
>>
>

Re: dereferencing URIs

Posted by Sergio Fernández <wi...@apache.org>.
Hi,

On Mon, May 2, 2016 at 12:03 PM, Frans Knibbe <fr...@geodan.nl>
wrote:
>
> In my few experiments so far, the requested URI is described in the
> response. For example, if I request
> http://www.example.com/my_dataset/resource123, the response contains the
> triples in which http://www.example.com/my_dataset/resource123 is the
> subject.
>

Yes, for your particular case, because you manually imported it with that
URI. But may not be the case all resources loaded into Marmotta. That's why
I warn you.


> I have tried the Linked Data validator at  http://vafu.redlink.io/. The
> only tests that fail are those in which the request does not specify a
> content type.
>

You should active the option "Tests if the RDF responses contain meaningful
data" to check if the data is actually there. Then you may see it.

I wonder if I can get rid of the first 302... But is there anything that
> goes against Linked Data principles this way?
>

Debatable, yes, nothing to discuss in this context. The formal background
if that W3C's TAG took the decision to go for 303 semantics on httpRange-14
issue [1].

If you want to fix it, just use the R flag [2] in your RewriteRule: [R=303]

[1] https://www.w3.org/2001/tag/doc/httpRange-14/2007-05-31/HttpRange-14
[2] https://httpd.apache.org/docs/current/rewrite/flags.html#flag_r

Cheers,

-- 
Sergio Fernández
Partner Technology Manager
Redlink GmbH
m: +43 6602747925
e: sergio.fernandez@redlink.co
w: http://redlink.co

Re: dereferencing URIs

Posted by Frans Knibbe <fr...@geodan.nl>.
Hello Sergio,

In my few experiments so far, the requested URI is described in the
response. For example, if I request
http://www.example.com/my_dataset/resource123, the response contains the
triples in which http://www.example.com/my_dataset/resource123 is the
subject.

I have tried the Linked Data validator at  http://vafu.redlink.io/. The
only tests that fail are those in which the request does not specify a
content type.

In detail, a request (with a specified content type) for
http://www.example.com/my_dataset/resource123 seems to be handled as
follows (http://www.example.com is the Marmotta main site in this example):

get http://www.example.com/my_dataset/resource123
> 302 Found:
http://www.example.com/marmotta/resource?uri=http://www.example.com/my_dataset/resource123
get
http://www.example.com/marmotta/resource?uri=http://www.example.com/my_dataset/resource123
>303 See other:
http://www.example.com/marmotta/resource?uri=http%3A%2F%2Fwww.example.com%2Fmy_dataset%2Fresource123
get
http://www.example.com/marmotta/resource?uri=http%3A%2F%2Fwww.example.com%2Fmy_dataset%2Fresource123
>200 OK

So a first pass sticks the "http://www.example.com/marmotta/resource?uri="
in front of the URI and a second pass encodes the URI.

I wonder if I can get rid of the first 302... But is there anything that
goes against Linked Data principles this way?

Regards,
Frans





2016-05-02 8:47 GMT+02:00 Sergio Fernández <wi...@apache.org>:

> Frans, although I understand your practical need of getting those request
> gettingin, you should be aware it is invalid according the Linked Data
> principles. If you try a Linked Data validator, such as
> http://vafu.redlink.io/ , you would notices that the original resource
> does not come described in the response.
>
> Marmotta provides other means of tweaking that, see
> http://marmotta.apache.org/configuration.html
>
> On Fri, Apr 29, 2016 at 4:02 PM, Frans Knibbe <fr...@geodan.nl>
> wrote:
>
>> Hello,
>>
>> The following addition to my Apache HTTPD configuration seems to work
>> well:
>>
>> RewriteEngine on
>> <Location "/mydataset">
>>   RewriteRule ^
>> http://www.example.org/marmotta/resource?uri=http://%{HTTP_HOST}%{REQUEST_URI}
>> </Location>
>>
>> Regards,
>> Frans
>>
>>
>>
>> 2016-04-29 13:02 GMT+02:00 Frans Knibbe <fr...@geodan.nl>:
>>
>>> Thank you Sergio, that certainly helps.
>>>
>>> I have just tested this approach, and after I found out my {BASE} value (
>>> http://www.example.com/marmotta) I could successfully GET the resources
>>> in the format specified in the Accept header.
>>>
>>> So I think that if I want the resource URIs to be dereferencable
>>> directly I have to configure some HTTP query rewriting. I will give that a
>>> try.
>>>
>>> Greetings,
>>> Frans
>>>
>>>
>>>
>>> 2016-04-26 17:40 GMT+02:00 Sergio Fernández <wi...@apache.org>:
>>>
>>>> Hi Frans,
>>>>
>>>> On Tue, Apr 26, 2016 at 4:14 PM, Frans Knibbe <fr...@geodan.nl>
>>>> wrote:
>>>>>
>>>>> What doesn't work (yet) is dereferencing the URIs in my dataset. For
>>>>> example, http://www.example.com/mydataset or
>>>>> http://www.example.com/mydataset/myResource give HTTP 404 errors
>>>>> (produced by Tomcat).
>>>>>
>>>>> Is there a way to enable or configure URI dereferencing in Marmotta?
>>>>>
>>>>
>>>> Whenever either a context or a resource is not named (located) under
>>>> the default namespace, http://www.example.com/context/... and
>>>> http://www.example.com/resource/... respectively, Marmotta provides an
>>>> alternative way to dereference them:
>>>>
>>>> * /context?graph=<URI>
>>>> * /resource?uri=<URI>
>>>>
>>>> In your case:
>>>>
>>>> *
>>>> http://www.example.com/context?graph=http%3A%2F%2Fwww.example.com%2Fmydataset
>>>>
>>>> *
>>>> http://www.example.com/resource?uri=http%3A%2F%2Fwww.example.com%2Fmydataset%2FmyResource
>>>>
>>>> If you are interested about further background, that's the relevant
>>>> documentation:
>>>>
>>>> * Graph Identification at SPARQL 1.1 Graph Store
>>>> HTTP Protocol:
>>>> https://www.w3.org/TR/sparql11-http-rdf-update/#graph-identification
>>>>
>>>> * https://bitbucket.org/srfgkmt/lmf/wiki/Principles-Linked-Media
>>>>
>>>> Hope that helps.
>>>>
>>>> Cheers,
>>>>
>>>> --
>>>> Sergio Fernández
>>>> Partner Technology Manager
>>>> Redlink GmbH
>>>> m: +43 6602747925
>>>> e: sergio.fernandez@redlink.co
>>>> w: http://redlink.co
>>>>
>>>
>>>
>>
>
>
> --
> Sergio Fernández
> Partner Technology Manager
> Redlink GmbH
> m: +43 6602747925
> e: sergio.fernandez@redlink.co
> w: http://redlink.co
>

Re: dereferencing URIs

Posted by Sergio Fernández <wi...@apache.org>.
Frans, although I understand your practical need of getting those request
gettingin, you should be aware it is invalid according the Linked Data
principles. If you try a Linked Data validator, such as
http://vafu.redlink.io/ , you would notices that the original resource does
not come described in the response.

Marmotta provides other means of tweaking that, see
http://marmotta.apache.org/configuration.html

On Fri, Apr 29, 2016 at 4:02 PM, Frans Knibbe <fr...@geodan.nl>
wrote:

> Hello,
>
> The following addition to my Apache HTTPD configuration seems to work
> well:
>
> RewriteEngine on
> <Location "/mydataset">
>   RewriteRule ^
> http://www.example.org/marmotta/resource?uri=http://%{HTTP_HOST}%{REQUEST_URI}
> </Location>
>
> Regards,
> Frans
>
>
>
> 2016-04-29 13:02 GMT+02:00 Frans Knibbe <fr...@geodan.nl>:
>
>> Thank you Sergio, that certainly helps.
>>
>> I have just tested this approach, and after I found out my {BASE} value (
>> http://www.example.com/marmotta) I could successfully GET the resources
>> in the format specified in the Accept header.
>>
>> So I think that if I want the resource URIs to be dereferencable directly
>> I have to configure some HTTP query rewriting. I will give that a try.
>>
>> Greetings,
>> Frans
>>
>>
>>
>> 2016-04-26 17:40 GMT+02:00 Sergio Fernández <wi...@apache.org>:
>>
>>> Hi Frans,
>>>
>>> On Tue, Apr 26, 2016 at 4:14 PM, Frans Knibbe <fr...@geodan.nl>
>>> wrote:
>>>>
>>>> What doesn't work (yet) is dereferencing the URIs in my dataset. For
>>>> example, http://www.example.com/mydataset or
>>>> http://www.example.com/mydataset/myResource give HTTP 404 errors
>>>> (produced by Tomcat).
>>>>
>>>> Is there a way to enable or configure URI dereferencing in Marmotta?
>>>>
>>>
>>> Whenever either a context or a resource is not named (located) under the
>>> default namespace, http://www.example.com/context/... and
>>> http://www.example.com/resource/... respectively, Marmotta provides an
>>> alternative way to dereference them:
>>>
>>> * /context?graph=<URI>
>>> * /resource?uri=<URI>
>>>
>>> In your case:
>>>
>>> *
>>> http://www.example.com/context?graph=http%3A%2F%2Fwww.example.com%2Fmydataset
>>>
>>> *
>>> http://www.example.com/resource?uri=http%3A%2F%2Fwww.example.com%2Fmydataset%2FmyResource
>>>
>>> If you are interested about further background, that's the relevant
>>> documentation:
>>>
>>> * Graph Identification at SPARQL 1.1 Graph Store
>>> HTTP Protocol:
>>> https://www.w3.org/TR/sparql11-http-rdf-update/#graph-identification
>>>
>>> * https://bitbucket.org/srfgkmt/lmf/wiki/Principles-Linked-Media
>>>
>>> Hope that helps.
>>>
>>> Cheers,
>>>
>>> --
>>> Sergio Fernández
>>> Partner Technology Manager
>>> Redlink GmbH
>>> m: +43 6602747925
>>> e: sergio.fernandez@redlink.co
>>> w: http://redlink.co
>>>
>>
>>
>


-- 
Sergio Fernández
Partner Technology Manager
Redlink GmbH
m: +43 6602747925
e: sergio.fernandez@redlink.co
w: http://redlink.co

Re: dereferencing URIs

Posted by Frans Knibbe <fr...@geodan.nl>.
Hello,

The following addition to my Apache HTTPD configuration seems to work well:

RewriteEngine on
<Location "/mydataset">
  RewriteRule ^
http://www.example.org/marmotta/resource?uri=http://%{HTTP_HOST}%{REQUEST_URI}
</Location>

Regards,
Frans



2016-04-29 13:02 GMT+02:00 Frans Knibbe <fr...@geodan.nl>:

> Thank you Sergio, that certainly helps.
>
> I have just tested this approach, and after I found out my {BASE} value (
> http://www.example.com/marmotta) I could successfully GET the resources
> in the format specified in the Accept header.
>
> So I think that if I want the resource URIs to be dereferencable directly
> I have to configure some HTTP query rewriting. I will give that a try.
>
> Greetings,
> Frans
>
>
>
> 2016-04-26 17:40 GMT+02:00 Sergio Fernández <wi...@apache.org>:
>
>> Hi Frans,
>>
>> On Tue, Apr 26, 2016 at 4:14 PM, Frans Knibbe <fr...@geodan.nl>
>> wrote:
>>>
>>> What doesn't work (yet) is dereferencing the URIs in my dataset. For
>>> example, http://www.example.com/mydataset or
>>> http://www.example.com/mydataset/myResource give HTTP 404 errors
>>> (produced by Tomcat).
>>>
>>> Is there a way to enable or configure URI dereferencing in Marmotta?
>>>
>>
>> Whenever either a context or a resource is not named (located) under the
>> default namespace, http://www.example.com/context/... and
>> http://www.example.com/resource/... respectively, Marmotta provides an
>> alternative way to dereference them:
>>
>> * /context?graph=<URI>
>> * /resource?uri=<URI>
>>
>> In your case:
>>
>> *
>> http://www.example.com/context?graph=http%3A%2F%2Fwww.example.com%2Fmydataset
>>
>> *
>> http://www.example.com/resource?uri=http%3A%2F%2Fwww.example.com%2Fmydataset%2FmyResource
>>
>> If you are interested about further background, that's the relevant
>> documentation:
>>
>> * Graph Identification at SPARQL 1.1 Graph Store
>> HTTP Protocol:
>> https://www.w3.org/TR/sparql11-http-rdf-update/#graph-identification
>>
>> * https://bitbucket.org/srfgkmt/lmf/wiki/Principles-Linked-Media
>>
>> Hope that helps.
>>
>> Cheers,
>>
>> --
>> Sergio Fernández
>> Partner Technology Manager
>> Redlink GmbH
>> m: +43 6602747925
>> e: sergio.fernandez@redlink.co
>> w: http://redlink.co
>>
>
>

Re: dereferencing URIs

Posted by Frans Knibbe <fr...@geodan.nl>.
Thank you Sergio, that certainly helps.

I have just tested this approach, and after I found out my {BASE} value (
http://www.example.com/marmotta) I could successfully GET the resources in
the format specified in the Accept header.

So I think that if I want the resource URIs to be dereferencable directly I
have to configure some HTTP query rewriting. I will give that a try.

Greetings,
Frans



2016-04-26 17:40 GMT+02:00 Sergio Fernández <wi...@apache.org>:

> Hi Frans,
>
> On Tue, Apr 26, 2016 at 4:14 PM, Frans Knibbe <fr...@geodan.nl>
> wrote:
>>
>> What doesn't work (yet) is dereferencing the URIs in my dataset. For
>> example, http://www.example.com/mydataset or
>> http://www.example.com/mydataset/myResource give HTTP 404 errors
>> (produced by Tomcat).
>>
>> Is there a way to enable or configure URI dereferencing in Marmotta?
>>
>
> Whenever either a context or a resource is not named (located) under the
> default namespace, http://www.example.com/context/... and
> http://www.example.com/resource/... respectively, Marmotta provides an
> alternative way to dereference them:
>
> * /context?graph=<URI>
> * /resource?uri=<URI>
>
> In your case:
>
> *
> http://www.example.com/context?graph=http%3A%2F%2Fwww.example.com%2Fmydataset
>
> *
> http://www.example.com/resource?uri=http%3A%2F%2Fwww.example.com%2Fmydataset%2FmyResource
>
> If you are interested about further background, that's the relevant
> documentation:
>
> * Graph Identification at SPARQL 1.1 Graph Store
> HTTP Protocol:
> https://www.w3.org/TR/sparql11-http-rdf-update/#graph-identification
>
> * https://bitbucket.org/srfgkmt/lmf/wiki/Principles-Linked-Media
>
> Hope that helps.
>
> Cheers,
>
> --
> Sergio Fernández
> Partner Technology Manager
> Redlink GmbH
> m: +43 6602747925
> e: sergio.fernandez@redlink.co
> w: http://redlink.co
>

Re: dereferencing URIs

Posted by Sergio Fernández <wi...@apache.org>.
Hi Frans,

On Tue, Apr 26, 2016 at 4:14 PM, Frans Knibbe <fr...@geodan.nl>
wrote:
>
> What doesn't work (yet) is dereferencing the URIs in my dataset. For
> example, http://www.example.com/mydataset or
> http://www.example.com/mydataset/myResource give HTTP 404 errors
> (produced by Tomcat).
>
> Is there a way to enable or configure URI dereferencing in Marmotta?
>

Whenever either a context or a resource is not named (located) under the
default namespace, http://www.example.com/context/... and
http://www.example.com/resource/... respectively, Marmotta provides an
alternative way to dereference them:

* /context?graph=<URI>
* /resource?uri=<URI>

In your case:

*
http://www.example.com/context?graph=http%3A%2F%2Fwww.example.com%2Fmydataset

*
http://www.example.com/resource?uri=http%3A%2F%2Fwww.example.com%2Fmydataset%2FmyResource

If you are interested about further background, that's the relevant
documentation:

* Graph Identification at SPARQL 1.1 Graph Store
HTTP Protocol:
https://www.w3.org/TR/sparql11-http-rdf-update/#graph-identification

* https://bitbucket.org/srfgkmt/lmf/wiki/Principles-Linked-Media

Hope that helps.

Cheers,

-- 
Sergio Fernández
Partner Technology Manager
Redlink GmbH
m: +43 6602747925
e: sergio.fernandez@redlink.co
w: http://redlink.co