Skip to main content

LinksQL (Python reference implementation)

A faithful, behaviourally-identical Python port of the JavaScript reference implementation of LinksQL — an associative query language built on one data primitive (the link, a doublet) and one operation (substitution).

Everything is a link: a triple (index: source target) of positive integers. A link whose source and target both equal its own index is a point, the atom of the graph. A query is a pair of pattern lists — a restriction and a substitution — written (restriction) (substitution); the four CRUD behaviours (read, create, update, delete) are derived from how the two lists line up positionally.

The JavaScript implementation in ../js/src is the ground truth, and the normative behaviour is defined in ../docs/SPECIFICATION.md.

A link has exactly two endpoints, so a relation like "alice loves bob" is the higher-order link ((alice loves) bob) — every pattern carries 0 or 2 values.

Quick start

from linksql import Database

db = Database()
db.query("() (((alice loves) bob))")  # create the higher-order link
report = db.query("(($i: $s $t))")    # read every relation
print(report.operation, report.matched)

Development

This package uses a src layout. Create a virtual environment and install it with the development extras:

python -m venv .venv
. .venv/bin/activate
pip install -e ".[dev]"

Then run the checks (all must pass):

ruff check .
ruff format --check .
mypy src
pytest tests/ -v

Public API

The top-level linksql package re-exports the engine surface:

  • linksql.lino — tokenize, parse, serialize, serialize_all, the AST types (Ref, Link/LinkNode, Node, Token) and LinoSyntaxError.
  • linksql.store — LinksStore, Link, LinkIntegrityError.
  • linksql.names — Names, UnknownNameError.
  • linksql.substitution — link_slots, match_restriction, execute, link_matches, Context, and SubstitutionError.
  • linksql.query — Database, split_query, link_to_lino, QueryReport, QueryError.
  • linksql.schema — the GraphQL-class schema model: Schema, Relation, NamedQuery, NamedSubscription, and SchemaError.

Metadata

Release files for linksql 0.1.0

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

Source distribution (sdist)

Source distribution for linksql 0.1.0
File Size Uploaded Provenance Actions
linksql-0.1.0.tar.gz 23.7 kB Without provenance Details for linksql-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for linksql 0.1.0
File Interpreter ABI Platform Actions
linksql-0.1.0-py3-none-any.whl Python 3 none any Details for linksql-0.1.0-py3-none-any.whl

Total release size: 46.6 kB

Release files / linksql-0.1.0.tar.gz

Download URL linksql-0.1.0.tar.gz
Size 23.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d362c3262cea6fcb7e2fa60670cbc541c5634ce13d154c5a86ef46854470244d
BLAKE2b-256 checksum
How to use checksums
4a3cc9b5af68a8942b1149538d458223b74371b4baa353fc431d400bf398ddb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.4

Release files / linksql-0.1.0-py3-none-any.whl

Download URL linksql-0.1.0-py3-none-any.whl
Size 22.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2976ed0218ba24d3bacee7b9e00d4b34e60627a0b6aa417b5b9689d9ff5a546b
BLAKE2b-256 checksum
How to use checksums
a7c669460e526ef39f1394a192350c6a9fa1381021a26828be4c9cb525335c4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.4

Security for linksql 0.1.0

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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