An asynchronous SPARQL library using aiohttp
Project description
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 aiosparqlSystem wide installation
easy_install aiosparql
Requirements
Python >= 3.5
Credits
This software has been produced by Dacota One.
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
aiosparql-0.10.1.tar.gz
(16.6 kB
view details)
Built Distribution
File details
Details for the file aiosparql-0.10.1.tar.gz
.
File metadata
- Download URL: aiosparql-0.10.1.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3cb0107b506af61f210757c5a84c0b6f099b6f5717e54f08097ad180c4bea04 |
|
MD5 | 6a5335c1e541ecaf65213e3e93c36214 |
|
BLAKE2b-256 | d116a1c1b797eec2b518c4081863ebd38824768f26ed7e9f307412a51b04fafc |
Provenance
File details
Details for the file aiosparql-0.10.1-py3-none-any.whl
.
File metadata
- Download URL: aiosparql-0.10.1-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | be042449541c2137b64175f2b0b7c667c3563fe7c79b7fbf4272e430dd590d89 |
|
MD5 | 9f6eea380bb645d33d6098e753103ac4 |
|
BLAKE2b-256 | 099da619ca401876afd07522f2487e21e1163978744138ea08927b90c454229b |