HydraCG / Specifications

Specifications created by the Hydra W3C Community Group
Other
139 stars 25 forks source link

Add Turtle serialization of the examples #18

Open lanthaler opened 10 years ago

lanthaler commented 10 years ago

_Raised by @rubenverborgh on the mailing list:_

Meta-remark: did you consider giving the examples in Turtle? You would reach a broader audience that way.

[...]

For instance, my understanding is quite slowed down by the syntax. You could add some JavaScript to the page that can toggle between Turtle and JSON-LD, if you want to maintain JSON-LD as well. (Just a thought.)

lanthaler commented 10 years ago

... and Kingsley's +1

elf-pavlik commented 10 years ago

:+1: i could help with adding N3.js which can run both in node.js and browser!

damnhandy commented 10 years ago

+1 I think this would help a lot

akuckartz commented 10 years ago

+1

elf-pavlik commented 10 years ago

maybe we could use https://github.com/json-ld/json-ld.org/blob/master/playground/jsonld-turtle.js

lanthaler commented 10 years ago

The first problem is that the examples are just snippets. Not completely valid JSON-LD. The second problem is that the comments are often important and that it’s not easy to preserve them when automatically converting to a different syntax. Last but not least, the module you mentioned doesn’t output “nice” Turtle, it outputs N-Triples (in this case). So, summarized, at the moment I don't see how it would be possible to automate this translation.

arnau commented 10 years ago

What about extracting the comments as regular paragraphs and make the examples fully functional snippets?

We add a bit of misdirection but the examples will be more realistic and changing syntax will be no problem.

elf-pavlik commented 9 years ago

How about always including full examples in code block but then use html comments and js rendering to hide those not relevant parts and show inline comments in json?

I would see it as 3 tabs

  1. shortened JSON-LD with comments inline
  2. full JSON-LD no comments
  3. full turtle and no comments

BTW rdf-ext soon may output nice Turtle, which will make writing such script much simpler! https://github.com/bergos/rdf-ext/issues/6

lanthaler commented 9 years ago

I think it might actually be simpler to just convert the examples to Turtle manually instead of inventing some complex markup structure. That being said, if you have time to work on this I would definitely be interested in it.

RubenVerborgh commented 9 years ago

For consistency, manual conversion might not be optimal. Maybe better to wait until the spec is final?