Nightmarish Pawnshop Mystic

    linked-data-registry

    0.11.0 • Public • Published

    linked data registry

    A CouchDB powered registry for linked data.

    NPM

    A client is available here.

    Registry API

    GET /

    Return the JSON-LD context used by the registry.

    GET /about

    Return a JSON-LD document describing the registry and its potential actions using schema.org.

    PUT /users/{username}

    Register an user. A user has to be a Person.

    request body:

    {
      "@context": "https://dcat.io",
      "@id": "users/{username}"
      "@type": "Person",
      "password": "secret"
      "name": "John Markup",
      "email": "mailto:johnmarkup@example.com",
      ...
    }
    

    response body:

    {
      "@context": "https://dcat.io",
      "@type": "RegisterAction",
      "actionStatus": "CompletedActionStatus",
      "agent": "users/{username}",
      "object": ""
    }
    

    Note: relative URLs are relative to a @base of https://dcat.io specified in the context.

    DELETE /users/{username}

    Unregister an user.

    required header:

    • Authorization

    response body:

    {
      "@context": "https://dcat.io",
      "@type": "UnRegisterAction",
      "actionStatus": "CompletedActionStatus",
      "agent": {
        "@type": "Person",
        "email": "mailto:johnmarkup@example.com
      },
      "object": ""
    }
    

    GET /users/{username}

    Get a user public profile.

    PUT /{namespace}

    Create a new JSON-LD document of @id {namespace}.

    If a version property is specified in the document, the document will be versionned that is each update will require a new version value to be published. When appropriate version number SHOULD follow semantic versionning.

    If a version property is not specified, the new document will replace the previous version irreversibly.

    required header:

    • Authorization

    request body:

    {
      "@context": "https://dcat.io",
      "@id": "{namespace}",
      ...
    }
    

    Note to be valid a document need at least:

    • a @context of value https://dcat.io
    • an @id

    response body:

    {
      "@context": "https://dcat.io",
      "@type": "CreateAction",
      "actionStatus": "CompletedActionStatus",
      "agent": "users/{username}",
      "result": "namespace"
    }
    

    DELETE /{namespace}{?version}

    Delete a document of @id {namespace} and version {version}. If version is omitted all the versions will be deleted.

    required header:

    • Authorization

    response body:

    {
      "@context": "https://dcat.io",
      "@type": "DeleteAction",
      "actionStatus": "CompletedActionStatus",
      "agent": "users/john",
      "object": "{namespace}{?version}"
    }
    

    GET /{namespace}/{+pathorurl}{?version}

    Get a JSON-LD document of @id {namespace} or a node of this document of @id {namespace}/{pathorurl} or {pathorurl}. In the later case, {pathorurl} has to be an absolute URL encoded as an Uniform Resource Identifier (URI) component.

    A specific version can be specified using a query string parameter version whose value is properly encoded as a Uniform Resource Identifier (URI) component. In case the document is versionned following Semantic Versioning, a range (e.g <0.0.1) can be specified as version.

    If {?version} is omitted, the latest version of the document is returned.

    Depending on the Accept header, documents retrieved from the registry can be served as JSON-LD (expanded, compacted or flattened) or, JSON interpreted as JSON-LD.

    GET /maintainers/ls/{namespace}

    List the maintainers of a JSON-LD document with @id {namespace}.

    response body:

    {
      "@context": "https://dcat.io",
      "@id": "{namespace}",
      "accountablePerson": [
        { "@id": "users/john", "@type": "Person", "name": "John Markup", "email": "mailto:user@domain.io" },
        ...
      ]
    }
    

    POST /maintainers/add/{username}/{namespace}

    Add a maintainer of @id users/{username} to the document of @id {namespace}.

    required header:

    • Authorization

    response body:

    {
      "@context": "https://dcat.io",
      "@type": "GiveAction",
      "actionStatus": "CompletedActionStatus",
      "agent": "users/{me}",
      "object": "{namespace}",
      "recipient": "users/{username}"
    }
    

    POST /maintainers/rm/{username}/{namespace}

    Remove a maintainer of @id users/{username} to the document of @id {namespace}.

    required header:

    • Authorization

    response body:

    {
      "@context": "https://dcat.io",
      "@type": "TakeAction",
      "actionStatus": "CompletedActionStatus",
      "agent": "users/{me}",
      "object": "{namespace}",
      "recipient": "users/{username}"
    }
    

    Raw data storage API

    PUT /r/{sha1}

    Publish a resource whose SHA-1 message digest (encoded in hex) is {sha1}.

    required headers:

    • Authorization
    • Content-MD5
    • Content-Type
    • Content-Length
    • Encoding (if any)

    response body:

    {
      "@context": "https://dcat.io",
      "@type": "CreateAction",
      "actionStatus": "CompletedActionStatus",
      "agent": "users/{username}",
      "result": "r/{sha1}"
    }
    

    GET /r/{sha1}

    Download raw data.

    Search API

    GET /search/{?keywords}

    Search JSON-LD documents by keywords.

    Tests

    You need couchdb running with an admin defined in env.sh (COUCH_ADMIN_USER and COUCH_ADMIN_PASS) (see env.sh)

    couchdb
    source env.sh
    npm run init
    npm run push
    npm start
    npm test
    

    License

    Apache 2.0.

    Install

    npm i linked-data-registry

    DownloadsWeekly Downloads

    1

    Version

    0.11.0

    License

    Apache-2.0

    Last publish

    Collaborators

    • avatar