-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Relaxing the restriction to allow POST to create new resources, regardless of their mime types #62
Comments
I agree this is needed. I'll try to fix it asap. |
In fact, giving it some thought, I think I will leave it like this for now, at least. If you want to POST new (non-RDF) resources to a container, you can still send a request with Here's an example using curl:
|
The example I gave above was about an RDFSource, not NonRDFSource. I didn't quite understand the reason behind "leave it like this for now", when the original issue is about removing the unnecessary restrictions/limitations. There is not much point in "upload"ing an HTML+RDFa via multipart/form-data if I can just as well do a PUT (today, that's what I'm doing). What I want to be able to do is have the option to POST an HTML+RDFa document on the same grounds as Turtle (which is another RDFSource). This is useful. Is there any reason for different treatment here for RDFa and Turtle? Moreover, JSON-LD, JSON, SPARQL-Update get a pass. If gold doesn't want to support RDFa, that's fair enough, but I'd like to know. The POST gives me the ability to use a Slug if I need to or just go with whatever the server decides for me. |
The example you gave above had What do you mean by "Moreover, JSON-LD, JSON, SPARQL-Update get a pass"? Gold only supports the Yes, the reason is that RDFa is HTML+RDFa markup. AFAIK, and please correct me if I'm mistaken, RDFa is commonly serialized as |
Looking at:
More specifically:
I think that qualifies for any RDF representation e.g., Turtle, RDFa. We can re-serialize RDFa to Turtle or any other RDF graph just the same. An RDFa document may have Content-Type: text/html or application/xhtml+xml . It can be stored in any filename (with any file extension). Moreover, an HTML+RDFa document doesn't have to be stored in a file per se. The graph/information can originate in an RDF (triple/quad) store in which gets mapped to some HTML before passing to the client. This is in fact a very common practice. What you see in HTML+RDFa is just one serialization (among many) of the RDF graph. I don't understand what you mean by "data format", or what qualifies as "data" and what doesn't. An HTML+RDFa contains triple statements no different than the others. I've pointed out JSON-LD, JSON, SPARQL Update because of them being listed in mimeParsers: Line 14 in 40e5ee4
which are being exceptions which are checked in this line: Line 272 in 40e5ee4
|
"The graph/information can originate in an RDF (triple/quad) store in which gets mapped to some HTML before passing to the client. This is in fact a very common practice." Sure, but gold does not use a triple store, it uses the file system. An HTML document with RDFa markup is ultimately an HTML document, and gold will treat it as such. A client may decide to parse it as RDFa if it wants, but the document will be served as What I'm trying to say is that there are no plans to have gold treat RDFa documents as anything else other than HTML documents. |
Thanks @deiu . I think this raises a gray area which people have to figure out how to deal with. This is due to what LDP says about supporting other representations: http://www.w3.org/TR/ldp/#ldp-http-other-representations And the problematic sentence is:
I think what the LDP spec intended was actually for "vanilla" HTML, not HTML+RDFa. Rightfully so, we can imagine that by only looking content-type for "vanilla" HTML, it is a NonRDFSource (for all intents and purposes). Since HTML+RDFa is an RDFSource, the spec's intention doesn't hold up. It actually doesn't cover that scenario since there is a conflict. As far as I know, we are only typing resources with ldp:Resource, and not something with more specific i.e., RDFSource or NonRDFSource. So, I think the simplest and immediate change would be to at least let text/html and application/xhtml+xml go through the POST. We don't have to open the gates completely and lose some control over how those two Source types are differentiated. If some new serialization/format comes up, we can deal with that later, and add it to the list of exceptions. In fact, an XML family member, like SVG may be accompanied with RDF/XML all meanwhile it uses image/svg+xml even though we can dereference an SVG resource and get an RDF graph out of the box. I don't know about all media types e.g., PNG, MPEG, but if for example they may be accompanied with an RDF graph (and recognized as such) it is probably a good enough candidate to be (alternatively) treated as an RDFSource and not only NonRDFSource. |
Trying to
HTTP POST
with Content-Typetext/html
and the data being HTML+RDFa, returnsHTTP 415
.e.g:
curl -v -X POST -H'Content-Type: text/html; charset=utf-8' -H'Link: <http://www.w3.org/ns/ldp#Resource>, rel="type"' -H"Slug: x.html" https://example.org/ --data '<html></html>'
I've also tried it with
ldp:NonRDFSource
but stillHTTP 415
.https://example.org/
is aldp:BasicContainer
.Is Gold's implementation related to this (from the LDP Rec):
I think it is getting tripped over this:
gold/server.go
Line 272 in 40e5ee4
and because of not listing
text/html
as one of the mimeParsers:gold/mime.go
Line 14 in 40e5ee4
HTML+RDFa is an
ldp:RDFSource
. Of course whether the HTML includes RDF(a) or not - HTML could also include Turtle or JSON-LD in<script>
- can't be known without looking at the content, so there is some reliance on thetext/html
orapplication/xhtml+xml
mediatypes. Besides, the spec is pointing at HTML 4.01 (which is rather archaic, but that may be need to be mentioned in an errata).The text was updated successfully, but these errors were encountered: