Describing LDP Applications
with the Hydra Core Vocabulary
Nandana Mihindukulasooriya, and Raúl García-Castro
Ontology Engineering Group (OEG)
Facultad de Informática
Universidad Politécnica de Madrid
Linked Data Platform 1.0
2Nandana Mihindukulasooriya, OEG
An example application
3Nandana Mihindukulasooriya, OEG
• An address book – for managing contacts
• Contacts
• Create, List, Update, Delete
• User
• Retrieve
Alice
<<user>>
Alice’s
Address Book Alice’s
Contacts
Address Book
4Nandana Mihindukulasooriya, OEG
Address Book
Application
Address Book
Client
Domain Model
5Nandana Mihindukulasooriya, OEG
AddressBook Contact
•email
•fullName
•telephone
•url
User
•name •title
Schema Restrictions
• Data types
• Cardinalities
LDP Model
6Nandana Mihindukulasooriya, OEG
«BasicContainer»
AddressBook
/{personId}/contacts/
«LDPResource»
Contact
ldp:contains
/{personId}/contacts/{contactId}
«LDPResource»
User
/{personId}/
foaf:
primaryTopic
vcard:Email
vcard:Voice
rdfs:Resource
vcard:hasURL
xsd:string
vcard:hasEmail
vcard:hasTelephone
vcard:fn
xsd:string
foaf:name
Application
7Nandana Mihindukulasooriya, OEG
Address Book
Application
Address Book
Client
LDP Container - GET
8Nandana Mihindukulasooriya, OEG
GET /alice/contacts/ HTTP/1.1
Host: example.org
Accept: text/turtle
HTTP/1.1 200 OK
Content-Type: text/turtle; charset=UTF-8
Link: <http://www.w3.org/ns/ldp#BasicContainer>; rel='type',
<http://www.w3.org/ns/ldp#Resource>; rel='type’
ETag: W/'123456711'
Allow: OPTIONS, HEAD, GET, POST
Accept-Post: text/turtle, application/ld+json
Content-Length: 250
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix dc: <http://purl.org/dc/terms/> .
@prefix dc: <http://example.org/vocab#> .
<http://example.org/contacts/> a ex:AddressBook, ldp:BasicContainer;
foaf:primaryTopic <http://example.org/alice>;
ldp:contains <bob>, <jim> .
LDP Container - GET
9Nandana Mihindukulasooriya, OEG
GET /alice/contacts/ HTTP/1.1
Host: example.org
Accept: text/turtle
HTTP/1.1 200 OK
Content-Type: text/turtle; charset=UTF-8
Link: <http://www.w3.org/ns/ldp#BasicContainer>; rel='type',
<http://www.w3.org/ns/ldp#Resource>; rel='type’
ETag: W/'123456711'
Allow: OPTIONS, HEAD, GET, POST
Accept-Post: text/turtle
Content-Length: 250
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix dc: <http://purl.org/dc/terms/> .
@prefix dc: <http://example.org/vocab#> .
<http://example.org/contacts/> a ex:AddressBook, ldp:BasicContainer;
foaf:primaryTopic <http://example.org/alice>;
ldp:contains <bob>, <jim> .
supports LDP Basic Container interactions
LDP Container - GET
10Nandana Mihindukulasooriya, OEG
GET /alice/contacts/ HTTP/1.1
Host: example.org
Accept: text/turtle
HTTP/1.1 200 OK
Content-Type: text/turtle; charset=UTF-8
Link: <http://www.w3.org/ns/ldp#BasicContainer>; rel='type',
<http://www.w3.org/ns/ldp#Resource>; rel='type’
ETag: W/'123456711'
Allow: OPTIONS, HEAD, GET, POST
Accept-Post: text/turtle, application/ld+json
Content-Length: 250
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix dc: <http://purl.org/dc/terms/> .
@prefix dc: <http://example.org/vocab#> .
<http://example.org/contacts/> a ex:AddressBook, ldp:BasicContainer;
foaf:primaryTopic <http://example.org/alice>;
ldp:contains <bob>, <jim> .
supports the mentioned HTTP operations on this resource
LDP Container - GET
11Nandana Mihindukulasooriya, OEG
GET /alice/contacts/ HTTP/1.1
Host: example.org
Accept: text/turtle
HTTP/1.1 200 OK
Content-Type: text/turtle; charset=UTF-8
Link: <http://www.w3.org/ns/ldp#BasicContainer>; rel='type',
<http://www.w3.org/ns/ldp#Resource>; rel='type’
ETag: W/'123456711'
Allow: OPTIONS, HEAD, GET, POST
Accept-Post: text/turtle, application/ld+json
Content-Length: 250
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix dc: <http://purl.org/dc/terms/> .
@prefix dc: <http://example.org/vocab#> .
<http://example.org/contacts/> a ex:AddressBook, ldp:BasicContainer;
foaf:primaryTopic <http://example.org/alice>;
ldp:contains <bob>, <jim> .
Turtle and JSON-LD media types are accepted on POST
12Nandana Mihindukulasooriya, OEG
http://kristenbloggen.net/wp-content/uploads/good.jpg
LDP Container - POST
13Nandana Mihindukulasooriya, OEG
POST /nandana/contacts/ HTTP/1.1
Host: example.org
Slug: jane
Link: <http://www.w3.org/ns/ldp#Resource>; rel='type'
Content-Type: text/turtle
@prefix vcard: <http://www.w3.org/2006/vcard/ns#> .
< > a ex:Contact, vcard:Individual;
vcard:hasURL <http://example.org/jane#me> ;
vcard:hasEmail <mailto:jane@example.com>;
vcard:fn “Jane Doe";
vcard:hasTelephone [ a vcard:Home, vcard:Voice;
vcard:hasValue <tel:+34655555555> ] .
expected Input
(vocabulary,
cardinalities)
supports Slug header
LDP Container - GET
14Nandana Mihindukulasooriya, OEG
GET /alice/contacts/ HTTP/1.1
Host: example.org
Accept: text/turtle
HTTP/1.1 200 OK
Content-Type: text/turtle; charset=UTF-8
Link: <http://www.w3.org/ns/ldp#BasicContainer>; rel='type',
<http://www.w3.org/ns/ldp#Resource>; rel='type’
ETag: W/'123456711'
Allow: OPTIONS, HEAD, GET, POST
Accept-Post: text/turtle, application/ld+json
Accept-Patch: text/ldpatch
Content-Length: 250
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix dc: <http://purl.org/dc/terms/> .
@prefix dc: <http://example.org/vocab#> .
<http://example.org/contacts/> a ex:AddressBook, ldp:BasicContainer;
foaf:primaryTopic <http://example.org/alice>;
ldp:contains <bob>, <jim> .
Hypermedia controls
15Nandana Mihindukulasooriya, OEG
http://www.teresacommunicates.com/wp-content/uploads/2014/01/i-can-do-this.jpg
LDP Container - GET
16Nandana Mihindukulasooriya, OEG
GET /alice/contacts/ HTTP/1.1
Host: example.org
Accept: application/vnd.ldp.addressbook+turtle
HTTP/1.1 200 OK
Content-Type: application/vnd.ldp.addressbook+turtle; charset=UTF-8
Link: <http://www.w3.org/ns/ldp#BasicContainer>; rel='type',
<http://www.w3.org/ns/ldp#Resource>; rel='type’
ETag: W/'123456711'
Allow: OPTIONS, HEAD, GET, POST
Accept-Post: application/vnd.ldp.contact+turtle;
Accept-Patch: text/ldpatch
Content-Length: 250
@prefix ldp: <http://xmlns.com/foaf/0.1/> .
@prefix dc: <http://purl.org/dc/terms/> .
@prefix dc: <http://example.org/vocab#> .
<http://example.org/contacts/> a ex:AddressBook, ldp:BasicContainer;
foaf:primaryTopic <http://example.org/alice>;
ldp:contains <bob>, <jim> .
LDP Container V1 - GET
17Nandana Mihindukulasooriya, OEG
GET /alice/contacts/ HTTP/1.1
Host: example.org
Accept: application/vnd.ldp.addressbook.v1+turtle
HTTP/1.1 200 OK
Content-Type: application/vnd.ldp.addressbook.v1+turtle; charset=UTF-8
Link: <http://www.w3.org/ns/ldp#BasicContainer>; rel='type',
<http://www.w3.org/ns/ldp#Resource>; rel='type’
ETag: W/'123456711'
Allow: OPTIONS, HEAD, GET, POST
Accept-Post: application/vnd.ldp.contact.v1+turtle;
Accept-Patch: text/ldpatch
Content-Length: 250
@prefix ldp: <http://xmlns.com/foaf/0.1/> .
@prefix dc: <http://purl.org/dc/terms/> .
@prefix dc: <http://example.org/vocab#> .
<http://example.org/contacts/> a ex:AddressBook, ldp:BasicContainer;
foaf:primaryTopic <http://example.org/alice>;
ldp:contains <bob>, <jim> .
18Nandana Mihindukulasooriya, OEG
Hydra Core Vocabulary
19Nandana Mihindukulasooriya, OEG
LDP Container – GET /w Hydra API Link relation
20Nandana Mihindukulasooriya, OEG
HTTP/1.1 200 OK
Content-Type: text/turtle; charset=UTF-8
Link: <http://www.w3.org/ns/ldp#BasicContainer>; rel=“type”,
<http://www.w3.org/ns/ldp#Resource>; rel=“type”
Link: <http://example.com/doc/>;
rel="http://www.w3.org/ns/hydra/core#apiDocumentation"
ETag: W/'123456711'
Allow: OPTIONS, HEAD, GET, POST
Accept-Post: text/turtle, application/ld+json
Accept-Patch: text/ldpatch
Content-Length: 250
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix dc: <http://purl.org/dc/terms/> .
<http://example.org/contacts/> a ldp:BasicContainer;
foaf:primaryTopic <http://example.org/alice>;
ldp:contains <bob>, <jim> .
API Documentation
21Nandana Mihindukulasooriya, OEG
{
"@context": [
"http://www.w3.org/ns/hydra/context.jsonld",
{…}
],
"@id": "http://example.org/docs/",
"@type": "ApiDocumentation",
"title": "LDP Address Book API",
"entrypoint": "http://example.org/contacts/",
"supportedClass": [
{
"@id": "ex:AddressBook",
"@type": "hydra:Class",
"subClassOf": "ldp:BasicContainer",
"label": "An example address book",
…
},
….
],
…
API Documentation
22Nandana Mihindukulasooriya, OEG
{
"supportedClass": [
{
"@id": "ex:AddressBook",
"@type": "hydra:Class",
"subClassOf": "ldp:BasicContainer",
"label": "An example address book",
"supportedOperation": [
{
"@id": "_:create_new_contact",
"@type": "hydra:Operation",
"method": "POST",
"label": "creates a new contact in the address book",
"description": null,
"expects": “ex:Contact",
"returns": null,
"statusCodes": [
…
]
},
API Documentation
23Nandana Mihindukulasooriya, OEG
{
"supportedClass": [
{
"@id": "ex:AddressBook",
"@type": "hydra:Class",
"subClassOf": "ldp:BasicContainer",
"label": "An example address book",
"supportedOperation": [
{
"@id": "_:create_new_contact",
"@type": "hydra:Operation",
"method": "POST",
"label": "creates a new contact in the address book",
"description": null,
"expects": “ex:Contact",
"returns": null,
"statusCodes": [
…
]
},
API Documentation
24Nandana Mihindukulasooriya, OEG
{
"supportedClass": [
…..
{
"@id": "ex:Contact",
"@type": "hydra:Class",
"subClassOf": “vcard:Individual",
"label": “A contact",
" supportedProperty": [
{
"property": “vcard:hasEmail",
"hydra:title": “Email”,
"hydra:description": “Email of the contact",
"required": true,
"readable": true,
"writable": false,
},
Potential Conflicts
• Similar concepts in LDP and Hydra
• LDP Containers Vs Hydra Collections
• LDP Paging Vs Hydra Paged Collections
25Nandana Mihindukulasooriya, OEG
Collections vs Containers
26Nandana Mihindukulasooriya, OEG
@prefix hydra: <http://www.w3.org/ns/hydra/core#>
<http://example.org/alice/contacts> a hydra:Collection ;
hydra:member <http://example.org/alice/contacts/bob>,
<http://example.org/alice/contacts/jane> .
• Hydra Collection
• LDP Container
@prefix ldp: <http://www.w3.org/ns/ldp#> .
<http://example.org/alice/contacts> a ldp:BasicContainer ;
ldp:contains <http://example.org/alice/contacts/bob>,
<http://example.org/alice/contacts/jane> .
Hydra collection as an LDP Direct Container
27Nandana Mihindukulasooriya, OEG
@prefix hydra: <http://www.w3.org/ns/hydra/core#> .
@prefix ldp: <http://www.w3.org/ns/ldp#> .
<http://example.org/alice/contacts> a hydra:Collection, ldp:DirectContainer;
ldp:membershipResource <>;
ldp:hasMemberRelation hydra:member;
ldp:contains <http://example.org/alice/contacts/bob>,
<http://example.org/alice/contacts/jane> ;
hydra:member <http://example.org/alice/contacts/bob>,
<http://example.org/alice/contacts/jane> ;
LDP Paging
28Nandana Mihindukulasooriya, OEG
GET /nandana?page2 HTTP/1.1
Host: example.org
Accept: text/turtle
Prefer: return=representation; max-triple-count="500"
HTTP/1.1 200 OK
Content-Type: text/turtle
ETag: "_87e52ce291112"
Link: <http://www.w3.org/ns/ldp#Resource>; rel="type",
<http://www.w3.org/ns/ldp#Page>; rel="type"
Link: <http://example.org/alice/contacts?p=3>; rel="next"
Link: <http://example.org/alice/contacts>; rel="canonical"; etag="_87e5"
Link: <http://example.org/alice/contacts?page1>; rel="first"
Link: <http://example.org/alice/contacts?p=4>; rel="last"
Link: <http://example.org/alice/contacts?page1>; rel="prev"
Allow: GET,OPTIONS,HEAD
Hydra PagedCollection
29Nandana Mihindukulasooriya, OEG
@prefix hydra: <http://www.w3.org/ns/hydra/core#> .
@prefix ldp: <http://www.w3.org/ns/ldp#> .
{
"@context": "http://www.w3.org/ns/hydra/context.jsonld",
"@id": "http://example.org/alice/contacts?page=3",
"@type": "PagedCollection",
"totalItems": “50",
"itemsPerPage": "10",
"firstPage": "http://example.org/alice/contacts?page=1",
"nextPage": " http://example.org/alice/contacts?page=4",
"previousPage": "http://example.org/alice/contacts?page=2",
"lastPage": "http://example.org/alice/contacts?page=5",
"member": [
... the members of this PagedCollection ...
]
}
Conclusions
• LDP needs mechanisms for vocabulary and
affordance discovery
• Hydra Core vocabulary can be used describe LDP
application
• Why not just Hydra?
• There are overlaps in some areas
• Overlaps with the W3C RDF Shapes WG
30Nandana Mihindukulasooriya, OEG

Describing LDP Applications with the Hydra Core Vocabulary

  • 1.
    Describing LDP Applications withthe Hydra Core Vocabulary Nandana Mihindukulasooriya, and Raúl García-Castro Ontology Engineering Group (OEG) Facultad de Informática Universidad Politécnica de Madrid
  • 2.
    Linked Data Platform1.0 2Nandana Mihindukulasooriya, OEG
  • 3.
    An example application 3NandanaMihindukulasooriya, OEG • An address book – for managing contacts • Contacts • Create, List, Update, Delete • User • Retrieve Alice <<user>> Alice’s Address Book Alice’s Contacts
  • 4.
    Address Book 4Nandana Mihindukulasooriya,OEG Address Book Application Address Book Client
  • 5.
    Domain Model 5Nandana Mihindukulasooriya,OEG AddressBook Contact •email •fullName •telephone •url User •name •title Schema Restrictions • Data types • Cardinalities
  • 6.
    LDP Model 6Nandana Mihindukulasooriya,OEG «BasicContainer» AddressBook /{personId}/contacts/ «LDPResource» Contact ldp:contains /{personId}/contacts/{contactId} «LDPResource» User /{personId}/ foaf: primaryTopic vcard:Email vcard:Voice rdfs:Resource vcard:hasURL xsd:string vcard:hasEmail vcard:hasTelephone vcard:fn xsd:string foaf:name
  • 7.
    Application 7Nandana Mihindukulasooriya, OEG AddressBook Application Address Book Client
  • 8.
    LDP Container -GET 8Nandana Mihindukulasooriya, OEG GET /alice/contacts/ HTTP/1.1 Host: example.org Accept: text/turtle HTTP/1.1 200 OK Content-Type: text/turtle; charset=UTF-8 Link: <http://www.w3.org/ns/ldp#BasicContainer>; rel='type', <http://www.w3.org/ns/ldp#Resource>; rel='type’ ETag: W/'123456711' Allow: OPTIONS, HEAD, GET, POST Accept-Post: text/turtle, application/ld+json Content-Length: 250 @prefix ldp: <http://www.w3.org/ns/ldp#> . @prefix dc: <http://purl.org/dc/terms/> . @prefix dc: <http://example.org/vocab#> . <http://example.org/contacts/> a ex:AddressBook, ldp:BasicContainer; foaf:primaryTopic <http://example.org/alice>; ldp:contains <bob>, <jim> .
  • 9.
    LDP Container -GET 9Nandana Mihindukulasooriya, OEG GET /alice/contacts/ HTTP/1.1 Host: example.org Accept: text/turtle HTTP/1.1 200 OK Content-Type: text/turtle; charset=UTF-8 Link: <http://www.w3.org/ns/ldp#BasicContainer>; rel='type', <http://www.w3.org/ns/ldp#Resource>; rel='type’ ETag: W/'123456711' Allow: OPTIONS, HEAD, GET, POST Accept-Post: text/turtle Content-Length: 250 @prefix ldp: <http://www.w3.org/ns/ldp#> . @prefix dc: <http://purl.org/dc/terms/> . @prefix dc: <http://example.org/vocab#> . <http://example.org/contacts/> a ex:AddressBook, ldp:BasicContainer; foaf:primaryTopic <http://example.org/alice>; ldp:contains <bob>, <jim> . supports LDP Basic Container interactions
  • 10.
    LDP Container -GET 10Nandana Mihindukulasooriya, OEG GET /alice/contacts/ HTTP/1.1 Host: example.org Accept: text/turtle HTTP/1.1 200 OK Content-Type: text/turtle; charset=UTF-8 Link: <http://www.w3.org/ns/ldp#BasicContainer>; rel='type', <http://www.w3.org/ns/ldp#Resource>; rel='type’ ETag: W/'123456711' Allow: OPTIONS, HEAD, GET, POST Accept-Post: text/turtle, application/ld+json Content-Length: 250 @prefix ldp: <http://www.w3.org/ns/ldp#> . @prefix dc: <http://purl.org/dc/terms/> . @prefix dc: <http://example.org/vocab#> . <http://example.org/contacts/> a ex:AddressBook, ldp:BasicContainer; foaf:primaryTopic <http://example.org/alice>; ldp:contains <bob>, <jim> . supports the mentioned HTTP operations on this resource
  • 11.
    LDP Container -GET 11Nandana Mihindukulasooriya, OEG GET /alice/contacts/ HTTP/1.1 Host: example.org Accept: text/turtle HTTP/1.1 200 OK Content-Type: text/turtle; charset=UTF-8 Link: <http://www.w3.org/ns/ldp#BasicContainer>; rel='type', <http://www.w3.org/ns/ldp#Resource>; rel='type’ ETag: W/'123456711' Allow: OPTIONS, HEAD, GET, POST Accept-Post: text/turtle, application/ld+json Content-Length: 250 @prefix ldp: <http://www.w3.org/ns/ldp#> . @prefix dc: <http://purl.org/dc/terms/> . @prefix dc: <http://example.org/vocab#> . <http://example.org/contacts/> a ex:AddressBook, ldp:BasicContainer; foaf:primaryTopic <http://example.org/alice>; ldp:contains <bob>, <jim> . Turtle and JSON-LD media types are accepted on POST
  • 12.
  • 13.
    LDP Container -POST 13Nandana Mihindukulasooriya, OEG POST /nandana/contacts/ HTTP/1.1 Host: example.org Slug: jane Link: <http://www.w3.org/ns/ldp#Resource>; rel='type' Content-Type: text/turtle @prefix vcard: <http://www.w3.org/2006/vcard/ns#> . < > a ex:Contact, vcard:Individual; vcard:hasURL <http://example.org/jane#me> ; vcard:hasEmail <mailto:jane@example.com>; vcard:fn “Jane Doe"; vcard:hasTelephone [ a vcard:Home, vcard:Voice; vcard:hasValue <tel:+34655555555> ] . expected Input (vocabulary, cardinalities) supports Slug header
  • 14.
    LDP Container -GET 14Nandana Mihindukulasooriya, OEG GET /alice/contacts/ HTTP/1.1 Host: example.org Accept: text/turtle HTTP/1.1 200 OK Content-Type: text/turtle; charset=UTF-8 Link: <http://www.w3.org/ns/ldp#BasicContainer>; rel='type', <http://www.w3.org/ns/ldp#Resource>; rel='type’ ETag: W/'123456711' Allow: OPTIONS, HEAD, GET, POST Accept-Post: text/turtle, application/ld+json Accept-Patch: text/ldpatch Content-Length: 250 @prefix ldp: <http://www.w3.org/ns/ldp#> . @prefix dc: <http://purl.org/dc/terms/> . @prefix dc: <http://example.org/vocab#> . <http://example.org/contacts/> a ex:AddressBook, ldp:BasicContainer; foaf:primaryTopic <http://example.org/alice>; ldp:contains <bob>, <jim> . Hypermedia controls
  • 15.
  • 16.
    LDP Container -GET 16Nandana Mihindukulasooriya, OEG GET /alice/contacts/ HTTP/1.1 Host: example.org Accept: application/vnd.ldp.addressbook+turtle HTTP/1.1 200 OK Content-Type: application/vnd.ldp.addressbook+turtle; charset=UTF-8 Link: <http://www.w3.org/ns/ldp#BasicContainer>; rel='type', <http://www.w3.org/ns/ldp#Resource>; rel='type’ ETag: W/'123456711' Allow: OPTIONS, HEAD, GET, POST Accept-Post: application/vnd.ldp.contact+turtle; Accept-Patch: text/ldpatch Content-Length: 250 @prefix ldp: <http://xmlns.com/foaf/0.1/> . @prefix dc: <http://purl.org/dc/terms/> . @prefix dc: <http://example.org/vocab#> . <http://example.org/contacts/> a ex:AddressBook, ldp:BasicContainer; foaf:primaryTopic <http://example.org/alice>; ldp:contains <bob>, <jim> .
  • 17.
    LDP Container V1- GET 17Nandana Mihindukulasooriya, OEG GET /alice/contacts/ HTTP/1.1 Host: example.org Accept: application/vnd.ldp.addressbook.v1+turtle HTTP/1.1 200 OK Content-Type: application/vnd.ldp.addressbook.v1+turtle; charset=UTF-8 Link: <http://www.w3.org/ns/ldp#BasicContainer>; rel='type', <http://www.w3.org/ns/ldp#Resource>; rel='type’ ETag: W/'123456711' Allow: OPTIONS, HEAD, GET, POST Accept-Post: application/vnd.ldp.contact.v1+turtle; Accept-Patch: text/ldpatch Content-Length: 250 @prefix ldp: <http://xmlns.com/foaf/0.1/> . @prefix dc: <http://purl.org/dc/terms/> . @prefix dc: <http://example.org/vocab#> . <http://example.org/contacts/> a ex:AddressBook, ldp:BasicContainer; foaf:primaryTopic <http://example.org/alice>; ldp:contains <bob>, <jim> .
  • 18.
  • 19.
    Hydra Core Vocabulary 19NandanaMihindukulasooriya, OEG
  • 20.
    LDP Container –GET /w Hydra API Link relation 20Nandana Mihindukulasooriya, OEG HTTP/1.1 200 OK Content-Type: text/turtle; charset=UTF-8 Link: <http://www.w3.org/ns/ldp#BasicContainer>; rel=“type”, <http://www.w3.org/ns/ldp#Resource>; rel=“type” Link: <http://example.com/doc/>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation" ETag: W/'123456711' Allow: OPTIONS, HEAD, GET, POST Accept-Post: text/turtle, application/ld+json Accept-Patch: text/ldpatch Content-Length: 250 @prefix ldp: <http://www.w3.org/ns/ldp#> . @prefix dc: <http://purl.org/dc/terms/> . <http://example.org/contacts/> a ldp:BasicContainer; foaf:primaryTopic <http://example.org/alice>; ldp:contains <bob>, <jim> .
  • 21.
    API Documentation 21Nandana Mihindukulasooriya,OEG { "@context": [ "http://www.w3.org/ns/hydra/context.jsonld", {…} ], "@id": "http://example.org/docs/", "@type": "ApiDocumentation", "title": "LDP Address Book API", "entrypoint": "http://example.org/contacts/", "supportedClass": [ { "@id": "ex:AddressBook", "@type": "hydra:Class", "subClassOf": "ldp:BasicContainer", "label": "An example address book", … }, …. ], …
  • 22.
    API Documentation 22Nandana Mihindukulasooriya,OEG { "supportedClass": [ { "@id": "ex:AddressBook", "@type": "hydra:Class", "subClassOf": "ldp:BasicContainer", "label": "An example address book", "supportedOperation": [ { "@id": "_:create_new_contact", "@type": "hydra:Operation", "method": "POST", "label": "creates a new contact in the address book", "description": null, "expects": “ex:Contact", "returns": null, "statusCodes": [ … ] },
  • 23.
    API Documentation 23Nandana Mihindukulasooriya,OEG { "supportedClass": [ { "@id": "ex:AddressBook", "@type": "hydra:Class", "subClassOf": "ldp:BasicContainer", "label": "An example address book", "supportedOperation": [ { "@id": "_:create_new_contact", "@type": "hydra:Operation", "method": "POST", "label": "creates a new contact in the address book", "description": null, "expects": “ex:Contact", "returns": null, "statusCodes": [ … ] },
  • 24.
    API Documentation 24Nandana Mihindukulasooriya,OEG { "supportedClass": [ ….. { "@id": "ex:Contact", "@type": "hydra:Class", "subClassOf": “vcard:Individual", "label": “A contact", " supportedProperty": [ { "property": “vcard:hasEmail", "hydra:title": “Email”, "hydra:description": “Email of the contact", "required": true, "readable": true, "writable": false, },
  • 25.
    Potential Conflicts • Similarconcepts in LDP and Hydra • LDP Containers Vs Hydra Collections • LDP Paging Vs Hydra Paged Collections 25Nandana Mihindukulasooriya, OEG
  • 26.
    Collections vs Containers 26NandanaMihindukulasooriya, OEG @prefix hydra: <http://www.w3.org/ns/hydra/core#> <http://example.org/alice/contacts> a hydra:Collection ; hydra:member <http://example.org/alice/contacts/bob>, <http://example.org/alice/contacts/jane> . • Hydra Collection • LDP Container @prefix ldp: <http://www.w3.org/ns/ldp#> . <http://example.org/alice/contacts> a ldp:BasicContainer ; ldp:contains <http://example.org/alice/contacts/bob>, <http://example.org/alice/contacts/jane> .
  • 27.
    Hydra collection asan LDP Direct Container 27Nandana Mihindukulasooriya, OEG @prefix hydra: <http://www.w3.org/ns/hydra/core#> . @prefix ldp: <http://www.w3.org/ns/ldp#> . <http://example.org/alice/contacts> a hydra:Collection, ldp:DirectContainer; ldp:membershipResource <>; ldp:hasMemberRelation hydra:member; ldp:contains <http://example.org/alice/contacts/bob>, <http://example.org/alice/contacts/jane> ; hydra:member <http://example.org/alice/contacts/bob>, <http://example.org/alice/contacts/jane> ;
  • 28.
    LDP Paging 28Nandana Mihindukulasooriya,OEG GET /nandana?page2 HTTP/1.1 Host: example.org Accept: text/turtle Prefer: return=representation; max-triple-count="500" HTTP/1.1 200 OK Content-Type: text/turtle ETag: "_87e52ce291112" Link: <http://www.w3.org/ns/ldp#Resource>; rel="type", <http://www.w3.org/ns/ldp#Page>; rel="type" Link: <http://example.org/alice/contacts?p=3>; rel="next" Link: <http://example.org/alice/contacts>; rel="canonical"; etag="_87e5" Link: <http://example.org/alice/contacts?page1>; rel="first" Link: <http://example.org/alice/contacts?p=4>; rel="last" Link: <http://example.org/alice/contacts?page1>; rel="prev" Allow: GET,OPTIONS,HEAD
  • 29.
    Hydra PagedCollection 29Nandana Mihindukulasooriya,OEG @prefix hydra: <http://www.w3.org/ns/hydra/core#> . @prefix ldp: <http://www.w3.org/ns/ldp#> . { "@context": "http://www.w3.org/ns/hydra/context.jsonld", "@id": "http://example.org/alice/contacts?page=3", "@type": "PagedCollection", "totalItems": “50", "itemsPerPage": "10", "firstPage": "http://example.org/alice/contacts?page=1", "nextPage": " http://example.org/alice/contacts?page=4", "previousPage": "http://example.org/alice/contacts?page=2", "lastPage": "http://example.org/alice/contacts?page=5", "member": [ ... the members of this PagedCollection ... ] }
  • 30.
    Conclusions • LDP needsmechanisms for vocabulary and affordance discovery • Hydra Core vocabulary can be used describe LDP application • Why not just Hydra? • There are overlaps in some areas • Overlaps with the W3C RDF Shapes WG 30Nandana Mihindukulasooriya, OEG