W3C home > Mailing lists > Public > public-openannotation@w3.org > July 2013

Framing and @graph

From: Robert Sanderson <azaroth42@gmail.com>
Date: Wed, 31 Jul 2013 13:45:19 -0600
Message-ID: <CABevsUGX6ObTeuDdcT3o54+j5JkmwC-UZVqBrGyU7mbkxrniqA@mail.gmail.com>
To: Linked JSON <public-linked-json@w3.org>, public-openannotation <public-openannotation@w3.org>
Dear lists,

We've been looking at framing as a method to easily arrive at a json
developer friendly serialization for Open Annotation, and other projects,
from a set of triples.

In Open Annotation, currently, we do not push for the use of @graph in the
serialization, and in fact don't even mention it [1].  However framing
seems to always insert the @graph keyword when it wasn't present before
[2].  This means that either every client needs to know that it should look
inside @graph or at the top level for the annotation, or we could simply
specify that @graph must be present for consistency.

The issue that I (at least) have with this is that the JSON-LD docs bury
@graph in a "Named Graph" section rather than being up front and saying
that you need to worry about it all the time, even if you don't have a
named graph.

Or am I missing an option that allows @graph to be omitted?  Equally, not
naming blank nodes would also be another nice output option, rather than
generating explicit bnode names?  Or ... am I missing the point of framing
entirely? :)

(Also many thanks for the work on the list issue!)


1. http://www.openannotation.org/spec/core/publishing.html#Serialization

Using the pyld implementation:

>>> anno = {
...     "@context": "http://www.shared-canvas.org/ns/oa-context.json",
...     "@type": "oa:Annotation",
...     "hasBody": "http://www.example.org/body1",
...     "hasTarget": "http://www.example.org/target1"
... }
>>> framed = {
...     '@context': 'http://www.shared-canvas.org/ns/oa-context.json',
...     '@type': 'oa:Annotation'
... }
>>> pprint.pprint(frame(anno,framed))
{'@context': 'http://www.shared-canvas.org/ns/oa-context.json',
 '@graph': [{'@id': '_:b0',
             '@type': u'oa:Annotation',
             u'hasBody': 'http://www.example.org/body1',
             u'hasTarget': 'http://www.example.org/target1'}]}
Received on Wednesday, 31 July 2013 19:45:46 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 31 July 2013 19:45:47 UTC