SPARQL semantic translator and ORM for Python.
Project description
sparqly
SPARQL semantic translator and object-mapper for Python (wip).
Example
We define a query object as an instance of sparqly.Item
, with the predicates
listed as attributes following the idiom of pretty_name = "actual name"
. For
example, to query Pre-Raphaelite aritsts on WikiData, the schema we define could
look like
from sparqly import Item
class Artist(Item):
movement = "wdt:P135"
instance_of = "wdt:P31"
We can then generate the query text for a selection with
from sparqly import query
q = query()
q.select(Artist).where(
movement = "wd:Q184814", # pre-raphaelite
instance_of = "wd:Q5" # human
)
print(q.all())
Which will print to the console:
SELECT ?Artist WHERE {
?Artist wdt:P135 wd:Q184814 ;
wdt:P31 wd:Q5 .
}
Changelog
Version 0.1.0:
- Object-Relational-Mapping (ORM)
SELECT
WHERE
Planned Features
- Ability to attach service
CONSTRUCT
/ASK
/DESCRIBE
- Filters like
ORDER
,LIMIT
,GROUP
- More semantic support
- Additional methods for constructing queries depending on circumstance and complexity
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
sparqly-0.1.1.tar.gz
(3.9 kB
view details)
Built Distribution
sparqly-0.1.1-py3-none-any.whl
(16.2 kB
view details)
File details
Details for the file sparqly-0.1.1.tar.gz
.
File metadata
- Download URL: sparqly-0.1.1.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4de5886e52719d4114a05bad79e07fe0207198f1ece24d225832e1efddfcd395 |
|
MD5 | 2837cbe20f657ba5ee9ca3a048614b17 |
|
BLAKE2b-256 | 5442a127bcb9f8d9ad93146c5d9118c06c5e1d22e7f38ee55e98db5717068ac3 |
File details
Details for the file sparqly-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: sparqly-0.1.1-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1065183cd5e3435a7b04770f14dc9773895e755e4141049a53f35656641598d9 |
|
MD5 | 5944fbf208a996e1846045a8e44985b8 |
|
BLAKE2b-256 | 7bd5337735ef651c2754765c8b329f625386e5c8ca7592d4d5cc2407199cd48c |