Giter VIP home page Giter VIP logo

pyldn's Introduction

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).

pyldn's People

Contributors

albertmeronyo avatar lewismc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pyldn's Issues

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.