Affects Version/s: None
Fix Version/s: None
The Serialization of the Entityhub models is implemented as JAX-RS MessageBodyWriter. Model classes to be serialized include Representation, Entity and QueryResultList. Where an Entity is constructed of two Representations (data and metadata) and QueryResultLists can include Strings (ids only), Representations or Entities.
Currently there are two implementations of model serializer: (1) an Implementation for the Entityhub specific JSON format and (2) an implementation based on Clerezza that supports the various RDF formats. Those implementations are registered to JAX-RS via the supported interfaces and the supported media types.
STANBOL-1165 support for Sesame was added to the Stanbol Entityhub, but serialization of Sesame backed Representation to RDF based media formats is still done by the Clerezza serializers what is extremely inefficient as (1) the Sesame Model needs to be converted to a Clerezza backed model requiring to copy all the data field by field (2) Clerezza internally will use the Jena serializer via a Clerzza/Jena adapter.
To avoid this the Entityhub requires an extendable serializer framework that allows to register ModelWriter for specific Entityhub Model implementation. For Sesame this will be done within
The MessageBodyWirter extension point provided by JAX-RS can not be used for this as there are no native implementations for Entity and QueryResultList. Also the use of generic types is not an option as the Entity interface does not use the same.
Because of that this issue will introduce an new extension point called "ModelWriter" that can be implemented by modules that need to provide native serialization support for Representation implementations. ModelWriter will be registered as OSGI services. A ModelWriterRegistry will be responsible for tracking those. Three MessageBodyWriter implementation for Representation, Entity and QueryResultList will use this registry to forward the calls of JAX-RS to the best fitting ModelWriter service.
In addition this will provide two ModelWriter implementations (1) for 'application/json' with no specific native type and (2) for the various RDF formats with native Support for the Clerezza Model implementation.
STANBOL-1234 will provide a third implementation of a ModelWriter for the Sesame model implementation.