%META:TOPICPARENT{name="VirtLDP"}%
---+ RWW Interaction & ACL Testing using cURL
%TOC%
---++ What?
The [[http://www.w3.org/TR/ldp/][Linked Data Platform (LDP) specification]] from the W3C outlines how
HTTP interaction patterns can be used to facilitate loosely coupled Create, Read, Update (Write), and
Delete ("CRUD") operations, at World Wide Web scale.
---++ Why?
The "Write" dimension of the World Wide Web has been underutilized since the Web's inception. This has
lead to a proliferation of Web Applications and Services that confusingly conflate otherwise distinct
functionality realms in the way they work with entities, both "real world" and digital, and their --
* Identity (Denotation)
* Identification (Connotation)
* Verification of Identity Claims (Authentication)
* Identity-Driven Access Control & Privileges over Protected Resources
* Identity-Driven Webs of Trust
---++ How?
---+++ Different File Usage
---++++ 1: PKCS 12 File Usage
curl --cert {pkcs#12-file-name}:{pwd} --cert-type P12 -k -I {resource-url}
---++++ 2: Secure PEM File Usage
curl --cert {cert-pem-file-name} --key {private-key-pem-file-name} -k -I {resource-url}
---+++ LDP QA
---++++ 1: Basic Metadata Interrogation
curl -X OPTIONS -IH "Accept: text/turtle" http://example.com/DAV/home/demo/Public/
---++++ 2: Basic Metadata and Content Interrogation
curl -iH "Accept: text/turtle" http://example.com/DAV/home/demo/Public/
---++++ 3: INSERT via POST with Slug header
curl -X POST -ik -H "Content-Type:text/turtle" -E MyCertificate-ODS-QA.pem:1234 --data-binary @profile2.ttl -H "Slug: profile2.ttl" https://example.com/DAV/home/demo/Public/
---++++ 4: INSERT via POST without Slug header
curl -X POST -ik -H "Content-Type:text/turtle" -E MyCertificate-ODS-QA.pem:1234 --data-binary @profile2.ttl https://example.com/DAV/home/demo/Public/
---++++ 5: INSERT via Inline Data without Slug header
curl -X POST -ik -H "Content-Type:text/turtle" -E MyCertificate-ODS-QA.pem:1234 --data-binary "<> a foaf:Document" https://example.com/DAV/home/demo/Public/
---++++ 6: Collection (Folder) Creation
* Local data in ldp_container.ttl
@prefix ldp: .
@prefix dcterms: .
<> a ldp:Container
, ldp:BasicContainer
; dcterms:title "Sample Folder"
; dcterms:description "Sample Folder created using LDP."
.
* Request:
curl -k -i -E MyCertificate-ODS-QA.pem:1234 https://example.com/DAV/home/demo/Public/ -H "Content-Type: text/turtle" -X POST -H "Slug: ldp_container" --data-binary @ldp_container.ttl
* Response:
HTTP/1.1 201 Created
Server: Virtuoso/07.10.3211 (Linux) x86_64-redhat-linux-gnu-LDP VDB
Connection: Keep-Alive
Date: Mon, 07 Jul 2014 12:54:32 GMT
Accept-Ranges: bytes
Location: https://example.com/DAV/home/demo/Public/ldp_container
Link: ; rel="type"
Content-Type: text/turtle
Content-Length: 196
201 Created
Created
Resource /DAV/home/demo/Public/ldp_container has been created.
---++++ 7: Without Slug
curl -k -i -E MyCertificate-ODS-QA.pem:king6c/ -H "Content-Type: text/turtle" -X POST --data-binary @ldp_container.ttl
---+++ Methods
---++++ PUT Method
To replace the content of the Document
at <https://example.com/DAV/home/demo/Public/example.ttl>
with "<#this> <#relation> <#that> ."
* Request:
curl -X PUT -kv -i -H "Content-Type:text/turtle" -E MyCertificate-ODS-QA.pem:1234 --data-binary "<#this> <#relation> <#that> ." https://example.com/DAV/home/demo/Public/example.ttl
* Response:
HTTP/1.1 201 Created
Server: Virtuoso/07.10.3211 (Linux) x86_64-redhat-linux-gnu-LDP VDB
Connection: close
Date: Thu, 03 Jul 2014 19:56:45 GMT
Accept-Ranges: bytes
Link: ; rel="type"
Content-Type: text/turtle
Content-Length: 194
---++++ PUT Method for creating a remote document from a local document
curl -X PUT -k -i -E MyCertificate-ODS-QA.pem:1234 -H "Content-Type: text/turtle" -data-binary @test.ttl https://example.com/DAV/home/demo/Public/
---++++ MKCOL Method
curl -X MKCOL -k -i -E MyCertificate-ODS-QA.pem:1234 https://example.com/DAV/home/demo/Public/container2/
---++++ HTTP PATCH method for SPARQL 1.1 INSERT
* Request:
curl -E MyCertificate-ODS-QA.pem:1234 -X PATCH -k -i --data-binary "INSERT {GRAPH { a . } }" -H "Content-Type: application/sparql-update; utf-8" https://example.com/DAV/home/demo/Public/example2.ttl
* Response:
HTTP/1.1 204 No Content
Server: Virtuoso/07.10.3211 (Linux) x86_64-redhat-linux-gnu-LDP VDB
Connection: Keep-Alive
Date: Fri, 04 Jul 2014 17:18:16 GMT
Accept-Ranges: bytes
X-SPARQL-default-graph: http://example.com/DAV/home/demo/Public/example2.ttl
Content-Type: application/sparql-results+xml; charset=UTF-8
Content-Length: 444
---++++ HTTP POST method for SPARQL SELECT
* Request:
curl -E MyCertificate-ODS-QA.pem:1234 -X POST -ik --data-binary "SELECT * FROM WHERE {?s ?p ?o}" -H "Content-Type: application/sparql-query" "https://example.com/sparql"
* Response:
HTTP/1.1 200 OK
Server: Virtuoso/07.10.3211 (Linux) x86_64-redhat-linux-gnu-LDP VDB
Connection: Keep-Alive
Date: Fri, 04 Jul 2014 17:31:38 GMT
Accept-Ranges: bytes
X-SPARQL-default-graph: http://example.com/DAV/VAD/val/sparql/
Content-Type: application/sparql-results+xml; charset=UTF-8
Content-Length: 792
http://example.com/dataspace/person/demo#this
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
http://xmlns.com/foaf/0.1/Person
#this
#relation
#that
---++ Related
* [[VirtuosoLDPSimpleCurlExamples][Virtuoso LDP Simple Curl Examples Collection]]