lakesuperior.endpoints package

Submodules

lakesuperior.endpoints.admin module

lakesuperior.endpoints.admin.admin_tools()[source]

Admin tools.

@TODO stub.

lakesuperior.endpoints.admin.fixity_check(uid)[source]

Check the fixity of a resource.

lakesuperior.endpoints.admin.stats()[source]

Get repository statistics.

lakesuperior.endpoints.ldp module

lakesuperior.endpoints.ldp.DEFAULT_RDF_MIMETYPE = 'text/turtle'

Fallback serialization format used when no acceptable formats are specified.

lakesuperior.endpoints.ldp.bp_url_defaults(endpoint, values)[source]
lakesuperior.endpoints.ldp.bp_url_value_preprocessor(endpoint, values)[source]
lakesuperior.endpoints.ldp.delete_resource(uid)[source]

Delete a resource and optionally leave a tombstone.

This behaves differently from FCREPO. A tombstone indicated that the resource is no longer available at its current location, but its historic snapshots still are. Also, deleting a resource with a tombstone creates one more version snapshot of the resource prior to being deleted.

In order to completely wipe out all traces of a resource, the tombstone must be deleted as well, or the Prefer:no-tombstone header can be used. The latter will forget (completely delete) the resource immediately.

lakesuperior.endpoints.ldp.get_resource(uid, out_fmt=None)[source]

https://www.w3.org/TR/ldp/#ldpr-HTTP_GET

Retrieve RDF or binary content.

Parameters:
  • uid (str) – UID of resource to retrieve. The repository root has an empty string for UID.
  • out_fmt (str) – Force output to RDF or non-RDF if the resource is a LDP-NR. This is not available in the API but is used e.g. by the \*/fcr:metadata and \*/fcr:content endpoints. The default is False.
lakesuperior.endpoints.ldp.get_version(uid, ver_uid)[source]

Get an individual resource version.

Parameters:
  • uid (str) – Resource UID.
  • ver_uid (str) – Version UID.
lakesuperior.endpoints.ldp.get_version_info(uid)[source]

Get version info (fcr:versions).

Parameters:uid (str) – UID of resource to retrieve versions for.
lakesuperior.endpoints.ldp.instantiate_req_vars()[source]
lakesuperior.endpoints.ldp.ldp = <flask.blueprints.Blueprint object>

Blueprint for LDP REST API. This is what is usually found under /rest/ in standard fcrepo4. Here, it is under /ldp but initially /rest will be kept for backward compatibility.

lakesuperior.endpoints.ldp.log_request_end(rsp)[source]
lakesuperior.endpoints.ldp.log_request_start()[source]
lakesuperior.endpoints.ldp.parse_repr_options(repr_options, out_headers)[source]

Set options to retrieve IMR.

Ideally, IMR retrieval is done once per request, so all the options are set once in the imr() property.

Representation options include:

  • embed_children: include full resource representation of all resource
    children in the resource graph.
  • incl_children: TODO
  • incl_inbound: include inbound triples (triples whose object is this resource).
  • incl_srv_mgd: include server-managed triples.

All options above are False by default except for incl_srv_mgd which is only False if the return representation is minimal.

:param dict repr_options:: Options parsed from Prefer header. :param dict out_headers:: Response headers.

lakesuperior.endpoints.ldp.patch_resource(uid, is_metadata=False)[source]

https://www.w3.org/TR/ldp/#ldpr-HTTP_PATCH

Update an existing resource with a SPARQL-UPDATE payload.

lakesuperior.endpoints.ldp.patch_resource_metadata(uid)[source]
lakesuperior.endpoints.ldp.patch_version(uid, ver_uid)[source]

Revert to a previous version.

NOTE: This creates a new version snapshot.

Parameters:
  • uid (str) – Resource UID.
  • ver_uid (str) – Version UID.
lakesuperior.endpoints.ldp.post_resource(parent_uid)[source]

https://www.w3.org/TR/ldp/#ldpr-HTTP_POST

Add a new resource in a new URI.

lakesuperior.endpoints.ldp.post_version(uid)[source]

Create a new resource version.

lakesuperior.endpoints.ldp.put_resource(uid)[source]

https://www.w3.org/TR/ldp/#ldpr-HTTP_PUT

Add or replace a new resource at a specified URI.

lakesuperior.endpoints.ldp.rdf_parsable_mimetypes = {'application/ld+json', 'application/n-quads', 'application/n-triples', 'application/rdf+xml', 'application/svg+xml', 'application/trix', 'application/xhtml+xml', 'text/html', 'text/n3', 'text/turtle'}

MIMEtypes that can be parsed into RDF.

lakesuperior.endpoints.ldp.rdf_serializable_mimetypes = {'application/ld+json', 'application/n-triples', 'application/rdf+xml', 'text/n3', 'text/turtle'}

MIMEtypes that RDF can be serialized into.

These are not automatically derived from RDFLib because only triple (not quad) serializations are applicable.

lakesuperior.endpoints.ldp.std_headers = {'Accept-Patch': 'application/sparql-update', 'Accept-Post': 'application/ld+json,application/svg+xml,text/turtle,application/xhtml+xml,application/rdf+xml,text/n3,application/n-triples,application/trix,text/html,application/n-quads'}

Predicates excluded by view.

lakesuperior.endpoints.ldp.tombstone(uid)[source]

Handle all tombstone operations.

The only allowed methods are POST and DELETE; any other verb will return a 405.

lakesuperior.endpoints.ldp.vw_blacklist = {}

Prefer representations currently supported

lakesuperior.endpoints.main module

lakesuperior.endpoints.main.index()[source]

Homepage.

lakesuperior.endpoints.main.ldp_constraints()[source]

LDP term constraints.

lakesuperior.endpoints.query module

lakesuperior.endpoints.query.sparql()[source]

Perform a direct SPARQL query on the underlying triplestore.

Parameters:qry (str) – SPARQL query string.

Search by entering a search term and optional property and comparison term.