Skip to main content

LD4Apps (Linked Data for Applications)

LD4Apps is an Apache2 licensed Python library for Linked Data for Applications (LDA). LDA helps you implement applications that will be part of a bigger coherent system, for example a web-site made up of multiple applications that talk to each other. LDA applications are system components that communicate entirely through HTTP/REST interfaces.

Installation

To install LD4Apps:

pip install ld4apps

The LDA framework requires a running back-end database for storing application data. The default storage implementation uses MongoDB, so the fastest way to get started is to simply go to the MongoDB download page and download the appropriate version for your OS.

Once MongoDB has downloaded, execute the following commands:

cd <mongodb-installation-directory>/bin
mongod

At this point, MonoDB should be running and listening on its default host and port (localhost:27017).

To configure LDA with the MongoDB server, 3 environment variables also need to be set:

  1. MONGODB_DB_HOST - hostname of the MONGODB server to use

  2. MONGODB_DB_PORT - the MONGDOB server port

  3. APP_NAME - the name of you application, which is used as the DB name where the resources will be stored

Example

You can create a Linked-Data resource using the ld4apps.lda module like this:

>>> import os
>>> os.environ['MONGODB_DB_HOST'] = 'localhost'
>>> os.environ['MONGODB_DB_PORT'] = '27017'
>>> os.environ['APP_NAME'] = 'teststore'
>>> from ld4apps import lda
>>> foo_container_environ = {'HTTP_HOST': 'localhost', 'PATH_INFO': '/tst/foo', 'QUERY_STRING': ''}
>>> new_foo_resource = {'rdfs_label': 'my foo', 'rdf_type': 'http://example.org#Foo'}
>>> body, status, headers = lda.create_document(foo_container_environ, new_foo_resource, 'in_foo_container')
INFO:ld4apps.mongodbstorage.operation_primitives:created document http://localhost/tst/foo/4.1
>>> status
201
>>> import json
>>> print json.dumps(body, indent=4)
{
    "ce_owner": "http://localhost/unknown_user/da36bb01-0d1c-438a-9d00-9940085aae20",
    "rdfs_label": "my foo",
    "in_foo_container": "http://localhost/tst/foo",
    "ce_lastModified": "2015-04-28T18:30:40.993176+00:00",
    "dc_created": "2015-04-28T18:30:40.993176+00:00",
    "ac_resource-group": "http://localhost/",
    "_subject": "http://localhost/tst/foo/3.2",
    "ce_revision": "0",
    "ce_lastModifiedBy": "http://localhost/unknown_user/da36bb01-0d1c-438a-9d00-9940085aae20",
    "dc_creator": "http://localhost/unknown_user/da36bb01-0d1c-438a-9d00-9940085aae20",
    "rdf_type": "http://example.org#Foo"
}

An example using ld4apps along with Flask to implement a simple “todo list” web-server can be found here: https://github.com/ld4apps/lda-examples/tree/ld4apps/todo-flask.

Documentation

Documentation is available at http://ld4apps.github.io/.

Metadata

Release files for ld4apps 0.9.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ld4apps 0.9.7
File Size Uploaded Provenance
LD4Apps-0.9.7.tar.gz 49.2 kB Without provenance Details

Release files / LD4Apps-0.9.7.tar.gz

Download URL LD4Apps-0.9.7.tar.gz
Size 49.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d7232c066b004b7a88f327fb9dbd3d50e55408c6a1777a6d824e90f9c3a61278
BLAKE2b-256 checksum
How to use checksums
f98e0f2949c6f9d3e2ffa36d2a8894a44a433c0e77aa21d155c047cfbbad2b9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for ld4apps 0.9.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page