Giter Site home page Giter Site logo

14mmm / linked-data-registry Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sballesteros/linked-data-registry

0.0 4.0 0.0 2.16 MB

A CouchDB powered registry for linked data.

Home Page: https://dcat.io

License: Apache License 2.0

Shell 0.51% JavaScript 99.49%

linked-data-registry's Introduction

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 a 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:[email protected]",
  ...
}

response body:

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

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

DELETE /users/{username}

Unregister a user.

required header:

  • Authorization

response body:

{
  "@context": "https://dcat.io",
  "@type": "UnRegisterAction",
  "actionStatus": "CompletedActionStatus",
  "agent": {
    "@type": "Person",
    "email": "mailto:[email protected]
  },
  "object": ""
}

GET /users/{username}

Get a user's 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 versioned, that is, each update will require a new version value in order to be published. When appropriate, version number SHOULD follow semantic versioning.

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 needs 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 latter 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 versioned 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:[email protected]", ... },
    ...
  ]
}

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.