OpenTransport / vocabulary

A vocabulary to describe transport systems
36 stars 9 forks source link

[GTFS] Add JSON-LD contexes #22

Open pietercolpaert opened 9 years ago

pietercolpaert commented 9 years ago

In order for these vocabularies to be used for various JSON-LD API responses, we can help the API builder by providing JSON-LD contexts for them. A context defines the structure of the response and what JSON key/words to use for what URI.

pietercolpaert commented 9 years ago

/fwd @ocorcho @bertspaan - You were both interested in adding JSON-LD contexes to the Linked GTFS vocabulary. This would be really helpful!

bertspaan commented 9 years ago

@pietercolpaert Thanks - we are still working on the backend of our GTFS processing, we should be able to show you some output and very basic JSON-LD contexts later this week.

I've created an issue in our repo with extra information and use cases, I'll post some JSON and JSON-LD data output there soon.

pietercolpaert commented 9 years ago

Cool! Will add some examples there!

Another thing I would recommend is not to make a distinction between JSON and JSON-LD. When the context is good, the JSON-LD will be as usable as JSON :)

bertspaan commented 9 years ago

Yes, but JSON-LD does add lots of extra data to our API's output, which I'm sure users of our API not always need. Therefore, we have decided on, by default, returning standard GeoJSON, and only JSON-LD when &format=jsonld is specified. What do you think about this?

pietercolpaert commented 9 years ago

It's good that you allow multiple content types for different clients. Yet, I would prefer JSON-LD to be the standard JSON representation: it's the format where you can still convert the data to its most atomic pieces (s-p-o triples) and still be interoperable (in the sense that there will not be identifier collisions) out of the box with other RDF datasets. Geojson on the other hand is a more narrow format: its intended use is to put things on a map.

bertspaan commented 9 years ago

Maybe you're right :dancers: Anyway, it's as simple as changing

default_format :json

to

default_format :jsonld

in the API's initialization code. I'll drink a beer tonight and think about whether I should do this.

ocorcho commented 9 years ago

I am happy to volunteer to create the JSON-LD context if you like, at some point in time next week probably. So if any of you is quicker, let me know.

pietercolpaert commented 9 years ago

Added an example JSON context to a newly created, rather small, stoptimes ontology. Read about it here: https://github.com/OpenTransport/vocabulary/blob/master/stoptimes/spec.md