Hi, > There isn't a way to style the output in Jena. It would nice to have > something that is general, robust and pretty. (anyone want to have a go?)
“general, robust and pretty” is probably to hard for me, but I could try something. I have looked at the code. Regarding robustness, one difficulty comes from the fact that jsonld-java uses Object as type of most of its arguments in methods Andy, following your suggestions in the thread already mentioned: It looks like there is no write methods with the (jena) Context argument in RDFDataMgr, so it would be necessary to add them. Then there is the question of the stuff that we want to use to control the output by jsonld-java. Andy, you suggested to give the possibility to pass the (jsonld-java) context, and the frame object expected by the framing algo. I think we could also add the possibility to choose between compacted, expanded and flattened output form. Maybe also an instance of the (jsonld-java) options object, that allow to control some more details. When a param is not passed through the (jena) Context mechanism, we use sensible defaults (such as those used today): compacted output, creating a (jsonld-java) context from the defined ns prefixes, and the properties used in the rdf. One question is: should we have several Symbols defined (one for each of these parameters), or only one, supposed to be of a given class (say “JsonLDWriterParams”). Another one is: what kind of help can be provided to the user to create instances of the objects expected by jsonld-java. And where would go the doc about this? Something that I do not know about (yet) is framing. Some example (data, @context, frame) to use as a development use case would be helpful I have some working code. If this makes sense, then I could try to clean it up and make it available. Nothing before 2-3 weeks, however. BTW Andy, maybe you remember this: https://github.com/jsonld-java/jsonld-java/issues/141 "Invalid JSON-LD if Jena defines an "” prefix" you solved the issue by removing “” prefix when creating the context expected by jsonld-java. It looks like instead of removing it, you could replace the “” key by “@vocab” (this is what jsonld-java does somewhere in their code). I tried it and it seems to work correctly. Best, fps > Le 10 avr. 2016 à 22:34, Andy Seaborne <a...@apache.org> a écrit : > > On 10/04/16 15:43, François-Paul Servant wrote: >> Hi, >> >> beside setting the NSPrefixes, are there ways to control the JSON-LD output >> from Jena? For instance, to choose the format (compact, expanded,…), or to >> set the context. >> >> If not, any pointer into the code to get me started quickly? >> >> I’ve read this old thread on this subject: >> http://users.jena.apache.narkive.com/NF0pn3kq/controlling-json-ld-output >> >> Best, >> >> fps >> >> > > Hi, > > There isn't a way to style the output in Jena. It would nice to have > something that is general, robust and pretty. (anyone want to have a go?) > > Alternatively, JSON-LD framing, any toolkit, applied after output from Jena > as mentioned in the thread, is one thing consider especially if what you want > is idiomatic JSON for the application domain, that happens to be JSON-LD as > well. > > Andy >