Skip to main content
License Build Status Code Coverage

An asynchronous SPARQL library using aiohttp

Synopsis

from aiosparql.syntax import (
    IRI, Namespace, Node, PrefixedName, RDF, RDFTerm, Triples)

# define a namespace

class Boo(Namespace):
    __iri__ = IRI("http://boo#")
    SomeClass = PrefixedName
    website = PrefixedName
    label = PrefixedName

# create a node

node = Node("<subject>", {
    RDF.type: Boo.SomeClass,
    Boo.website: IRI("http://example.org"),
    Boo.label: "some label", # "some label" will be automatically escaped
})

# missing prefixed names will show on your IDE and fail on execution

print(Boo.something) # AttributeError!

# create triples

triples = Triples([("s", "p", "o")]) # o is automatically escaped
triples.append(("s", Boo.website, IRI("http://example.org")))
triples.extend([("s", Boo.website, IRI("http://example.org"))])

print(triples) # print the triples is a format usable directly in a SPARQL
               # query. It also groups by subject automatically for you


from aiosparql.client import SPARQLClient

client = SPARQLClient("http://dbpedia.org/sparql")
result = await client.query("select * where {?s ?p ?o} limit 1")
# result is a dict of the JSON result
result = await client.update("""
    with {{graph}}
    insert data {
        {{}}
    }
    """, triples)
# the triples will be automatically indented to produce a beautiful query


from aiosparql.escape import escape_any

print(escape_any(True)) # "true"
print(escape_any("foo")) # "foo"
print(escape_any(5)) # "5"
print(escape_any(5.5)) # "5.5"^^xsd:double

Installation

  • User space installation

    easy_install --user aiosparql
  • System wide installation

    easy_install aiosparql

Requirements

  • Python >= 3.5

Testing

In order for the tests to run, you must have the following Docker containers started:

docker run -d --name travis-virtuoso -p 8890:8890 -e SPARQL_UPDATE=true tenforce/virtuoso:1.2.0-virtuoso7.2.2
docker run -d -p 3030:3030 --name travis-fuseki -e ADMIN_PASSWORD=PASSWORD -e ENABLE_DATA_WRITE=true -e ENABLE_UPDATE=true -e ENABLE_UPLOAD=true secoresearch/fuseki

Credits

This software has been produced by Dacota One.

Metadata

Release files for aiosparql 0.12.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 aiosparql 0.12.0
File Size Uploaded Provenance
aiosparql-0.12.0.tar.gz 17.7 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 31.0 kB

Release files / aiosparql-0.12.0.tar.gz

Download URL aiosparql-0.12.0.tar.gz
Size 17.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3c9873e1d74e0be2c7b932308b3267f42071ac3eaceaec4a97b1067a30df5829
BLAKE2b-256 checksum
How to use checksums
5bfd83f0905c708892ca5a691c04ac755e84c742caafb377dbc34f2115925866
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.6.7

Release files / aiosparql-0.12.0-py3-none-any.whl

Download URL aiosparql-0.12.0-py3-none-any.whl
Size 13.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f4a6cdfe8026a5a0914afae4caa881901d135ae2f0539cbb01e1ef7f6818e890
BLAKE2b-256 checksum
How to use checksums
90ed535c7655a0eed0a9e9e9fdf5e9b41780003dfd7e26061c7d8e2bdc2421f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.6.7

Security for aiosparql 0.12.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.

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