-
Notifications
You must be signed in to change notification settings - Fork 19
Account for incosistencies of mime-types between rww-play and banana-rdf #131
Conversation
…rdf & some code formatting
what inconsistencies? |
Here's what banana-rdf can parse https://github.com/w3c/banana-rdf/blob/master/rdf/common/src/main/scala/org/w3/banana/io/MimeType.scala#L25-32 . As you can see, they have Ntriples mime type as "application/ntriples" whereas you have it as "text/n3". Same with RdfXml, they have "text/rdf+xml" whereas you have it as "application/rdf+xml". |
For the record, W3C says the MIME type of N-triples is text/plain and the MIME type of RDF/XML is application/rdf+xml. |
The RDF 1.1 N-Triples W3C Recommendation states that the NTriples media type is |
Thanks, my bad. Here is the right link http://www.w3.org/TR/n-triples/ |
|
||
MimeType("text", "turtle"), | ||
MimeType("application", "rdf+xml"), | ||
MimeType("text", "rdf+xml"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think AllRdfMimeTypes should contain only the official mime types. text/rdf+xml
is an old no longer recommended one. On the other hand one could add ntriples now, as we have specialised parsers for those.
How did you come to the conclusion that you needed to make these exact changes to get react-foaf running? |
I'll work through changes one by one. 1. text/turtle; charset=utf-8 can't be parsed because banana-rdf only has parser for text/turtleStack trace
2. Can't parse application/rdf+xml because banana-rdf only has parser for text/rdf+xmlStacktrace:
3. Same with text/n3 vs. application/ntriples . Although I can't reproduce it anymore, here's the solution: https://github.com/jolocom/rww-play/blob/21cb9651de43a657e174c913707c0ed96d39f251/app/rww/ldp/WebClient.scala#L158 |
@bblfish I can clean up this PR with the stuff from you comments if needed. |
First one
Given that there are better libraries we want to use for all the http stuff, your solution could be a reasonable hack until we move to such a lib. But on the other hand we could try to get this right... |
What http stuff are you referring to here? eg b-rdf mime, the actual parsers, etc |
Looking at http://www.w3.org/TR/n-triples/ the content has to be UTF-8 and no optional parameters are permitted Looking at http://www.w3.org/TR/turtle/, the content has to be UTF-8 but an optional parameter of "charset" may be provided with only the value "UTF-8". So it looks to me, after a very quick look (ie I may be completely wrong) that the official specs are not accurately implemented in b-rdf. Iff that's the case, seems reasonable to fix it in b.rdf. If there are other non.conforming examples there (such as instance where other charsets may be specified), they should be updated and the specific laws applied. |
It seems to me that you're right. Let's see if @bblfish can second it. Perhaps then we should make an issue on b-rdf. |
Do these latest fixes solve the problems here? banana-rdf/banana-rdf#228 |
I still get errors about application/rss+xml; charset=UTF-8 , text/plain; charset=utf-8 . But it works for the other formats discussed in this thread. I guess we could close the issue (or do we wait until it's in w3c/banana-rdf?) |
@reederz , that is because the first format is not rdf - it could be seen as such with the right parser, but that needs to be written - and the second is not rdf either. |
both of them seem to have rdf data in them, regardless of the mime types. |
yes, in the case of text/plain it is the server's mistake then. They should publish the info in the correct mime type. We can build something later to help notify people of these mistakes. Rss+xml if it is rss1.0 is very close to rdf... Working with other people's mistakes is something for later. :-) |
Needed this to get react-foaf up and running. Perhaps there's a better way to solve this and it should be reported to banana-rdf people. What do you think?