Use of HTTP to Create, Read, Update, and Delete Linked Data Resources (Documents) that are part of a collection (folder). Naturally, this kind of task posses the following questions and associated challenges:
POST
my resource member or container creation requests? GET
(retrieve) a list of existing member resources associated with a container? GET
retrieve resources that are members of a large container, using paging? The Linked Data Platform (LDP) was developed by W3C members to answer many of these questions.
It formalizes Linked Data deployment and use by standardizing the representation and behavior of, and the generation and processing of HTTP requests regarding, Linked Data Platform Resources (LDPRs) and Linked Data Platform Containers (LDPCs). Using the Linked Data Platform thereby increases availability and accessibility of Linked Data on the Web.
Virtuoso's LDP functionality is a built-in, integral part of the product.
Virtuoso operates as an LDP Client, generating HTTP requests and processing HTTP responses that conform to the rules defined for LDPRs and LDPCs, when it is operating against LDP Servers.
Virtuoso also operates as an LDP Server, by processing HTTP requests and generating HTTP responses that conform to the rules defined for LDPRs and LDPCs.
The following examples use the commandline utility curl
to demonstrate Virtuoso's LDP Server implementation.
One could use the following options to enable LDP on a given folder/collection of resources:
http://host:port/conductor
and go to "Web Application Server" -> "Content Management": LDP
; ldp:BasicContainer?
; http://host:port/ods
and after providing your user credentials, go to Briefcase: LDP
; ldp:BasicContainer?
;
DB.DBA.DAV_PROP_SET ('/DAV/ldp/', 'LDP', 'ldp:BasicContainer', 'dav','dav', 1);
This content is not Turtle.
" in this example) to a text file ("test2.txt
") in DAV.
% curl --verbose -iX PUT -H "Content-Type: text/plain" -u dav:dav -d 'This content is not Turtle.' "http://example.com/DAV/test2.txt" > ldp/ldp1.log
HTTP/1.1 201 Created Server: Virtuoso/06.04.3137 (Linux) x86_64-unknown-linux-gnu VDB Connection: close Date: Fri, 26 Jul 2013 11:59:52 GMT Accept-Ranges: bytes Content-Type: text/plain Link: <>;rel=<http://www.w3.org/ns/ldp/Resource> Content-Length: 172 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <HTML> <HEAD> <TITLE>201 Created</TITLE> </HEAD> <BODY> <H1>Created</H1>Resource /DAV/test2.txt has been created. </BODY> </HTML>
% curl --verbose -iH "Accept: text/turtle, */*;q=0.1" -u dav:dav http://example.com/DAV/test2.txt > ldp/ldp2.log
HTTP/1.1 200 OK Server: Virtuoso/06.04.3136 (Win64) x86_64-generic-win-64 VDB Connection: Keep-Alive Date: Sun, 16 Jun 2013 21:04:04 GMT Accept-Ranges: bytes Content-Type: text/turtle; charset=UTF-8 Content-Length: 472 @prefix dcterms: <http://purl.org/dc/terms/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix ldp: <http://www.w3.org/ns/ldp#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . <http://example.com/DAV/test2.txt> a dcterms:PhysicalResource ; dcterms:title "test2.txt" ; dcterms:creator "dav" ; dcterms:created "2013-06-17 03:04:04" ; dcterms:modified "2013-06-17 03:04:04" ; rdfs:label "test2.txt" .
% curl --verbose -iH "Accept: text/turtle, */*;q=0.1" -u dav:dav http://example.com/DAV/ > ldp/ldp3.log
text/turtle
of LDP data describing all Resources (both LDPRs and non LDPRs) inside the container, similar to this --
HTTP/1.1 200 OK Server: Virtuoso/06.04.3136 (Win64) x86_64-generic-win-64 VDB Connection: Keep-Alive Date: Sun, 16 Jun 2013 21:04:04 GMT Accept-Ranges: bytes Content-Type: text/turtle; chartset=UTF-8 Content-Length: 621 @prefix dcterms: <http://purl.org/dc/terms/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix ldp: <http://www.w3.org/ns/ldp#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . <http://example.com/DAV/> a ldp:Container ; dcterms:title "DAV" ; dcterms:creator "dav" ; dcterms:created "2013-06-17 01:18:23" ; dcterms:modified "2013-06-17 01:18:23" ; ldp:membershipPredicate rdfs:member ; rdfs:member <http://example.com/DAV/VAD/> ; rdfs:member <http://example.com/DAV/home/> ; rdfs:member <http://example.com/DAV/test2.txt> ; rdfs:label "DAV" .
non-member-properties
LDP data for an LDPC, such as the DAV root folder, be returned as Turtle --
% curl --verbose -iH "Accept: text/turtle, */*;q=0.1" -u dav:dav http://example.com/DAV/?non-member-properties > ldp/ldp4.log
text/turtle
containing LDP data that describes any non-LDP Resources (that is, any Resources which are not LDPRs) inside the container:
HTTP/1.1 200 OK Server: Virtuoso/06.04.3136 (Win64) x86_64-generic-win-64 VDB Connection: Keep-Alive Date: Sun, 16 Jun 2013 21:04:04 GMT Accept-Ranges: bytes Content-Type: text/turtle; chartset=UTF-8 Content-Length: 477 @prefix dcterms: <http://purl.org/dc/terms/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix ldp: <http://www.w3.org/ns/ldp#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . <http://example.com/DAV/> a ldp:Container ; dcterms:title "DAV" ; dcterms:creator "dav" ; dcterms:created "2013-06-17 01:18:23" ; dcterms:modified "2013-06-17 01:18:23" ; ldp:membershipPredicate rdfs:member ; rdfs:label "DAV" .
ldp-books.ttl, in a folder named temp
, with the following Turtle content --
@prefix : <http://example.org/book/> .
@prefix ns: <http://example.org/ns#> .
:book1 <http://purl.org/dc/elements/1.1/title> "LDP Tutorial"
; ns:price 42
; ns:discount 0.2
.
:book2 <http://purl.org/dc/elements/1.1/title> "The Semantic Web"
; ns:price 23
; ns:discount 0.25
.
% curl --verbose -iX PUT -d @temp/ldp-books.ttl -u dav:dav -H 'Content-Type: text/turtle' http://example.com/DAV/test4.ttl > ldp/ldp5.log
HTTP/1.1 201 Created Server: Virtuoso/06.04.3136 (Win64) x86_64-generic-win-64 VDB Connection: close Date: Sun, 16 Jun 2013 21:04:05 GMT Accept-Ranges: bytes Content-Type: text/turtle Link: <>;rel=<http://www.w3.org/ns/ldp/Resource> Content-Length: 172 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <HTML> <HEAD> <TITLE>201 Created</TITLE> </HEAD> <BODY> <H1>Created</H1>Resource /DAV/test4.ttl has been created. </BODY> </HTML>