-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Json-LD (de)serializer #487
Comments
How are we going to implement multiple instances of MessageContentSerializer? I'm guessing Filters will allow to select one or the other. But what do we put in the Filter? |
MessageContentSerializer.deserialize(String) should be defined as trowing a ParseException. This will be useful when having several serializers and determine which language the string is in. |
Sorry, there has been no progress on the serializer itself. But there is some progress in the preparation, e.g. the classes GraphIterator and Specializer. In the old version, the turtle serializer did everything by itself. The Specialization part is now provided by the Specializer in data.representation and can be used by different serializers (this was a big part). With Gson being a separate lib that is already included, adding JSON-LD should be a lot simper now. A few things to consider (as far as I remember):
I know you are asking for this feature for a very long time now. Sorry for not having this finished yet. |
@cstockloew Thank you for your pointers, I am now starting the development of this Serializer; as you said, it seems to be easy. |
I just pushed new branch at https://github.com/universAAL/middleware/tree/issue/487 |
The turtle serializer is stand-alone and thus does everything by itself. Maybe an external lib, like Gson, provides this already natively? If not, it would also be possible to "extract" some util-methods, either to data.representation or to another bundle, e.g. data.serialization.common.{core/osgi}? The serializer works like this: if (StringUtils.isQualifiedName(uri))
countNs(uri.substring(0, uri.lastIndexOf('#') + 1), nsTable); The Hashtable nsTable maps the namespace (String) to the number of how often it is used (integer). Later, when it comes to actually writing the output, it calls writeNamespaces(nsTable) which writes the namespaces to the output String and makes the overall mapping in HashTable namespaceTable. This namespaceTable is then used for every Resource that is written (method writeURI). |
This function is exactly what URICompactor is doing, but with 2 added features:
|
I have developed other analyzers, As sanity check, allow me to enumerate the common things and/or "uAAL quirks" a serializer has to account for:
All other stuff is just listing properties and serializing them recursively. Of course theres the help of TypeMapper.getXMLInstance(o), which helps serialize primitives in XML (most other serializations follow). |
Add Json-LD https://www.w3.org/TR/json-ld/ Serializer.
prerequisite: resolve multi-serializer servcie, and service selection for serialization.
The text was updated successfully, but these errors were encountered: