Python HTML CSS
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
static/css
templates
.gitignore
LICENSE
README.md
config.ini
pyldn.py
pyldnconfig.py
requirements.txt

README.md

pyldn

A python Linked Data Notifications (LDN) receiver

Author: Albert Meroño
Copyright: Albert Meroño, VU University Amsterdam
License: Apache 2 (see license.txt)

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/albertmeronyo/pyldn
cd pyldn
virtualenv .
source bin/activate
pip install -r requirements.txt

Usage

python pyldn.py

Then, from a client you can discover an inbox

curl -I -X GET http://pyldn.amp.ops.labs.vu.nl/

HTTP/1.1 200 OK
Link: <http://pyldn.amp.ops.labs.vu.nl:8088/inbox/>;

You can request a list of the notification URLs it contains:

curl -X GET -H'Accept: text/turtle' http://pyldn.amp.ops.labs.vu.nl/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://pyldn.amp.ops.labs.vu.nl:8088/inbox/> a ldp:BasicContainer,
        ldp:Container,
        ldp:RDFSource,
        ldp:Resource ;
    ldp:contains <http://pyldn.amp.ops.labs.vu.nl:8088/inbox/1>,
        <http://pyldn.amp.ops.labs.vu.nl:8088/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://pyldn.amp.ops.labs.vu.nl/inbox/

HTTP/1.1 201 CREATED
Location: http://pyldn.amp.ops.labs.vu.nl:8088/inbox/3

If you want to retrieve the content of your brand new notification:

curl -i -X GET -H'Accept: text/turtle' http://pyldn.amp.ops.labs.vu.nl/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!

Configuration

You'll find a sample config.ini file you can customize according to your needs (mostly base path, inbox path, and port).