json-ld - sti innsbruck · rdf hard to read and write (general opinion) lots of overhead for most...

21
JSON-LD Benjamin Hiltpolt

Upload: others

Post on 01-Oct-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: JSON-LD - STI Innsbruck · RDF hard to read and write (general opinion) lots of overhead for most webapplications way more powerful (e.g. global identifiers, link to external sources,

JSON-LDBenjamin Hiltpolt

Page 2: JSON-LD - STI Innsbruck · RDF hard to read and write (general opinion) lots of overhead for most webapplications way more powerful (e.g. global identifiers, link to external sources,

Content● Introduction● Motivation● Syntax● Examples and usage● Conclusions

Page 3: JSON-LD - STI Innsbruck · RDF hard to read and write (general opinion) lots of overhead for most webapplications way more powerful (e.g. global identifiers, link to external sources,

JSON (briefly)easy to read and write

based on JS

● Data is in name/value pairs {"name": "value"}

● Data is separated by commas {"name1":"value1","name2": "value2"}

● Curly braces hold objects {"object1":"values","object2": [1,2,3]}

● Square brackets hold arrays [{ "data": "value"},2,"a string"]

Page 4: JSON-LD - STI Innsbruck · RDF hard to read and write (general opinion) lots of overhead for most webapplications way more powerful (e.g. global identifiers, link to external sources,

RDFhard to read and write (general opinion)

lots of overhead for most webapplications

way more powerful (e.g. global identifiers, link to external sources, ontologies)

triple based, graph based:

@prefix benni: <http://www.w3.org/People/EM/contact#> .@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .@prefix contact: <http://www.w3.org/2000/10/swap/pim/contact#> .

benni:me contact:fullName "Benjamin Hiltpolt" .benni:me contact:mailbox <mailto:benjamin.hiltpolt(at)gmail.com> .

Page 5: JSON-LD - STI Innsbruck · RDF hard to read and write (general opinion) lots of overhead for most webapplications way more powerful (e.g. global identifiers, link to external sources,

MotivationRDF is complicated and hard to use

JSON is widely used (basically everywhere)

JSON lacks some functionalities to allow features like:

● schemas that are globally valid● linking between different data sources

RDF got those features...

Page 6: JSON-LD - STI Innsbruck · RDF hard to read and write (general opinion) lots of overhead for most webapplications way more powerful (e.g. global identifiers, link to external sources,

Motivationhttp://www.w3.org/TR/json-ld/

JSON-LD unifies RDF and JSON

It aims at hiding the “complicated” RDF stuff

JSON-LD is valid JSON

JSON-LD can be serialized as RDF

Page 7: JSON-LD - STI Innsbruck · RDF hard to read and write (general opinion) lots of overhead for most webapplications way more powerful (e.g. global identifiers, link to external sources,

@context{ "@context": { "name": "http://schema.org/name", "image": { "@id": "http://schema.org/image", "@type": "@id" }, "homepage": { "@id": "http://schema.org/url", "@type": "@id" }}}

“person.jsonld”

Page 8: JSON-LD - STI Innsbruck · RDF hard to read and write (general opinion) lots of overhead for most webapplications way more powerful (e.g. global identifiers, link to external sources,

@context{ "@context": "http://json-ld.org/contexts/person.jsonld", "name": "Benjamin Hiltpolt", "homepage": "http://bhiltpolt.com, "image": "http://bhiltpolt.com/image"}

(also inline definition of @context allowed)

Page 9: JSON-LD - STI Innsbruck · RDF hard to read and write (general opinion) lots of overhead for most webapplications way more powerful (e.g. global identifiers, link to external sources,

@language{ "@context": { ... "occupation": { "@id": "ex:occupation", "@container": "@language" } }, "name": "Dieter Fensel", "occupation": { "de": "Professor", "en": "professor", "ja": "教授" }}

Page 10: JSON-LD - STI Innsbruck · RDF hard to read and write (general opinion) lots of overhead for most webapplications way more powerful (e.g. global identifiers, link to external sources,

Syntax (referencing)[ { "@id": "#homer", "http://example.com/vocab#name": "Homer" }, { "@id": "#bart", "http://example.com/vocab#name": "Bart", "http://example.com/vocab#parent": { "@id": "#homer" } }, { "@id": "#lisa", "http://example.com/vocab#name": "Lisa", "http://example.com/vocab#parent": { "@id": "#homer" } }]

Page 11: JSON-LD - STI Innsbruck · RDF hard to read and write (general opinion) lots of overhead for most webapplications way more powerful (e.g. global identifiers, link to external sources,

@list{ "@id": "http://example.org/people#joebob", "nick": [ "joe", "bob", "JB" ],}

"@context": { "nick": { "@id": "http://xmlns.com/foaf/0.1/nick", "@container": "@list" } }, "@id": "http://example.org/people#joebob", "nick": [ "joe", "bob", "jaybee" ],}

Page 12: JSON-LD - STI Innsbruck · RDF hard to read and write (general opinion) lots of overhead for most webapplications way more powerful (e.g. global identifiers, link to external sources,

Representations{ "@context": "http://schema.org/", "@type": "Person", "name": "Dieter Fensel", "jobTitle": "Professor", "url": "http://www.fensel.com/"}

compacted Form

Page 13: JSON-LD - STI Innsbruck · RDF hard to read and write (general opinion) lots of overhead for most webapplications way more powerful (e.g. global identifiers, link to external sources,

Representations[ { "@type": [ "http://schema.org/Person" ], "http://schema.org/jobTitle": [ { "@value": "Professor" } ], "http://schema.org/name": [ { "@value": "Dieter Fensel" } ], "http://schema.org/url": [ { "@id": "http://www.fensel.com/" } ] }]

extended From

Page 14: JSON-LD - STI Innsbruck · RDF hard to read and write (general opinion) lots of overhead for most webapplications way more powerful (e.g. global identifiers, link to external sources,

Representations_:b0 <http://schema.org/jobTitle> "Professor" ._:b0 <http://schema.org/name> "Dieter Fensel" ._:b0 <http://schema.org/url> <http://www.fensel.com/> ._:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Person> .

RDF

Page 15: JSON-LD - STI Innsbruck · RDF hard to read and write (general opinion) lots of overhead for most webapplications way more powerful (e.g. global identifiers, link to external sources,

Examples{ "@context": "http://schema.org", "@type": "WebSite", "url": "http://blog.innsbruck.info/", "name": "blog.innsbruck DE", "potentialAction": { "@type": "SearchAction", "target": "http://blog.innsbruck.info/?s={search_term}", "query-input": "required name=search_term" }}

Page 16: JSON-LD - STI Innsbruck · RDF hard to read and write (general opinion) lots of overhead for most webapplications way more powerful (e.g. global identifiers, link to external sources,

stats

August 2015

62500

112500

Page 17: JSON-LD - STI Innsbruck · RDF hard to read and write (general opinion) lots of overhead for most webapplications way more powerful (e.g. global identifiers, link to external sources,

ExamplesGoogle

Schema.org

parsely.com

Page 18: JSON-LD - STI Innsbruck · RDF hard to read and write (general opinion) lots of overhead for most webapplications way more powerful (e.g. global identifiers, link to external sources,

Conclusion● Better then RDF?● A step forward for the Semantic Web?● Performance / tool support

Page 19: JSON-LD - STI Innsbruck · RDF hard to read and write (general opinion) lots of overhead for most webapplications way more powerful (e.g. global identifiers, link to external sources,

Showcasehttp://gmail-actions.appspot.com/

Page 21: JSON-LD - STI Innsbruck · RDF hard to read and write (general opinion) lots of overhead for most webapplications way more powerful (e.g. global identifiers, link to external sources,

References● examples:

○ http://www.parsely.com/resources/telegraph/○ https://developers.google.com/gmail/markup/getting-started

● showcase:○ http://gmail-actions.appspot.com/○ http://blog.innsbruck.info/○ http://json-ld.org/playground/

● statistics:○ http://trends.builtwith.com/docinfo/JSON-LD