Re: Cool URIs (was: Re: Java Framework for Content Negotiation)

2010-06-02 Thread Richard Cyganiak


On 1 Jun 2010, at 19:37, Bernhard Schandl wrote:
I want to throw in another question, are there currently arguments  
for or against the two alternatives:


http://www.example.org/doc/alice.html

vs

http://www.example.org/doc/html/alice

and the same for .rdf vs rdf/


In terms of web architecture both options are the same. But the first  
one has several “soft” advantages:


- more idiomatic and hence easier to remember and use
- more compatible with the Hierarchical URIs pattern [1]
- yields an obvious URI for the generic, format-independent version of
  the resource (chop off the extension)

Best,
Richard

[1] http://patterns.dataincubator.org/book/hierarchical-uris.html





Best
Bernhard







Re: Cool URIs (was: Re: Java Framework for Content Negotiation)

2010-06-01 Thread Richard Cyganiak

Hi Angelo,

On 31 May 2010, at 10:32, Angelo Veltens wrote:
DBpedia has copied the approach from D2R Server. The person who  
came up with it and designed and implemented it for D2R Server is  
me. This was back in 2006, before the term Linked Data was even  
coined, so I didn't exactly have a lot of experience to rely on.  
With what I know today, I would never, ever again choose that  
approach. Use 303s if you must; but please do me a favour and add  
that generic document, and please do me a favour and name the  
different variants foo.html and foo.rdf rather than page/foo  
and data/foo.


Thanks a lot for sharing your experience with me. I will follow your  
advice. So if i'm going to implement what is described in section  
4.2. i have to


- serve html at http://www.example.org/doc/alice if text/html wins  
content negotiation and set content-location header to http://www.example.org/doc/alice.html
- serve rdf/xml at http://www.example.org/doc/alice if application/ 
rdf+xml wins content negotiation and set content-location header to http://www.example.org/doc/alice.rdf

- serve html at http://www.example.org/doc/alice.html always
- serve rdf/xml at http://www.example.org/doc/alice.rdf always

Right?


Correct!

By the way: Is there any defined behavior for the client, what to do  
with the content-location information? Do Browsers take account of it?


Not really. It's generally recommended to put the format-specific URIs  
into the Content-Location header, but I don't think that clients  
really use that information much (neither in Linked Data nor in other  
contexts where content negotiation is used). So I'd still recommend  
using the header, but more important is perhaps to have the format- 
specific URIs linked from the HTML and RDF representations, so that  
users of the data -- both in the RDF form and in the HTML form -- can  
discover a URI where they can reliably retrieve a representation in a  
specific format.


The DBpedia guys are probably stuck with my stupid design forever  
because changing it now would break all sorts of links. But the  
thing that really kills me is how lots of newbies copy that design  
just because they saw it on DBpedia and therefore think that it  
must be good.


I think the problem is not only, that dbpedia uses that design, but  
that it is described in many examples as a possible or even cool  
solution, e.g. http://www4.wiwiss.fu-berlin.de/bizer/pub/LinkedDataTutorial/ 
 (one of the first documents i stumbled upon)


If we want to prevent people from using that design it should be  
clarified that and why it is a bad choice.


Yes, that's a good point.

Best,
Richard





Kind regards and thanks for your patience,
Angelo





Re: Cool URIs (was: Re: Java Framework for Content Negotiation)

2010-06-01 Thread Bernhard Schandl
Hi,

 - serve html at http://www.example.org/doc/alice.html always
 - serve rdf/xml at http://www.example.org/doc/alice.rdf always
 
 Right?
 
 Correct!

I want to throw in another question, are there currently arguments for or 
against the two alternatives:

http://www.example.org/doc/alice.html

vs

http://www.example.org/doc/html/alice

and the same for .rdf vs rdf/

Best
Bernhard




Cool URIs (was: Re: Java Framework for Content Negotiation)

2010-05-31 Thread Angelo Veltens

On 27.05.2010 15:51, Richard Cyganiak wrote:

On 27 May 2010, at 10:47, Angelo Veltens wrote:
What I am going to implement is this: 
http://www.w3.org/TR/cooluris/#r303uri


I think, this is the way dbpedia works and it seems a good solution 
for me.


It's the way DBpedia works, but it's by far the worst solution of the 
three presented in the document.


DBpedia has copied the approach from D2R Server. The person who came 
up with it and designed and implemented it for D2R Server is me. This 
was back in 2006, before the term Linked Data was even coined, so I 
didn't exactly have a lot of experience to rely on. With what I know 
today, I would never, ever again choose that approach. Use 303s if you 
must; but please do me a favour and add that generic document, and 
please do me a favour and name the different variants foo.html and 
foo.rdf rather than page/foo and data/foo.


Thanks a lot for sharing your experience with me. I will follow your 
advice. So if i'm going to implement what is described in section 4.2. i 
have to


- serve html at http://www.example.org/doc/alice if text/html wins 
content negotiation and set content-location header to 
http://www.example.org/doc/alice.html
- serve rdf/xml at http://www.example.org/doc/alice if 
application/rdf+xml wins content negotiation and set content-location 
header to http://www.example.org/doc/alice.rdf

- serve html at http://www.example.org/doc/alice.html always
- serve rdf/xml at http://www.example.org/doc/alice.rdf always

Right?

By the way: Is there any defined behavior for the client, what to do 
with the content-location information? Do Browsers take account of it?




The DBpedia guys are probably stuck with my stupid design forever 
because changing it now would break all sorts of links. But the thing 
that really kills me is how lots of newbies copy that design just 
because they saw it on DBpedia and therefore think that it must be good.


I think the problem is not only, that dbpedia uses that design, but that 
it is described in many examples as a possible or even cool solution, 
e.g. http://www4.wiwiss.fu-berlin.de/bizer/pub/LinkedDataTutorial/ (one 
of the first documents i stumbled upon)


If we want to prevent people from using that design it should be 
clarified that and why it is a bad choice.


Kind regards and thanks for your patience,
Angelo



Re: Java Framework for Content Negotiation

2010-05-27 Thread Richard Cyganiak

On 27 May 2010, at 10:47, Angelo Veltens wrote:

What I am going to implement is this: http://www.w3.org/TR/cooluris/#r303uri

I think, this is the way dbpedia works and it seems a good solution  
for me.


It's the way DBpedia works, but it's by far the worst solution of the  
three presented in the document.


DBpedia has copied the approach from D2R Server. The person who came  
up with it and designed and implemented it for D2R Server is me. This  
was back in 2006, before the term Linked Data was even coined, so I  
didn't exactly have a lot of experience to rely on. With what I know  
today, I would never, ever again choose that approach. Use 303s if you  
must; but please do me a favour and add that generic document, and  
please do me a favour and name the different variants foo.html and  
foo.rdf rather than page/foo and data/foo.


The DBpedia guys are probably stuck with my stupid design forever  
because changing it now would break all sorts of links. But the thing  
that really kills me is how lots of newbies copy that design just  
because they saw it on DBpedia and therefore think that it must be good.


Richard



My question is, if there is a java solution / framework for what is  
shown in the picture in this section.


I imagine something like this:

I can configure URI-patterns for (non-)information resources, e.g.

Non-Information-Resources: http:/example.com/id/{.*}
RDF-Representation: http:/example.com/data/{.*}
HTML-Representation: http:/example.com/page/{.*}

The conneg and 303-redirection stuff should be handled automatically  
so that i only have to implement what my application serves at these  
uris.


I have played arround with REST-Webservices as recommended. This is  
what i do at the moment:


I have a service at http:/example.com/id/person/0815 with methods  
that are annotated to produce html  respectively rdf/xml. But  
instead of serving the representations immediately I use  
Response.seeOther to do a 303-redirect to http:/example.com/page/ 
person/0815 respectivly http:/example.com/data/person/0815. This  
works fine, but perhaps there is a more automated solution, that  
does conneg as well as 303-redirect.




But also:
http://www.w3.org/TR/cooluris/#hashuri
http://www.w3.org/TR/cooluris/#choosing

If you can build your site with hash URIs rather than 303  
redirects, I highly recommend doing so.


Thanks, i have thought about it, but hash-uris don't fit my needs.

Kind Regards,
Angelo







Java Framework for Content Negotiation

2010-05-20 Thread Angelo Veltens

Hello,

I am just looking for a framework to do content negotiation in java. 
Currently I am checking the HttpServletRequest myself quickdirty. 
Perhaps someone can recommend a framework/library that has solved this 
already.


Thanks in advance,
Angelo



Re: Java Framework for Content Negotiation

2010-05-20 Thread Story Henry
There is the RESTlet framework http://www.restlet.org/

Henry

On 20 May 2010, at 10:49, Angelo Veltens wrote:

 Hello,
 
 I am just looking for a framework to do content negotiation in java. 
 Currently I am checking the HttpServletRequest myself quickdirty. Perhaps 
 someone can recommend a framework/library that has solved this already.
 
 Thanks in advance,
 Angelo
 




Re: Java Framework for Content Negotiation

2010-05-20 Thread Niklas Lindström
Hi Angelo,

On Thu, May 20, 2010 at 11:49 AM, Angelo Veltens
angelo.velt...@online.de wrote:
 Hello,

 I am just looking for a framework to do content negotiation in java.
 Currently I am checking the HttpServletRequest myself quickdirty. Perhaps
 someone can recommend a framework/library that has solved this already.

I suggest taking a look at Restlet [1], which has support for both the
client and server side of conneg (and a lot more).

Best regards,
Niklas

[1]: http://www.restlet.org/



Re: Java Framework for Content Negotiation

2010-05-20 Thread Dave Reynolds

On 20/05/2010 11:03, Story Henry wrote:

There is the RESTlet framework http://www.restlet.org/


There's also Jersey [1] and, for a minimalist solution to just the 
content matching piece see Mimeparse [2].


Dave

[1] https://jersey.dev.java.net/
[2] http://code.google.com/p/mimeparse/


On 20 May 2010, at 10:49, Angelo Veltens wrote:


Hello,

I am just looking for a framework to do content negotiation in java. Currently I am 
checking the HttpServletRequest myself quickdirty. Perhaps someone can 
recommend a framework/library that has solved this already.

Thanks in advance,
Angelo









Re: Java Framework for Content Negotiation

2010-05-20 Thread Michael Hausenblas

 There's also Jersey [1]  ...

+1 to Jersey - had overall very good experience with it. If you want to have
a quick look (not saying it's beautiful/exciting, but might helps to
kick-start things) see [1] for my hacking with it.

Cheers,
  Michael

[1] http://bitbucket.org/mhausenblas/sparestfulql/

-- 
Dr. Michael Hausenblas
LiDRC - Linked Data Research Centre
DERI - Digital Enterprise Research Institute
NUIG - National University of Ireland, Galway
Ireland, Europe
Tel. +353 91 495730
http://linkeddata.deri.ie/
http://sw-app.org/about.html



 From: Dave Reynolds dave.e.reyno...@googlemail.com
 Date: Thu, 20 May 2010 11:08:03 +0100
 To: Angelo Veltens angelo.velt...@online.de
 Cc: Linked Data community public-lod@w3.org
 Subject: Re: Java Framework for Content Negotiation
 Resent-From: Linked Data community public-lod@w3.org
 Resent-Date: Thu, 20 May 2010 10:08:45 +
 
 On 20/05/2010 11:03, Story Henry wrote:
 There is the RESTlet framework http://www.restlet.org/
 
 There's also Jersey [1] and, for a minimalist solution to just the
 content matching piece see Mimeparse [2].
 
 Dave
 
 [1] https://jersey.dev.java.net/
 [2] http://code.google.com/p/mimeparse/
 
 On 20 May 2010, at 10:49, Angelo Veltens wrote:
 
 Hello,
 
 I am just looking for a framework to do content negotiation in java.
 Currently I am checking the HttpServletRequest myself quickdirty. Perhaps
 someone can recommend a framework/library that has solved this already.
 
 Thanks in advance,
 Angelo
 
 
 
 
 




Re: Java Framework for Content Negotiation

2010-05-20 Thread Story Henry
On 20 May 2010, at 11:18, Michael Hausenblas wrote:
 
 There's also Jersey [1]  ...
 
 +1 to Jersey - had overall very good experience with it. If you want to have
 a quick look (not saying it's beautiful/exciting, but might helps to
 kick-start things) see [1] for my hacking with it.

Since this is an RDF list, I wrote a blog post on how one could use Jersey to 
create
linked data using annotations on objects

http://blogs.sun.com/bblfish/entry/serialising_java_objects_to_rdf

Something that could be looked into in more detail I have not had time to
pursue it since then, but others are welcome to continue from there

Henry




 
 Cheers,
  Michael
 
 [1] http://bitbucket.org/mhausenblas/sparestfulql/
 
 -- 
 Dr. Michael Hausenblas
 LiDRC - Linked Data Research Centre
 DERI - Digital Enterprise Research Institute
 NUIG - National University of Ireland, Galway
 Ireland, Europe
 Tel. +353 91 495730
 http://linkeddata.deri.ie/
 http://sw-app.org/about.html
 
 
 
 From: Dave Reynolds dave.e.reyno...@googlemail.com
 Date: Thu, 20 May 2010 11:08:03 +0100
 To: Angelo Veltens angelo.velt...@online.de
 Cc: Linked Data community public-lod@w3.org
 Subject: Re: Java Framework for Content Negotiation
 Resent-From: Linked Data community public-lod@w3.org
 Resent-Date: Thu, 20 May 2010 10:08:45 +
 
 On 20/05/2010 11:03, Story Henry wrote:
 There is the RESTlet framework http://www.restlet.org/
 
 There's also Jersey [1] and, for a minimalist solution to just the
 content matching piece see Mimeparse [2].
 
 Dave
 
 [1] https://jersey.dev.java.net/
 [2] http://code.google.com/p/mimeparse/
 
 On 20 May 2010, at 10:49, Angelo Veltens wrote:
 
 Hello,
 
 I am just looking for a framework to do content negotiation in java.
 Currently I am checking the HttpServletRequest myself quickdirty. Perhaps
 someone can recommend a framework/library that has solved this already.
 
 Thanks in advance,
 Angelo
 
 
 
 
 
 
 




Re: Java Framework for Content Negotiation

2010-05-20 Thread Angelo Veltens

On 20.05.2010 12:18, Michael Hausenblas wrote:

There's also Jersey [1]  ...
 

+1 to Jersey - had overall very good experience with it. If you want to have
a quick look (not saying it's beautiful/exciting, but might helps to
kick-start things) see [1] for my hacking with it.

Cheers,
   Michael

[1] http://bitbucket.org/mhausenblas/sparestfulql/
   


Mmh, i have been thinking about using REST-Webservice already, but there 
is one thing i'm quite unsteady with:


I might have a non-information resource http://example.org/resource/foo

I could place a REST-Webservice there and do content negotiation with 
@GET / @Produces Annotations. But this seems not correct to me, because 
it is a non-information resource and not a html or rdf/xml document. So 
it should never return html or rdf/xml but do a 303 redirect to an 
information resource instead, doesn't it?


Kind regards,
Angelo



Re: Java Framework for Content Negotiation

2010-05-20 Thread Michael Hausenblas
Angelo,

 I might have a non-information resource http://example.org/resource/foo
 
 I could place a REST-Webservice there and do content negotiation with
 @GET / @Produces Annotations. But this seems not correct to me, because
 it is a non-information resource and not a html or rdf/xml document. So
 it should never return html or rdf/xml but do a 303 redirect to an
 information resource instead, doesn't it?

This is a recurring pattern and people tend to confuse things (conneg and
303), in my experience. I assume you've read [1], already ? ;)

Without more detailed knowledge about what you want to achieve it is hard
for me to tell you anything beyond what has been discussed in various
forums.

Can you give me a more concrete description of your setup and goals? How
does your data look like? What's the task you try to solve? Etc.

Cheers,
  Michael

[1] http://www.w3.org/TR/cooluris/

-- 
Dr. Michael Hausenblas
LiDRC - Linked Data Research Centre
DERI - Digital Enterprise Research Institute
NUIG - National University of Ireland, Galway
Ireland, Europe
Tel. +353 91 495730
http://linkeddata.deri.ie/
http://sw-app.org/about.html



 From: Angelo Veltens angelo.velt...@online.de
 Date: Thu, 20 May 2010 14:38:53 +0200
 To: Linked Data community public-lod@w3.org
 Subject: Re: Java Framework for Content Negotiation
 Resent-From: Linked Data community public-lod@w3.org
 Resent-Date: Thu, 20 May 2010 12:39:34 +
 
 On 20.05.2010 12:18, Michael Hausenblas wrote:
 There's also Jersey [1]  ...
  
 +1 to Jersey - had overall very good experience with it. If you want to have
 a quick look (not saying it's beautiful/exciting, but might helps to
 kick-start things) see [1] for my hacking with it.
 
 Cheers,
Michael
 
 [1] http://bitbucket.org/mhausenblas/sparestfulql/

 
 Mmh, i have been thinking about using REST-Webservice already, but there
 is one thing i'm quite unsteady with:
 
 I might have a non-information resource http://example.org/resource/foo
 
 I could place a REST-Webservice there and do content negotiation with
 @GET / @Produces Annotations. But this seems not correct to me, because
 it is a non-information resource and not a html or rdf/xml document. So
 it should never return html or rdf/xml but do a 303 redirect to an
 information resource instead, doesn't it?
 
 Kind regards,
 Angelo
 




Re: Java Framework for Content Negotiation

2010-05-20 Thread Richard Cyganiak

On 20 May 2010, at 10:49, Angelo Veltens wrote:

I am just looking for a framework to do content negotiation in java.


There's a reasonably stable and well-tested implementation that is  
used both in the Pubby and D2R Server codebases. See here:

http://d2rq-map.cvs.sourceforge.net/viewvc/d2rq-map/d2r-server/src/de/fuberlin/wiwiss/pubby/negotiation/

This just does the negotiation part (that is, matching an HTTP Accept  
header against a list of media types that the server supports,  
including support for q values). It only supports media type  
negotiation, there's nothing for language negotiation or encoding  
negotiation in there.


The package works like this: You configure a ContentTypeNegotiator  
with the media types supported by your app. Then you use its  
getBestMatch(...) method to determine the best response for a given  
request. The PubbyNegotiator class has a pre-configured negotiator for  
a server that supports HTML and various RDF syntaxes.


Best,
Richard


Currently I am checking the HttpServletRequest myself quickdirty.  
Perhaps someone can recommend a framework/library that has solved  
this already.


Thanks in advance,
Angelo






Re: Java Framework for Content Negotiation

2010-05-20 Thread Richard Cyganiak


On 20 May 2010, at 13:38, Angelo Veltens wrote:
I might have a non-information resource http://example.org/resource/ 
foo


I could place a REST-Webservice there and do content negotiation  
with @GET / @Produces Annotations. But this seems not correct to me,  
because it is a non-information resource and not a html or rdf/xml  
document. So it should never return html or rdf/xml but do a 303  
redirect to an information resource instead, doesn't it?


I second Michael's recommendation to have a look at the Cool URIs for  
SemWeb document, in particular this section:

http://www.w3.org/TR/cooluris/#r303gendocument

But also:
http://www.w3.org/TR/cooluris/#hashuri
http://www.w3.org/TR/cooluris/#choosing

If you can build your site with hash URIs rather than 303 redirects, I  
highly recommend doing so.


Best,
Richard




Kind regards,
Angelo