.
a foaf:Person ;
foaf:firstName "Thomas" ;
foaf:lastName "Hoppe" ;
foaf:workplaceHomepage "http://www.n-fuse.de" .
````
---
# Text Localization in RDF
- RDF has the concept of text localization baked in!
- Since RDF 1.1 `rdf:langString` is the date type for localized literals.
- [BCP47](http://tools.ietf.org/html/bcp47) language tags like `de-AT` are used
to denote the language.
RDF/XML:
````
Thomas
````
Turtle/ N3:
````
foaf:firstName "Thomas"@DE ;
````
---
# Vocabularies
__Goal__: Establish common, shared terms for a domain.
__Comprising__:
- Individuals (instances, objects),
- Classes (concepts, types),
- Properties (relations, roles),
- Rules (axioms).
There are multiple vocabularies, to define vocabularies such as RDFS and OWL.
If they are rather complex (meany), they are also called _ontologies_.
Technically they are nothing else than a bunch of RDF resources which
are mostly used as predicates in other RDF resources.
---
# Some Interesting Vocabularies
PREFIX IRI
rdf http://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfs http://www.w3.org/2000/01/rdf-schema#
xsd http://www.w3.org/2001/XMLSchema#
owl http://www.w3.org/2002/07/owl#
skos http://www.w3.org/2004/02/skos/core#
dir http://dir.w3.org/directory/schema#
org http://www.w3.org/ns/org#
rov http://www.w3.org/ns/regorg#
dct http://purl.org/dc/terms/
http http://www.w3.org/2011/http#
httph http://www.w3.org/2011/http-headers#
hydra http://www.w3.org/ns/hydra/core#
cc http://creativecommons.org/ns#
foaf http://xmlns.com/foaf/0.1/
sioc http://rdfs.org/sioc/ns#
geo http://www.w3.org/2003/01/geo/wgs84_pos#
gn http://www.geonames.org/ontology#
og http://ogp.me/ns#
gr http://purl.org/goodrelations/v1#
xro http://purl.org/xro/ns#
dbo http://dbpedia.org/ontology/
schema http://schema.org/
tzont http://www.w3.org/2006/timezone#
lingvo http://www.lingvoj.org/ontology#
lvont http://lexvo.org/ontology#
vs http://www.w3.org/2003/06/sw-vocab-status/ns#
pto http://www.productontology.org/id/
vann http://purl.org/vocab/vann/
prov http://www.w3.org/ns/prov#
doap http://usefulinc.com/ns/doap#
voaf http://purl.org/vocommons/voaf#
void http://rdfs.org/ns/void#
adms http://www.w3.org/ns/adms#
Consider those de-facto prefixes, check http://prefix.cc/.
---
# Where to get a Vocab for my Domain?!
1. Check what other people already have modelled:
- [schema.org](schema.org) — from Google and other search engines,
- [http://lov.okfn.org/dataset/lov/](http://lov.okfn.org/dataset/lov/) —
Linked Open Vocabularies,
- [http://vocab.cc/](http://vocab.cc/) — RDF vocabulary search and lookup.
2. Create your own one
- Just coin an IRI without having an actual vocab,
- RDFS (RDF Schema),
- OWL.
---
# What we gain from using RDF
- Often times you don't need to model your domain as their terms and relations
are already defined by existing vocabularies.
- RDF based data is highly interoperable.
- Independent of syntax.
- Independent of platform (operating system, application, programming language).
- Unambiguous meaning of every relation (property in JSON-LD).
- Minimal risk of naming collisions.
- Data models are extensible as it is based on an
[Open World Assumption](http://en.wikipedia.org/wiki/Open-world_assumption).
- Allows the the construction of the digital equivalent of natural language
sentences and thus machine interpretation.
---
class: center, middle
# Linked Data
---
# Linked Data
- It's about things and their relations, not about documents.
- For me something like the second take on the Semantic Web.
- Still based on RDF and co.
- Ultimate objective: Make the Web a single database.
More:
- https://www.youtube.com/watch?v=4x_xzT5eF5Q
- http://www.w3.org/TR/ld-glossary/#linked-data
---
# Linked Data Objective (1/2)
To get from a Web of documents...
![Web of Documents](http://www.bbc.co.uk/staticarchive/533355da9de4faf21572098cf6aafa5a97795bce.png)
http://www.bbc.co.uk/staticarchive/533355da9de4faf21572098cf6aafa5a97795bce.png
---
# Linked Data Objective (2/2)
...to a Web of data (facts and relations).
![Web of Data](http://www.bbc.co.uk/staticarchive/392887acaaad47e534390f2c7d3910f2bf380a2e.png)
http://www.bbc.co.uk/staticarchive/392887acaaad47e534390f2c7d3910f2bf380a2e.png
---
# Linked Data Principes
1. Use **URIs to denote things**.
2. Use **HTTP URIs** so that these things can be referred to and **looked up** ("dereferenced") by people and user agents.
3. **Provide useful information about the thing when its URI is dereferenced**, leveraging standards such as RDF, SPARQL.
4. Include **links to other related things** (using their URIs) when publishing data on the Web.
Tim Berners-Lee, 2006
---
# URLs, URIs, IRIs WTF?
- In the past, the Semantic Web was all about URIs.
- In 2005 they gained Unicode support with IRIs.
- URLs are just URIs/ IRIs which can be dereferenced.
---
# Linked Data Components
- URIs/ IRIs (specifically, of the dereferenceable variety).
- HTTP.
- Resource Description Framework (RDF).
- Serialization formats (RDFa, RDF/XML, N3, Turtle, JSON-LD, and others).
---
class: center, middle
# JSON-LD
---
# JSON-LD
JSON Linked Data; a serialization format for RDF.
> The desire for __better Web APIs__ is what motivated the creation of JSON-LD, not the Semantic Web.
If you want to make the Semantic Web a reality, stop making the case for it and spend your
time doing something more useful, like actually making machines smarter
or helping people publish data in a way that’s useful to them.
‒ Manu Sporny [JSON-LD and why I hate the Semantic Web](http://manu.sporny.org/2014/json-ld-origins-2/)
---
# Currently in _Recommendation_ state
---
# JSON-LD by Example (1/2)
Plain JSON:
````
{
"id": "http://thomashoppe.me",
"firstName": "Thomas",
"lastName": "Hoppe",
"workplaceHomepage": "http://www.n-fuse.de"
}
````
JSON-LD:
````
{
"@id": "http://thomashoppe.me",
"http://xmlns.com/foaf/0.1/firstName": "Thomas",
"http://xmlns.com/foaf/0.1/lastName": "Hoppe",
"http://xmlns.com/foaf/0.1/workplaceHomepage": "http://www.n-fuse.de"
}
````
---
# JSON-LD by Example (2/2)
Using an `@context` to shorten things and typing it using `@type`:
````
{
"@context": {
"id": "@id",
"foaf": "http://xmlns.com/foaf/0.1/",
"firstName": "foaf:firstName",
"lastName": "foaf:lastName",
"workplaceHomepage": "foaf:workplaceHomepage"
},
"@type": "foaf:Person",
"id": "http://thomashoppe.me",
"firstName": "Thomas",
"lastName": "Hoppe",
"workplaceHomepage": "http://www.n-fuse.de"
}
````
The `@context` can also be announced with an appropriate header:
`Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"`
---
# Polymorphy of JSON-LD and Compaction
JSON documents __1__ & __2__ are semantically equivalent:
__1:__
````
{
"@id": "http://thomashoppe.me",
"http://xmlns.com/foaf/0.1/firstName": "Thomas"
}
````
__2:__
````
{
"@context": {
"id": "@id",
"foaf": "http://xmlns.com/foaf/0.1/",
"firstName": "foaf:firstName"
},
"id": "http://thomashoppe.me",
"firstName": "Thomas"
}
````
I can transform 1 into 2 with the `@context` of 2 and the JSON-LD
__compaction__. See
[playground example](http://json-ld.org/playground/index.html#startTab=tab-compacted&json-ld=%7B%22%40id%22%3A%22http%3A%2F%2Fthomashoppe.me%22%2C%22http%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2FfirstName%22%3A%22Thomas%22%7D&context=%7B%22id%22%3A%22%40id%22%2C%22foaf%22%3A%22http%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%22%2C%22firstName%22%3A%22foaf%3AfirstName%22%7D).
---
# Declaring Links in JSON-LD
````
{
"@context": {
...
"workplaceHomepage": {
"@type": "@id",
"@id": "foaf:workplaceHomepage"
}
},
...
"workplaceHomepage": "http://www.n-fuse.de"
}
````
Effectively, this declares that the value of the `workplaceHomepage` property
is a resource.
---
# More about JSON-LD
- https://www.youtube.com/watch?v=vioCbTo3C-4
- http://de.slideshare.net/lanthaler/building-next-generation-web-ap-is-with-jsonld-and-hydra?next_slideshow=1
- http://json-ld.org/playground/
---
class: center, middle
# Hydra Core
---
# About ![Hydra Core Logo](http://www.hydra-cg.com/img/logo.svg) Core
Hydra is a vocabulary to describe hypermedia-driven Web APIs created by
[Markus Lanthaler](http://www.markus-lanthaler.com/).
It provides the following API primitives:
- Entry point,
- Resource (through RDFS),
- Link (through JSON-LD),
- Affordance (operation),
- Collection of resources (incl. paging),
- API documentation,
- Free text query,
- etc.
---
# Currently in _Unofficial Draft_ state
---
# Hydra Core by Example (1/2)
Paged collection:
````
{
"@context": "http://www.w3.org/ns/hydra/context.jsonld",
"@id": "http://api.example.com/users/?page=3",
"@type": "PagedCollection",
"totalItems": "4980",
"itemsPerPage": "10",
"firstPage": "/users/?page=1",
"nextPage": "/users/?page=4",
"previousPage": "/users/?page=2",
"lastPage": "/users/?page=498",
"member": [
... the members of this PagedCollection ...
],
"me": "/users/?me"
}
````
---
# Hydra Core by Example (2/2)
Operations:
````
{
"@context": "http://www.w3.org/ns/hydra/context.jsonld",
"@id": "http://api.example.com/an-issue/comments?page=3",
"@type": "PagedCollection",
...
"member": [
... the members of this PagedCollection ...
],
"operation": [
{
"@type": "AppendResourceOperation",
"method": "POST",
"expects": "User"
}
]
}
````
---
# More about Hydra Core
Intro:
http://de.slideshare.net/lanthaler/the-web-is-changing-from-strings-to-things
---
class: center, middle
# The Web 3.0 is just around the corner
and with this stuff you can be part of it.
---
class: center, middle
# Thank you
This work is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
.