-
Notifications
You must be signed in to change notification settings - Fork 15
New UniversalResourceSingleProvider to support more RDF formats #76
base: master
Are you sure you want to change the base?
Conversation
2nd try, #9 has too many merge conflicts Signed-off-by: Andrew Berezovskyi <[email protected]>
Signed-off-by: Andrew Berezovskyi <[email protected]>
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can one also add?
implements MessageBodyReader<Collection<? extends IResource>>, MessageBodyWriter<Collection<? extends IResource>>
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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