On 13/08/14 16:14, Jim Balhoff wrote:
On Aug 12, 2014, at 10:20 AM, Andy Seaborne <[email protected]> wrote:

On 11/08/14 20:03, Jim Balhoff wrote:
Hi,

I am trying to output a Model as JSON-LD. It's working fine, but
now I would like to make some changes to how the output is
structured. For example, I'd like to define a @reverse property
in the @context so that I can output certain triples in the
reverse direction. Is it possible to influence the output of the
JSON-LD writer? I have not found a way.

Thank you, Jim


Jena uses java-jsonld to do the JSON-LD reading and writing.  If
there is a way to control java-jsonld to do that then it can be
added (and I expect there is - I just don't know what it is).
There is a way to pass writer specific configuration details.
Currently, nothing is done but an obvious feature is to pass in the
context setup.

The Jena apart of the JSON writer is in
org.apache.jena.riot.out.JsonLDWriter

Would you like to have a look?

Yesterday I spent some time looking at jsonld-java. I added some code
to Jena so I could pass in a map for the context. This does get
included in the JSON output @context but doesn't influence the way
the data is structured. So far I don't see how to guide the output so
that there is only one root object. I suspect I may be missing
something that could be done with the "compact" or "frame"
operations.

Best regards, Jim

Jim,

Thanks for trying. It's probably a question for jsonld-java directly. Jena is using jsonld-java and maybe the writer is being too simplistic. If there improvements, then I'm very willing to add them but when I tried various options, I didn't get nicer output at the time. Maybe I was missing something as well.

        Andy


Reply via email to