pyldn
A python Linked Data Notifications (LDN) receiver.
Original Author: Albert Meroño
Copyright: Albert Meroño, VU University Amsterdam
License: Apache 2 (see license.txt)
This 'cor' branch is a fork of that work which enables provision of an LDN service which uses ESIP's Community Ontology Reposotory as the storage backend.
Features
pyldn is a lightweight receiver for LDN. This means you can set up an inbox to receive notifications as Linked Data in seconds!
Install
git clone https://github.com/esipfed/pyldn pip install -r requirements.txt pip install git+https://github.com/ESIPFed/corpy.git
Configuration
Open config.ini
and edit all values as appropriate. Note in order to use COR, you will need
a COR account. You should also be part of the ldn
Org.
Usage
python pyldn.py
Then, from a client you can discover an inbox
curl -I -X GET http://cor.esipfed.org/ldn/ HTTP/1.0 200 OK Content-Type: text/html; charset=utf-8 Content-Length: 3169 X-Powered-By: https://github.com/esipfed/pyldn Link: ; rel="http://www.w3.org/ns/ldp#inbox", ; rel="type", ; rel="type" Server: Werkzeug/0.11.11 Python/3.6.5 Date: Thu, 31 Jan 2019 23:07:14 GMT
You can request a list of the notification URLs it contains:
curl -X GET -H'Accept: text/turtle' http://cor.esipfed.org/ldn/inbox/ HTTP/1.1 200 OK @prefix ldp: <http://www.w3.org/ns/ldp#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix xml: <http://www.w3.org/XML/1998/namespace> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . <http://cor.esipfed.org/ldn/inbox> a ldp:BasicContainer, ldp:Container, ldp:RDFSource, ldp:Resource ; ldp:contains <http://cor.esipfed.org/ldn/inbox/1>, <http://cor.esipfed.org/ldn/inbox/2> .
You can even post new notifications to this inbox! You'll get the URL for your notification in the response headers:
curl -i -X POST -d '<foo> <bar> <foobar> .' -H'Content-Type: text/turtle' http://cor.esipfed.org/ldn/inbox HTTP/1.1 201 CREATED Location: http://cor.esipfed.org/ldn/inbox/3
If you want to retrieve the content of your brand new notification:
curl -i -X GET -H'Accept: text/turtle' http://cor.esipfed.org/ldn/inbox/3 HTTP/1.1 200 OK @prefix ns1: <file:///home/amp/src/pyldn/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix xml: <http://www.w3.org/XML/1998/namespace> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . ns1:foo ns1:bar ns1:foobar .
See the latest LDN draft for a complete and concise description of all you can do with LDN!