Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

These examples are for a Fedora hands-on workshop and are referenced by these slides. All examples are displayed below in a curl command-line form. For those who do not have curl or prefer a graphical interface, the examples can be obtained as a JSON import file for the POSTMan REST client.

...

Linked Data Platform

Create the Pythagoras collection

Request URI: POST http://localhost:8080/rest/pythagoras

MethodCURL Command: GET

Headers:

Status
subtletrue
titleAccept
   application/ld+json, application/n-triples, application/rdf+xml, application/x-turtle, application/xhtml+xml, application/xml, text/html, text/n3, text/plain, text/rdf+n3, text/turtle

Example:

Code Block
curl "http://localhost:8080/rest/fcr:nodetypes"

Response:

Code Block
Status: 200 OK

Headers:
Accept: text/turtle


Status:

Status
subtletrue
colourGreen
title200
OK

GET Portrait Container

Code Block
curl -X POST -H "Slug: pythagoras" -H "Content-Type: text/turtle" -H "Accept: text/turtle" --data-binary "@request-body.ttl" 

...

http://localhost:8080/rest/

...

Method: GET

Status
titleGET
get a list of registered types (as RDFS triples)

Request

Request Headers:

Status
subtletrue
titleAccept
��application/ld+json, application/n-triples, application/rdf+xml, application/x-turtle, application/xhtml+xml, application/xml, text/html, text/n3, text/plain, text/rdf+n3, text/turtle

Example:

Code Block
curl "http://localhost:8080/rest/fcr:nodetypes"

Response:

Code Block
Status: 200 OK

Headers:
Accept: text/turtle


Status:


request-body.ttl

Code Block
@prefix dc: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .

<> dc:title 'Pythagoras Collection';
    dc:abstract 'A collection of materials and facts about Pythagoras' .

...

Add Pythagoras the Person

Status
subtletrue
colourGreen
title200
OK

Add Pythagoras the Person

Request URI: POST http://localhost:8080/rest/pythagoras/

Method: POST

Status
titleGET
get a list of registered types (as RDFS triples)

Request

Request Headers:

Status
subtletrue
titleAccept
��application/ld+json, application/n-triples, application/rdf+xml, application/x-turtle, application/xhtml+xml, application/xml, text/html, text/n3, text/plain, text/rdf+n3, text/turtle

Example:

Code Block
curl "http://localhost:8080/rest/fcr:nodetypes"

Response:

CURL Command:

Code Block
curl -X POST -H "Slug: person" -H "
Code Block
Status: 200 OK

Headers:
Slug: person
Link: <http://www.w3.org/ns/ldp#Resource>; rel="type""
 -H "Content-Type: text/turtle" --data-binary "@request-body.ttl" http://localhost:8080/rest/pythagoras/

request-body.ttl

Code Block



Body:
@prefix dc: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .

<> a foaf:Person;
   foaf:name 'Pythagoras' ;
   foaf:based_near "Croton" ;
   foaf:interest [ dc:title "Geometry" ] .

Status:

Status
subtletrue
colourGreen
title200
OK

POST Portrait Container

...

Get Pythagoras collection

Request URI: GET http://localhost:8080/rest/pythagoras

MethodCURL Command: POST

Status
titleGET
get a list of registered types (as RDFS triples)

Request

Request Headers:

Status
subtletrue
titleAccept
��application/ld+json, application/n-triples, application/rdf+xml, application/x-turtle, application/xhtml+xml, application/xml, text/html, text/n3, text/plain, text/rdf+n3, text/turtle

Example:

...

Code Block
curl -X GET -H "Accept: text/turtle" http://localhost:8080/rest/pythagoras

...

POST Portrait Container

...

POST

http://localhost:8080/rest/

...

pythagoras

CURL CommandResponse:

Code Block
Status: 200 OK

Headers:
curl -X POST -H "Content-Type: text/turtle
" -H "Slug: portraits" --data-binary "@request-body.ttl" http://localhost:8080/rest/pythagoras

request-body.ttl

Code Block



Body:
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .

<> a ldp:DirectContainer;
  ldp:membershipResource </rest/pythagoras/person>;
  ldp:hasMemberRelation foaf:depiction;
  dcterms:title "Portraits of Pythagoras" .

Status:

...

...

subtletrue
colourGreen
title200

...

POST a Portrait

Request URI: POST http://localhost:8080/rest/pythagoras/portraits

Method: POST

Status
titleGET
get a list of registered types (as RDFS triples)

Request

Request Headers:

Status
subtletrue
titleAccept
��application/ld+json, application/n-triples, application/rdf+xml, application/x-turtle, application/xhtml+xml, application/xml, text/html, text/n3, text/plain, text/rdf+n3, text/turtle

ExampleCURL Command:

Code Block
curl "http://localhost:8080/rest/fcr:nodetypes"

Response:

Code Block
Status: 200 OK

Headers:
-X POST -H "link: <http://www.w3.org/ns/ldp#Resource>; rel="type"" -H "
Content-Type: image/jpeg


Status:

Status
subtletrue
colourGreen
title200
OK

POST List of Pythagoras' Influences

" http://localhost:8080/rest/pythagoras/portraits

...

GET Portrait Container

Request URI: GET http://localhost:8080/rest/pythagoras/portraits

MethodCURL Command: POST

Status
titleGET
get a list of registered types (as RDFS triples)

Request

Request Headers:

Status
subtletrue
titleAccept
��application/ld+json, application/n-triples, application/rdf+xml, application/x-turtle, application/xhtml+xml, application/xml, text/html, text/n3, text/plain, text/rdf+n3, text/turtle

Example:

Code Block
curl -X GET -H "Accept: text/turtle" http://localhost:8080/rest/pythagoras/portraits

...

GET Pythagoras Person

GET http://localhost:8080/rest/pythagoras/person

CURL Command:

Code Block
curl -X GET -H "Accept: text/turtle" 
Code Block
curl "http://localhost:8080/rest/fcr:nodetypes"/pythagoras/person

...

POST List of Pythagoras' Influences

POST http://localhost:8080/rest/pythagoras/

CURL CommandResponse:

Code Block
Status: 200 OK

Headers:
curl -X POST -H "Content-Type: text/turtle
" -H "Slug: influences" --data-binary "@request-body.ttl" http://localhost:8080/rest/pythagoras/

request-body.ttl

Code Block



Body:
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix ph: <http://example.org/vocab/philosophy#> .

<> a ldp:IndirectContainer;
  ldp:membershipResource <http://localhost:8080/rest/pythagoras/person>;
  ldp:hasMemberRelation foaf:knows;
  ldp:insertedContentRelation foaf:primaryTopic;
  dcterms:title "List of People that Influenced Pythagoras" .

Status:

Status
subtletrue
colourGreen
title200
OK

GET Pythagoras Person

...

Add Thales as Influence

Request URI: POST http://localhost:8080/rest/pythagoras/person

Method: GET

Status
titleGET
get a list of registered types (as RDFS triples)

Request

Request Headers:

Status
subtletrue
titleAccept
��application/ld+json, application/n-triples, application/rdf+xml, application/x-turtle, application/xhtml+xml, application/xml, text/html, text/n3, text/plain, text/rdf+n3, text/turtle

influences/

CURL CommandExample:

Code Block
curl "http://localhost:8080/rest/fcr:nodetypes"

Response:

Code Block
Status: 200 OK

Headers:
Accept: text/turtle


Status:

Status
subtletrue
colourGreen
title200
OK

Add Thales as Influence

...

-X POST -H "Slug: thales" -H "Content-Type: text/turtle" --data-binary "@request-body.ttl" http://localhost:8080/rest/pythagoras/influences/

...


request-body.ttl

Code Block

Method: POST

Status
titleGET
get a list of registered types (as RDFS triples)

Request

Request Headers:

Status
subtletrue
titleAccept
��application/ld+json, application/n-triples, application/rdf+xml, application/x-turtle, application/xhtml+xml, application/xml, text/html, text/n3, text/plain, text/rdf+n3, text/turtle

Example:

Code Block
curl "http://localhost:8080/rest/fcr:nodetypes"

Response:

Code Block
Status: 200 OK

Headers:
Slug: thales
Content-Type: text/turtle


Body:
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .

<> dcterms:title "Thales";
   foaf:primaryTopic <http://en.wikipedia.org/wiki/Thales> .

Status:

Status
subtletrue
colourGreen
title200

...

GET List of Influences

GET http://localhost:8080/rest/pythagoras/influences

CURL Command:

Code Block
curl -X GET -H "Accept: text/turtle" --data-binary "@request-body.ttl" http://localhost:8080/rest/pythagoras/influences

request-body.ttl

Code Block