ANN: json_ld_processor - A Python implementation of a document-based JSON-LD processor

187 views
Skip to first unread message

Bradley P. Allen

unread,
Oct 16, 2010, 12:50:02 PM10/16/10
to json-ld
Folks- FWIW, I've posted an initial version of a document-based JSON-
LD processor implemented in Python to Github at:

http://github.com/bradleypallen/json_ld_processor

I've tried to make it useful for purposes of initial discussions on
direction and use cases by providing tooling for playing with and
hopefully extending a test suite of JSON-LD documents. As an initial
set of tests, I've taken almost all of the examples in the draft
specification and added a few based on previous discussions with Manu,
as well as some edge cases occurring to me in during implementation. I
haven't yet had a chance to absorb new cases that can be distilled
from the several discussions that have started on the json-ld group,
but I hope to turn my attention to that shortly.

Comments, suggestions, brickbats, etc. most welcome. - regards, BPA

Mark Birbeck

unread,
Oct 16, 2010, 5:13:46 PM10/16/10
to jso...@googlegroups.com
Hi Bradley,

This is great...nice work.

Also, it's great that you have so many tests. Hopefully at some point
we can centralise everyone's tests and create a 'standard' test-suite
-- and your tests look like a pretty good start.

Regards,

Mark

Manu Sporny

unread,
Oct 16, 2010, 5:53:56 PM10/16/10
to jso...@googlegroups.com
On 10/16/2010 12:50 PM, Bradley P. Allen wrote:
> Folks- FWIW, I've posted an initial version of a document-based
> JSON- LD processor implemented in Python to Github at:
>
> http://github.com/bradleypallen/json_ld_processor

Wow, that was fast. Nice work, Brad! :)

You're the first implementation up on json-ld.org:

http://json-ld.org/

The core algorithm looks really manageable as well, so that's always
nice to see:

http://github.com/bradleypallen/json_ld_processor/blob/master/src/json_ld_processor.py#L129

> Comments, suggestions, brickbats, etc. most welcome. - regards, BPA

Just a few comments:

You may want to change the Python objects that you generate - IRIs don't
need the '<' and '>' characters around them if you normalize them
(expand the CURIEs, that is) for subjects and properties/predicates.

The object literals can be four different types: a plain literal, a
plain literal with a language tag, a typed literal and an IRI. You'll
hit this issue when you try to convert your data to something like
RDF/XML or RDFa. Just a heads-up that your returned object model is
going to have to become a bit more complex.

Here's one way you could do it (librdfa Python example):

http://github.com/msporny/librdfa/blob/master/tests/rdfa2rdfxml.py#L40

-- manu

--
Manu Sporny (skype: msporny, twitter: manusporny)
President/CEO - Digital Bazaar, Inc.
blog: Saving Journalism - The PaySwarm Developer API
http://digitalbazaar.com/2010/09/12/payswarm-api/

Bradley P. Allen

unread,
Oct 16, 2010, 7:51:59 PM10/16/10
to json-ld
Manu and Mark- Thanks for the quick feedback. Per Manu's suggestions,
I will work on getting finer-grained representations of objects and
scrap the angle brackets. - cheers, BPA

On Oct 16, 2:53 pm, Manu Sporny <mspo...@digitalbazaar.com> wrote:
> On 10/16/2010 12:50 PM, Bradley P. Allen wrote:
>
> > Folks- FWIW, I've posted an initial version of a document-based
> > JSON- LD processor implemented in Python to Github at:
>
> >http://github.com/bradleypallen/json_ld_processor
>
> Wow, that was fast. Nice work, Brad! :)
>
> You're the first implementation up on json-ld.org:
>
> http://json-ld.org/
>
> The core algorithm looks really manageable as well, so that's always
> nice to see:
>
> http://github.com/bradleypallen/json_ld_processor/blob/master/src/jso...
Reply all
Reply to author
Forward
0 new messages