A very small module to add Linked Data API functionality to a Python FastAPI or Flask (v3.x) installation
Project description
Welcome to pyLDAPI
The Python Linked Data API (pyLDAPI) is:
A very small module to add Linked Data API functionality to a Python FastAPI installation.
What is it?
This module contains a small Python module which is intended to be added (imported) into a FastAPI (v4.x +) or Python Flask (v3.x) installation to add a small library of Renderer classes which can be used to handle requests and return responses in a manner consistent with Linked Data principles of operation.
The intention is to make it easy to “Linked Data-enable” web APIs.
An API using this module will get:
- an alt profile for each endpoint that uses a Renderer class to return responses that the API delivers
this is a profile, or view of the resource that lists all other available profiles
- a Register of Registers
a start-up function that auto-generates a Register of Registers is run when the API is launched.
a basic, over-writeable template for Registers’ HTML & RDF
- all of the functionality defined by the W3C’s Content Negotiation by Profile specification
to allow for requests of content that conform to data specifications and profiles
The main parts of pyLDAPI are as follows:
Web requests arrive at a Web Server, such as Apache or nginx, which then forwards (some of) them on to FastAPI, a Python web framework. FastAPI calls Python functions for web requests defined in a request/function mapping and may call pyLDAPI elements. FastAPI need not call pyLDAPI for all requests, just as Apache/nginx need not forward all web request to FastAPI. pyLDAPI may then draw on any Python data source, such as database APIs, and uses the rdflib Python module to formulate RDF responses.
Definitions
Alt Profile
The model view that lists all other views. This API uses the definition of Alternate Profiles Data Model as an OWL ontology presented at https://www.w3.org/TR/dx-prof-conneg/#altr-owl.
Linked Data Principles
The principles of making things available over the internet in both human and machine-readable forms. Codified by the World Wide Web Consortium. See https://www.w3.org/standards/semanticweb/data.
Model View
A set of properties of a Linked Data object codified according to a standard or profile of a standard.
Object
Any individual thing delivered according to Linked Data principles.
Register
A simple listing of URIs of objects, delivered according to Linked Data principles.
Register of Registers
A register that lists all other registers which this API provides.
pyLDAPI in action
- Register of Media Types
- Linked Data version of the Geocoded National Address File
Parts of the GNAF implementation
- Geoscience Australia’s Sites, Samples Surveys Linked Data API
- Linked Data version of the Australian Statistical Geography Standard product
Parts of the ASGS implementation
Documentation
Detailed documentation can be found at https://pyldapi.readthedocs.io/
Licence
This is licensed under GNU General Public License (GPL) v3.0. See the LICENSE deed for more details.
Contact
Dr Nicholas Car (lead)
Ashley Sommer (senior developer)
Changelog
4.x
Version 4+ uses FastAPI, not Flask. For Flask, use <=3.11
3.11
tokens applied to Representations in Alternate View profile, not Profiles
3.0
Content Negotiation specification by Profile supported
replaced all references to “format” with “Media Type” and “view” with “profile”
renamed class View to Profile
added unit tests for all profile functions
added unit tests for main ConnegP functions
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyldapi-4.2.tar.gz
.
File metadata
- Download URL: pyldapi-4.2.tar.gz
- Upload date:
- Size: 21.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7662e3b682452e7bec636614cf27dd5060db1bfda1942553e9072b8cef041bef |
|
MD5 | 7fc2bcc0a65ac87e2b6618eda99cf11c |
|
BLAKE2b-256 | 8250dc4fa2ca72fe156e95cf4a3c6ba1c55be6268633ecf922fef13af8fba003 |
File details
Details for the file pyldapi-4.2-py3-none-any.whl
.
File metadata
- Download URL: pyldapi-4.2-py3-none-any.whl
- Upload date:
- Size: 37.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e56c6a5d2b0d6f8a0f86a5b1f88c899f599573e888477145263d8dbe8c5c24a1 |
|
MD5 | aa68735fe0378e4031be8fef076cc90e |
|
BLAKE2b-256 | c8ba748371f5dfa0f131d8d34a365b230fa9c643feefc8e07e160b7e928a98b6 |