Skip to content
This repository has been archived by the owner on Oct 12, 2021. It is now read-only.

OslcJsonLdProvider never called when trying to write to 'application/ld+json' #44

Closed
cedric780 opened this issue Nov 15, 2018 · 7 comments · Fixed by #45
Closed

OslcJsonLdProvider never called when trying to write to 'application/ld+json' #44

cedric780 opened this issue Nov 15, 2018 · 7 comments · Fixed by #45

Comments

@cedric780
Copy link

cedric780 commented Nov 15, 2018

Writing to 'application/ld+json' MIME type never work , OslcJsonLdProvider is never called.
Probably same problem for OslcJsonLdCollectionProvider and OslcJsonLdArrayProvider.

Cause:

OslcRdfXmlProvider.isWriteable(Class<?>, Type, Annotation[], MediaType) in the parent OslcRdfXmlProvider class hard codes accepted media types when calling static isWriteable(...)

return isWriteable(actualType,
annotations,
mediaType,
OslcMediaType.APPLICATION_RDF_XML_TYPE,
OslcMediaType.APPLICATION_XML_TYPE,
OslcMediaType.TEXT_XML_TYPE,
OslcMediaType.TEXT_TURTLE_TYPE);

@jadelkhoury
Copy link
Contributor

Indeed. I can confirm that json-ld is not handled in the most basic cases.
@berezovskyi I can dig into this.
but, to get started, was it you that introduced jsonld? can't seem to find the original patch that introduced jsonLd.

@berezovskyi
Copy link
Member

hahaha, @jadelkhoury I have never hit this bug because I had #22 applied from the start in my case.

@jadelkhoury
Copy link
Contributor

Until we have #22 in place, can we fix this? if you give me a rundown on what [damage :-)] you did, I can try to fix it in comming days.

@berezovskyi
Copy link
Member

@cedric780 thanks for reporting the bug and getting to the cause of it

@jadelkhoury I still believe #22 is the best fix for it, now we have 2 reasons to apply it. @jamsden Jad is worried about accidentally introducing an unwanted side effect that may introduce some incompat.

@jadelkhoury
Copy link
Contributor

I am mainly worried about introducing such a change just before the 2.4.0 release. If we add #22 after the release, it gives us a better chance to run it for some time.

@berezovskyi
Copy link
Member

@jadelkhoury it's not really that I did something [damage], but I just forgot to add a new argument to the inner isWriteable call. If you add OslcMediaType.APPLICATION_JSON_LD_TYPE to the end of the call, things should work back again.

BTW, @cedric780 I am trying to introduce #9 which adds support for N-Triples and any other serialisation format as supported by Jena but there has been little push for it. If you are interested to try it out, I can help you with any issues that may arise in the process.

berezovskyi added a commit that referenced this issue Nov 16, 2018
Signed-off-by: Andrew Berezovskyi <andriib@kth.se>
@berezovskyi
Copy link
Member

@cedric780 please try the fix in #45

berezovskyi added a commit that referenced this issue Nov 17, 2018
* Include JSON-LD MIME in isWriteable check; fixes #44 
* add jsonLd support for query results as well

Signed-off-by: Andrew Berezovskyi <andriib@kth.se>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants