You are browsing the archive for ontology.

Follow-up to serialising RDF in JSON

- May 5, 2011 in BibServer, Data, inf11, jisc, JISC OpenBib, jiscEXPO, jiscopenbib, OKFN Openbiblio, ontology, progress, rdf, Semantic Web

Following on from Richard’s post yesterday, we now have a JSON-LD serialiser for RDFlib. This is still a work in progress, and there may be things that it is serialising incorrectly. So, please give us feedback on this, and tell us where we have misinterpreted the structure. Here you will find a sample JSON-LD output file, which was generated from this Bibliographica record. The particular area of concern surrounds how the JSON-LD spec describes serialising disjoint graphs into JSON-LD (section 8.2). How does this differ from serialising joined graphs? We are presuming all that our output file is an example of a joined graph, and that additional disjoint graphs would be added by appending additional @:[] sections.

Comparative Serialisation of RDF in JSON

- May 4, 2011 in BibServer, Data, inf11, jisc, JISC OpenBib, jiscEXPO, jiscopenbib, model, OKFN Openbiblio, ontology, outputs, progress, progressPosts, rdf, Semantic Web

This is a comparison of RDF-JSON and JSON-LD for serialising bibliographic RDF data. Given that we are also working with BibServer we have taken a BibJSON document as our source data for comparison. The objective was to both understand these two JSON serialisations of RDF and also to look at the BibJSON profile to see how it fits into such a framework. Due to limitations of the display of large plain-text code snippets on the site, we have placed the actual content in this text file which you should refer to as we go along. We used a BibJSON document, which comes from the examples on the BibJSON homepage. When converting this into the two RDF serialisations we invent a namespace
http://www.bibkn.org/bibjson/terms/
This namespace provisionally holds all predicates/keys that are used by BibJSON and are not immediately clearly available in another ontology. These terms should not under any circumstances be considered definitive or final, only indicative. Now consider the RDF-JSON serialisation Some key things to note about this serialisation:
  • There is no explicit shortening of URIs for predicates into CURIEs, all URIs are instead presented in full.
  • The subject of each predicate is a JSON object with up to 4 keys (value, type, datatype, lang). This means that it is not easy for the human eye to pick out the value of a particular predicate.
  • Of the two RDF serialisations, this is by far the most verbose
  • It is relatively difficult for a human to read and write
Compare this with the equivalent JSON-LD serialisation: Some things to note about this serialisation:
  • It has a clear treatment of namespaces
  • It may be slightly inaccurate, as there are some parts of its specification which are ambiguous – feedback welcome
  • The object values cannot be taken as the value of the predicate, as they may contain datatype and/or language information in them, or may be surrounded by angled brackets.
  • It is relatively easy for a human to read and write
Both serialisations are capable of representing the same data, although JSON-LD is far more terse and therefore easier to read and write. It is not, however, possible to reliably treat JSON-LD as a pure list of key-value pairs in non-RDF aware environments, as it includes RDF type and language semantics in the literal values of objects. RDF-JSON does not suffer from this same issue within the object literals, but in return its notation is more complex. A serious lacking in RDF-JSON is explicit handling of CURIEs and namespaces, and it could benefit from adopting the conventions laid out in JSON-LD – this may bring the choice of which serialisation to use down to preference rather than relying on any significant technical differences. Each of the formats also comfortably represents BibJSON, and with the extensive lists of predicates provided in that specification it would be straightforward enough to do a full and proper treatment of BibJSON through one of these routes.