2017 © Pedro Peláez
 

project static-ldp

LDP Server for static assets

image

trellis-ldp/static-ldp

LDP Server for static assets

  • Tuesday, May 29, 2018
  • by acoburn
  • Repository
  • 6 Watchers
  • 8 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

static-ldp

A simple way to expose static assets as a read-only LDP server., (*1)

Minimum PHP Version Build Status, (*2)

Requirements

Installation

To install static-ldp, follow these steps:, (*3)

  1. run composer create-project trellis-ldp/static-ldp
  2. create a ./.env.local file like this:
TRELLIS_SOURCE_DIR='/path/to/resources'

Basics

By installing static-ldp and configuring the TRELLIS_SOURCE_DIR to point to the location of your static resources, you have a simple, read-only linked data server., (*4)

The web content will be served from the ./public directory., (*5)

LDP Resources

Individual files are served as ldp:NonRDFSource resources, and directories are served as ldp:BasicContainer resources. If a static file is a RDF file, then it is served as an ldp:RDFSource., (*6)

Describing LDP Non-RDF Resources

It is also possible to describe an ldp:NonRDFSource via the Link: <IRI>; rel="describedby" header. For example, if a JPEG file is named rosid_rosaceae.jpg, then by adding an RDF file with the name rosid_rosaceae.jpg.ttl (or any valid RDF format such as rosid_rosaceae.jpg.jsonld), then requests to rosid_rosaceae.jpg will include a link header pointing to the ldp:RDFSource. Similarly, the ldp:RDFSource will contain a link header (rel="describes") pointing to the ldp:NonRDFSource., (*7)

Support for instance digests

All resources support instance digests as defined in RFC 3230. What this means is that the response can include a Digest header so that it is possible to ensure end-to-end data integrity. Requests that include the header: Want-Digest: md5 or Want-Digest: sha1 will include responses that contain a digest corresponding to the on-disk resource., (*8)

Only md5 and sha1 algorithms are supported; other algorithms will be ignored. It should be noted that, for large files, Want-Digest requests may perform considerably slower, as the digest will need to be computed before a response is sent., (*9)

Configuration

There are many configuration options available. Only the sourceDirectory must be defined. Other options include:, (*10)

template: default.twig

If you wish to override the HTML template with one of your own design, you can change this value to point to a different location. Alternately, you can edit the default.twig file in the templates directory. Though if you plan to customize the template, it is recommended that you use a separate file., (*11)

defaultRdfFormat: turtle

For requests without an Accept header, this is the RDF format used in responses (for ldp:RDFSource and ldp:BasicContainer resources)., (*12)

contentDisposition: false

For ldp:NonRDFSource resources, this controls whether to include a Content-Disposition header in responses., (*13)

extraPropertiesFilename: properties

For each directory that becomes a ldp:BasicContainer resource, an RDF file within that directory with this name will have its contents added to the RDF presented as a response for that resource (instead of becoming a child resource in its own right). This provides a means by which to add user-controlled properties to ldp:BasicContainers., (*14)

validRdfFormats:
    turtle:
        mimeType: text/turtle
        extension: ttl
    jsonld:
        mimeType: application/ld+json
        extension: jsonld
    ntriples:
        mimeType: application/n-triples
        extension: nt

Generally speaking, the RDF formats should not be changed unless there is a need to support a serialization that is not included here. The RDF format (e.g. turtle, jsonld) must be an RDF serialization format supported by EasyRdf., (*15)

prefixes:
    dc: "http://purl.org/dc/terms/"
    rdf: "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    ...

The default HTML display template will present IRIs in short (prefixed) form if those prefixes are registered. By default a number of common prefixes are included, but any prefix may be registered here., (*16)

The Versions