Skip to main content

LDP

RESTful Linked Data. W3C standard for managing RDF resources via HTTP.

Overview​

The Linked Data Platform (LDP) is a W3C Recommendation that defines how to read and write Linked Data using standard HTTP operations. It's the foundation that Solid builds upon.

Key Concepts​

Resources and Containers​

┌─────────────────────────────────────────────────────────────────┐
│ LDP Concepts │
├─────────────────────────────────────────────────────────────────┤
│ │
│ LDP Resource (LDP-RS) │
│ └── Any resource with RDF content │
│ └── GET returns RDF (Turtle, JSON-LD, etc.) │
│ │
│ LDP Non-RDF Resource (LDP-NR) │
│ └── Binary or non-RDF content │
│ └── GET returns the actual bytes │
│ └── Has associated RDF description │
│ │
│ LDP Container (LDP-C) │
│ └── Collection of resources (like a folder) │
│ └── POST creates new children │
│ └── Contains membership triples │
│ │
└─────────────────────────────────────────────────────────────────┘

Container Types​

TypeDescription
Basic ContainerSimple containment
Direct ContainerCustom membership predicates
Indirect ContainerMembership via derived URIs

HTTP Operations​

CRUD Mapping​

OperationHTTP MethodDescription
Create (in container)POSTAdd new resource to container
Create (at URL)PUTCreate resource at specific URL
ReadGETRetrieve resource
Update (replace)PUTReplace entire resource
Update (partial)PATCHModify parts of resource
DeleteDELETERemove resource

Examples​

Read a Resource​

GET /alice/profile HTTP/1.1
Host: pod.example
Accept: text/turtle

HTTP/1.1 200 OK
Content-Type: text/turtle

@prefix foaf: <http://xmlns.com/foaf/0.1/> .

<#me> a foaf:Person ;
foaf:name "Alice" .

Create in Container​

POST /alice/posts/ HTTP/1.1
Host: pod.example
Content-Type: text/turtle
Slug: my-first-post

@prefix schema: <https://schema.org/> .

<> a schema:BlogPosting ;
schema:headline "Hello World" ;
schema:text "My first post!" .

HTTP/1.1 201 Created
Location: /alice/posts/my-first-post

Update with PATCH​

PATCH /alice/profile HTTP/1.1
Host: pod.example
Content-Type: text/n3

@prefix solid: <http://www.w3.org/ns/solid/terms#> .

DELETE { <#me> foaf:name "Alice" }
INSERT { <#me> foaf:name "Alice Smith" }
WHERE { <#me> foaf:name "Alice" }

Content Negotiation​

LDP supports multiple RDF formats:

FormatMedia Type
Turtletext/turtle
JSON-LDapplication/ld+json
N-Triplesapplication/n-triples
RDF/XMLapplication/rdf+xml

Request your preferred format:

GET /resource HTTP/1.1
Accept: application/ld+json

LDP uses Link headers extensively:

HTTP/1.1 200 OK
Link: <http://www.w3.org/ns/ldp#Resource>; rel="type"
Link: <http://www.w3.org/ns/ldp#BasicContainer>; rel="type"
Link: </alice/posts/.acl>; rel="acl"
RelationPurpose
typeResource type(s)
aclAccess control document
describedbyMetadata resource

Container Membership​

How containers track members:

@prefix ldp: <http://www.w3.org/ns/ldp#> .

</alice/posts/> a ldp:BasicContainer ;
ldp:contains </alice/posts/post1>,
</alice/posts/post2>,
</alice/posts/post3> .

LDP in Solid​

Solid extends LDP with:

AdditionPurpose
WAC/ACPAccess control
Solid-OIDCAuthentication
Type IndexesData discovery
NotificationsReal-time updates

Comparison​

FeatureLDPRaw HTTPWebDAV
RDF supportNativeNoneNone
ContainersYesNoCollections
Content negotiationYesManualLimited
StandardW3CIETFIETF

Implementation Support​

ServerLDP Support
CSSFull
NSSFull
JSSFull
ESSFull

See Also​