You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Elli Schwarz <el...@yahoo.com> on 2014/05/26 21:07:28 UTC
Reading JSON into Jena model as JSON-LD without explicit context
Hello,
I have some JSON documents that I want to load in to a Jena model. The JSON itself doesn't contain a context, since it wasn't written with the intention of being JSON-LD. I'm using the latest snapshot (2.11.2-SNAPSHOT) of Jena so it has built-in JSON-LD support.
I wrote a context for this JSON, and if I manually add the context to the JSON-LD file (I actually add a remote context, so I'm just adding a URL for the context), then I can load the data properly into a Jena model. However, I'd prefer to not have to manually add a context to each file. Is there a way to tell Jena where to load a context from? The JSON-LD spec allows for JSON documents to not contain a context, but use an HTTP Link header - so how could those documents be loaded into a Jena model?
For now, I read the JSON file with a JSON parser and add the appropriate JSON syntax for a context, and then load the resulting JSON with the context into Jena, but I'd prefer a more straightforward way if there is one.
Thanks!
-Elli
Re: Reading JSON into Jena model as JSON-LD without explicit context
Posted by Andy Seaborne <an...@apache.org>.
On 26/05/14 20:07, Elli Schwarz wrote:
> Hello,
>
> I have some JSON documents that I want to load in to a Jena model.
> The JSON itself doesn't contain a context, since it wasn't written
> with the intention of being JSON-LD. I'm using the latest snapshot
> (2.11.2-SNAPSHOT) of Jena so it has built-in JSON-LD support.
>
> I wrote a context for this JSON, and if I manually add the context to
> the JSON-LD file (I actually add a remote context, so I'm just adding
> a URL for the context), then I can load the data properly into a Jena
> model. However, I'd prefer to not have to manually add a context to
> each file. Is there a way to tell Jena where to load a context from?
> The JSON-LD spec allows for JSON documents to not contain a context,
> but use an HTTP Link header - so how could those documents be loaded
> into a Jena model?
>
> For now, I read the JSON file with a JSON parser and add the
> appropriate JSON syntax for a context, and then load the resulting
> JSON with the context into Jena, but I'd prefer a more
> straightforward way if there is one.
>
> Thanks! -Elli
>
(sorry for the delay - your email got dumped into one of my spam folders)
There isn't currently a way to connect the HTTP header automatically to
the JSON-LD reader at the moment.
What I would like to see is that when opening an URL, Any suitable
"Link:" information is added to the Context object that is then passed
into the reader. These Context objects allow per-language items to be
passed through without every interface having to have every combination
of arguments.
Andy