New UniversalResourceSingleProvider to support more RDF formats#76
New UniversalResourceSingleProvider to support more RDF formats#76berezovskyi wants to merge 5 commits into
Conversation
2nd try, #9 has too many merge conflicts Signed-off-by: Andrew Berezovskyi <andriib@kth.se>
|
I just applied the changes from #9 but a collection-based test now fails: |
| * | ||
| * @since 4.0.0 | ||
| */ | ||
| public class AbstractRdfProvider { |
There was a problem hiding this comment.
should be an abstract class.
| OslcMediaType.N_TRIPLES_MIME, OslcMediaType.RDF_JSON_MIME, OslcMediaType.RDF_THRIFT_MIME}) | ||
| @Consumes({OslcMediaType.APPLICATION_JSON_LD, OslcMediaType.TEXT_TURTLE, | ||
| OslcMediaType.N_TRIPLES_MIME, OslcMediaType.RDF_JSON_MIME, OslcMediaType.RDF_THRIFT_MIME}) | ||
| public class UniversalResourceSingleProvider extends AbstractRdfProvider |
There was a problem hiding this comment.
handle rdf/xml as well.
| OslcMediaType.N_TRIPLES_MIME, OslcMediaType.RDF_JSON_MIME, OslcMediaType.RDF_THRIFT_MIME}) | ||
| @Consumes({OslcMediaType.APPLICATION_JSON_LD, OslcMediaType.TEXT_TURTLE, | ||
| OslcMediaType.N_TRIPLES_MIME, OslcMediaType.RDF_JSON_MIME, OslcMediaType.RDF_THRIFT_MIME}) | ||
| public class UniversalResourceSingleProvider extends AbstractRdfProvider |
There was a problem hiding this comment.
name suggestion: OslcResourceProvider
| @Consumes({OslcMediaType.APPLICATION_JSON_LD, OslcMediaType.TEXT_TURTLE, | ||
| OslcMediaType.N_TRIPLES_MIME, OslcMediaType.RDF_JSON_MIME, OslcMediaType.RDF_THRIFT_MIME}) | ||
| public class UniversalResourceSingleProvider extends AbstractRdfProvider | ||
| implements MessageBodyReader<IResource>, MessageBodyWriter<IResource> { |
There was a problem hiding this comment.
Can one also add?
implements MessageBodyReader<Collection<? extends IResource>>, MessageBodyWriter<Collection<? extends IResource>>
There was a problem hiding this comment.
No, unfortunately this does not work due to type erasure in Java. See https://softwareengineering.stackexchange.com/questions/219427/implementing-multiple-generic-interfaces-in-java for the background.
There was a problem hiding this comment.
Ok. We simply need to provide other Providers for collection.
Don’t even remember why we said we can do it all in 1 class.
# Conflicts: # oslc4j-jena-provider/src/main/java/org/eclipse/lyo/oslc4j/provider/jena/AbstractOslcRdfXmlProvider.java # oslc4j-jena-provider/src/test/java/org/eclipse/lyo/oslc4j/provider/jena/test/JsonLdTest.java
|
@jadelkhoury you were right, this does not include a Jena Model writer. |
I have one somewhere I can contribute. I'm sure you will want to make changes to that :-) |
2nd try, #9 has too many merge conflicts
TODO
AbstractRdfProvider