%META:TOPICPARENT{name="VOSIndex"}%
---+ Using Virtuoso as LDP Client and Server
%TOC%
---++ What is the Linked Data Platform (LDP)?
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:
* Document Resource Issues
* What resource content notations and across-the-wire content serialization formats should be used?
* How is collision detection for updates handled with maximum concurrent (i.e. optimistically)?
* How do client handle changes to associated resources, such as content type changes?
* How servers ease the burden of constraints associated with resource creation?
* Container/Folder Resource Issues
* To which address/location (URL) on an HTTP network can I POST
my resource member or container creation requests?
* How do I GET
(retrieve) a list of existing member resources associated with a container?
* How is container ordering of member resources expressed and represented?
* How do I obtain metadata about the resources that are members of a container, and the container resource itself?
* How do I GET
retrieve resources that are members of a large container, using paging?
* How do I deal with metadata querying scoped to member resources and container resources?
The [[http://www.w3.org/TR/ldp/][Linked Data Platform (LDP)]] was developed by W3C members to answer many of these questions.
---++ Why is the LDP important?
It formalizes Linked Data deployment and use by standardizing the representation and behavior of, and the generation
and processing of HTTP requests regarding, [[http://www.w3.org/TR/ldp/#linked-data-platform-resources][Linked Data Platform Resources]]
(LDPRs) and [[http://www.w3.org/TR/ldp/#linked-data-platform-containers][Linked Data Platform Containers]] (LDPCs). Using the Linked
Data Platform thereby increases availability and accessibility of Linked Data on the Web.
--++ How to use Virtuoso's LDP features
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.
---+++ Example 1: How to enable LDP on a folder/collection
One could use the following options to enable LDP on a given folder/collection of resources:
1 Via Conductor as a property 'LDP' on the given folder designated as root for LDP:
1 Log in at http://host:port/conductor
and go to "Web Application Server" -> "Content Management":
%BR%%BR%%BR%%BR%
1 Provide location path for the destination folder/collection to be LDP enabled, in our example we will enable user's "demo" "Public" folder:
%BR%%BR%%BR%%BR%
1 Click in "Action" column the "Updated properties" button:
%BR%%BR%%BR%%BR%
1 In the presented form click "Add" button in the "WebDAV" section and enter respectively:
* for "Property": LDP
;
* for "Value": ldp:BasicContainer
;
%BR%%BR%%BR%%BR%
1 Finally click "Update".
1 Via [[http://ods.openlinksw.com/dataspace/dav/wiki/ODS/OdsBriefcase][ODS-Briefcase]] UI:
1 Go to http://host:port/ods
and after providing your user credentials, go to Briefcase:
%BR%%BR%%BR%%BR%
1 For the folder/collection to be LDP enabled, click in its "Action" column the "Updated properties" button:
%BR%%BR%%BR%%BR%
1 In the presented form click "Add" button in the "WebDAV" section and enter respectively:
* for "Property": LDP
;
* for "Value": ldp:BasicContainer
;
%BR%%BR%%BR%%BR%
1 Finally click "Update".
1 Via command line e.g.:
DB.DBA.DAV_PROP_SET ('/DAV/ldp/', 'LDP', 'ldp:BasicContainer', 'dav','dav', 1);
---+++ Example 2: Create and verify a simple LDPR
1 Write a bit of text ("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
1 The server's response should resemble this --
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=
Content-Length: 172
201 Created
Created
Resource /DAV/test2.txt has been created.
1 Confirm that the server took the submission as LDP data --
% curl --verbose -iH "Accept: text/turtle, */*;q=0.1" -u dav:dav http://example.com/DAV/test2.txt > ldp/ldp2.log
1 The server should return a "text/turtle" LDP response 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; charset=UTF-8
Content-Length: 472
@prefix dcterms: .
@prefix rdf: .
@prefix rdfs: .
@prefix ldp: .
@prefix xsd: .
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" .
---+++ Example 3: Access Resources in an LDPC (e.g., a DAV folder)
1 Request all LDP data for an LDPC, such as the DAV root folder, to be returned as Turtle --
% curl --verbose -iH "Accept: text/turtle, */*;q=0.1" -u dav:dav http://example.com/DAV/ > ldp/ldp3.log
1 The server should return 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: .
@prefix rdf: .
@prefix rdfs: .
@prefix ldp: .
@prefix xsd: .
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 ;
rdfs:member ;
rdfs:member ;
rdfs:label "DAV" .
---+++ Example 4: Access non-LDP Resources in an LDPC (e.g., DAV folder)
1 Request that all 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
1 The server should return 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: .
@prefix rdf: .
@prefix rdfs: .
@prefix ldp: .
@prefix xsd: .
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" .
---+++ Example 5: Create an LDPR from an existing text file containing Turtle data
1 Suppose you have a file named ldp-books.ttl, in a folder named temp
, with the following
Turtle content --
@prefix : .
@prefix ns: .
:book1 "LDP Tutorial"
; ns:price 42
; ns:discount 0.2
.
:book2 "The Semantic Web"
; ns:price 23
; ns:discount 0.25
.
1 Upload the file to DAV --
% 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
1 The server's response should resemble the following --
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=
Content-Length: 172
201 Created
Created
Resource /DAV/test4.ttl has been created.
---++ Related
* [[http://www.w3.org/TR/ldp/][Linked Data Platform 1.0]]
* [[VirtGraphProtocolCURLExamples][SPARQL 1.1. Graph Store HTTP Protocol cURL Examples Collection]]
* [[VirtGraphUpdateProtocol][Manage RDF data by using SPARQL 1.1. Graph Store HTTP Protocol]]
* [[VirtRWWInteractionACLcURL][RWW Interaction & ACL Testing using cURL]]
* [[VirtuosoLDPSimpleCurlExamples][LDP in Virtuoso - Simple Curl Examples]]