ResearchObject / ro-crate

Research Object Crate
https://w3id.org/ro/crate/
Apache License 2.0
88 stars 36 forks source link

Consider using flattened JSON-LD #4

Closed ptsefton closed 5 years ago

ptsefton commented 5 years ago

When writing the DataCrate spec I started using the same JSON-LD style as used here, where properties are in-line.

{
     "name": "Dataset of repository sizes in CWL Viewer",
    "description": "This is a simple dataset showing the size in bytes of the repositories examined by https://view.commonwl.org/ sinze September 2018",
    "keywords": "CWL, repository, example",    
    "temporalCoverage": "2018-09/2019-01",
    "contentLocation": {
            "@id": "http://sws.geonames.org/9884115/",
            "name": "Kilburn Building, Manchester, UK"
    }

However, this is difficult to code against; to get the content location on the first mention you look for a contentLocation property, but on subsequent mentions you have to find the item by @id - but this is non-trivial to code.

We decided that the format should be optimised for ease of coding for linked-data-naive programmers. If you use flattened JSON-LD then it is trivial to index the @graph into a dictionary by ID and to traverse the @graph.

In DataCrate we also noted that we didn't expect hand-authoring to be much of a thing - and it's pretty easy to code tools that generate flattened JSON-LD.

Of course, if there were good libraries for using JSON-lD, and traversing the @graph then this would not matter, but as far as I know there are not.

ptsefton commented 5 years ago

Re-expressed as a use case: #9