SPARQL queries over hybrid infrastructures - time-series and context
Project description
chrontext
SPARQL- and Apache Arrow-based high throughput access to time series data residing in an arbitrary time series database which is contextualized by a knowledge graph. It is built in Rust using pola.rs, spargebra, sparesults and oxrdf from the Oxigraph project.
Chrontext is written with data analysts and data engineers who want to extract contextualised time series data as data frames. Chrontext allows them to do this in an efficient way using SPARQL. It supports data extraction scenarios in industry where data needs to be accessed in cloud data lake and on-premise settings by supporting in principle arbitrary time series database backends. Currently, we support OPC UA HA and Dremio (using SQL over Apache Arrow Flight). Chrontext can be configured to push down query executions into the time series database according to its capabilities in order to offload computations and minimize I/O.
To read more about Chrontext, read the preprint article Chrontext: Portable Sparql Queries Over Contextualised Time Series Data in Industrial Settings. This is joint work by Magnus Bakken and Professor Ahmet Soylu at OsloMet. Please reach out to us if you would like help trying Chrontext.
Metadata
Chrontext assumes that we have a knowledge base in a SPARQL database and a time series database. The knowledge base is annotated to link some URIs to identifiers of time series in the time series database.
Execution
At query time, we rewrite queries that span both "static" data in the SPARQL database and the time series database into parts that concern the SPARQL engine and the time series database respectively. The "static" queries are amended to extract the metadata linking URIs to time series. Query execution is then interleaved and results are combined to produce the answer to the original query.
Queries in python
We can make queries in Python. The code assumes that we have a SPARQL-endpoint and an Arrow Flight SQL-endpoint (Dremio) set up.
import pathlib
from chrontext import Engine, TimeseriesDremioDatabase, TimeseriesTable
tables = [
TimeseriesTable(
resource_name="my_resource",
schema="my_nas",
time_series_table="ts.parquet",
value_column="v",
timestamp_column="ts",
identifier_column="id",
value_datatype="http://www.w3.org/2001/XMLSchema#unsignedInt")
]
arrow_flight_sql_db = TimeseriesDremioDatabase(host=DREMIO_HOST, port=DREMIO_PORT, username="dremio",
password="dremio123", tables=tables)
engine = Engine(sparql_endpoint=OXIGRAPH_QUERY_ENDPOINT, timeseries_dremio_db=timeseries_dremio_db)
engine.init()
df = engine.query("""
PREFIX xsd:<http://www.w3.org/2001/XMLSchema#>
PREFIX chrontext:<https://github.com/DataTreehouse/chrontext#>
PREFIX types:<http://example.org/types#>
SELECT ?w ?s ?t ?v WHERE {
?w a types:BigWidget .
?w types:hasSensor ?s .
?s chrontext:hasTimeseries ?ts .
?ts chrontext:hasDataPoint ?dp .
?dp chrontext:hasTimestamp ?t .
?dp chrontext:hasValue ?v .
FILTER(?t > "2022-06-01T08:46:53"^^xsd:dateTime && ?v < 200) .
}
""")
Installing pre-built wheels
Chrontext is in pip, just use:
pip install chrontext
License
All code produced since August 1st. 2023 is copyrighted to Data Treehouse AS with an Apache 2.0 license unless otherwise noted.
All code which was produced before August 1st. 2023 copyrighted to Prediktor AS with an Apache 2.0 license unless otherwise noted, and has been financed by The Research Council of Norway (grant no. 316656) and Prediktor AS as part of a PhD Degree. The code at this state is archived in the repository at https://github.com/DataTreehouse/chrontext.
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 Distributions
File details
Details for the file chrontext-0.7.1.tar.gz
.
File metadata
- Download URL: chrontext-0.7.1.tar.gz
- Upload date:
- Size: 8.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb1e07e10949f8c3856ebbe59b360d35c57059b6e2d8bcb7f566a96185b1f183 |
|
MD5 | 5e951f5f248496e5a5e822a9ec0b2094 |
|
BLAKE2b-256 | 7ee882be39fd630a30991873b9a3a92fadf1eec84400f3f23af79baa69809458 |
File details
Details for the file chrontext-0.7.1-cp311-none-win_amd64.whl
.
File metadata
- Download URL: chrontext-0.7.1-cp311-none-win_amd64.whl
- Upload date:
- Size: 22.2 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbf34d302d8cca9609ae8ae529c1c13fad8924ed108af8a68c66e9d3d23b7fd8 |
|
MD5 | b99c94a11e856d33a3d6c4830f2bb31d |
|
BLAKE2b-256 | dbff48c494144dca78629044cbcd951d48b4bc642348c49489f92323e659efd1 |
File details
Details for the file chrontext-0.7.1-cp311-cp311-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: chrontext-0.7.1-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 23.4 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31ea874dfb854a4ac1f9726b0a71866684ef09727d775500f73ad298aca42ebf |
|
MD5 | 217a45143ae12977172fafc2ba2d0064 |
|
BLAKE2b-256 | b3dbd3e064a5b975fd35368d3e13834e35988ca000c544d0222ee1a70e7df2b9 |
File details
Details for the file chrontext-0.7.1-cp311-cp311-macosx_12_6_x86_64.whl
.
File metadata
- Download URL: chrontext-0.7.1-cp311-cp311-macosx_12_6_x86_64.whl
- Upload date:
- Size: 21.2 MB
- Tags: CPython 3.11, macOS 12.6+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77f201756db6d7dc0ea66f51b9fc02a59d593196ef9fc54c3a86a4e114bb7add |
|
MD5 | e162f06180591271bbb4c21ec0fe59c8 |
|
BLAKE2b-256 | e9a1ded625f1c819df5e08b860f09f79dcc35f3e8b4dfc74e037d07a56fc537a |
File details
Details for the file chrontext-0.7.1-cp311-cp311-macosx_11_0_arm64.whl
.
File metadata
- Download URL: chrontext-0.7.1-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 19.8 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ee3f69a2d062a21718ef9b93954f07a06ab5e7cfb0c9821e5f0108f761d7b5f |
|
MD5 | f1303d461b910a958a1212a1e2abd68a |
|
BLAKE2b-256 | 3c46af60f02cb70c903357e59c19ba03e2b35d55bb88ef5c8e1c1582fac18ffa |
File details
Details for the file chrontext-0.7.1-cp310-none-win_amd64.whl
.
File metadata
- Download URL: chrontext-0.7.1-cp310-none-win_amd64.whl
- Upload date:
- Size: 22.2 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da87c4802c4586fa81473ed7fd18ab8e8bdca41636473e93cfa14185861ce124 |
|
MD5 | fe848ab0e82fda48ae81caae50501697 |
|
BLAKE2b-256 | e9a6cb2aa76bd446e62494154b5437312a96a2a009eb4780b22814f934ad382d |
File details
Details for the file chrontext-0.7.1-cp310-cp310-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: chrontext-0.7.1-cp310-cp310-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 23.4 MB
- Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc201413c16b59959eab3bd80a26068ebf67118c624828104025d9c6f0a6af65 |
|
MD5 | 27b8a32a0af4f71b8c60e84539a95f1d |
|
BLAKE2b-256 | b0212ede4861fde993ccca7e306e82a2d1327b6ba15c002a0ea818a4c11177d4 |
File details
Details for the file chrontext-0.7.1-cp310-cp310-macosx_12_6_x86_64.whl
.
File metadata
- Download URL: chrontext-0.7.1-cp310-cp310-macosx_12_6_x86_64.whl
- Upload date:
- Size: 21.2 MB
- Tags: CPython 3.10, macOS 12.6+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa7ce0ceb309959451dbdc546b869a0b19ca4ee09f8c368f6de395ae0a238cbc |
|
MD5 | 575aea2d2bd8063c992efb26f180eff1 |
|
BLAKE2b-256 | c714529be3a05451655bdd76a4ae3ee687ad51d7bda995e26f310f3b6265763a |
File details
Details for the file chrontext-0.7.1-cp310-cp310-macosx_11_0_arm64.whl
.
File metadata
- Download URL: chrontext-0.7.1-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 19.8 MB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a664c7a1cdfa251e51a5312b6d1193b845c85b6b278d256daa0bd15b5668a1ab |
|
MD5 | 33df0a2a8886a265bde1357a7e00ca05 |
|
BLAKE2b-256 | d22b466396074741ac47f45aaf5c98f868ae36c95be93e16aacd580349e39e89 |
File details
Details for the file chrontext-0.7.1-cp39-none-win_amd64.whl
.
File metadata
- Download URL: chrontext-0.7.1-cp39-none-win_amd64.whl
- Upload date:
- Size: 22.2 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4378abfd85ac77000654404496ff367dbd563ff3d609cd3029c2032d2e9e4fc3 |
|
MD5 | 0c06280c11526c98ed6ee54bac076f72 |
|
BLAKE2b-256 | bb1c598d8f5f38eb8e1ccf378d5b1953cc0c554699722c2c8ec6ed8475b4ca9e |
File details
Details for the file chrontext-0.7.1-cp39-cp39-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: chrontext-0.7.1-cp39-cp39-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 23.4 MB
- Tags: CPython 3.9, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad448f557305c16d2f72d8fcc173d9aea9c5dccf63f0a2524b68c739358e1fa5 |
|
MD5 | 2f940777251314206fad5ccd3711c282 |
|
BLAKE2b-256 | 2807c8437fd3e124a7bde642123447e716fa3e07a9e3221aae87d9c387fdf838 |
File details
Details for the file chrontext-0.7.1-cp39-cp39-macosx_12_6_x86_64.whl
.
File metadata
- Download URL: chrontext-0.7.1-cp39-cp39-macosx_12_6_x86_64.whl
- Upload date:
- Size: 21.2 MB
- Tags: CPython 3.9, macOS 12.6+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bb5104d55fe5198957256577c858ae152ba03c3fc4b6f176baffff0f77bce7c |
|
MD5 | df44803fbf016963ea0380efa89f9537 |
|
BLAKE2b-256 | b5d83806c1f77f7e930ada1512e61bacbb5df96b73f3526e8b0f49b391eb5d09 |
File details
Details for the file chrontext-0.7.1-cp39-cp39-macosx_11_0_arm64.whl
.
File metadata
- Download URL: chrontext-0.7.1-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 19.8 MB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1f6e99d3433def7a2ae34524fd8743f5e0b766d6ab6387e1d5afee5c237cca5 |
|
MD5 | 592050933caa11ef369b52f6cadfe3d1 |
|
BLAKE2b-256 | 976032799c5a82d859b9bf50a423d2dadad824dbf1d078189ab704bd73bef7b3 |
File details
Details for the file chrontext-0.7.1-cp38-none-win_amd64.whl
.
File metadata
- Download URL: chrontext-0.7.1-cp38-none-win_amd64.whl
- Upload date:
- Size: 22.2 MB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 942a615bc033136c4acde84a544570740467fdb5f11dcf113287eba20ea8827c |
|
MD5 | 97cadf66e1c57399eb00c10272545743 |
|
BLAKE2b-256 | c2d0e5a51b891dd4e2011bf8641d95fd59149c5be0a4eaaf445c5ec43bfc8638 |
File details
Details for the file chrontext-0.7.1-cp38-cp38-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: chrontext-0.7.1-cp38-cp38-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 23.4 MB
- Tags: CPython 3.8, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c749222b1fbe74ba2aabb74a0d680e5dba2bdbf1ac7b2aa4e486bafeb721dc6 |
|
MD5 | 0f2d229bdb675f85b7c116e5bee1ef4b |
|
BLAKE2b-256 | abaf5c45250304f206cacdc40d0e29a0a82e6d66a18eee5020ef03c3f85a566a |
File details
Details for the file chrontext-0.7.1-cp38-cp38-macosx_12_6_x86_64.whl
.
File metadata
- Download URL: chrontext-0.7.1-cp38-cp38-macosx_12_6_x86_64.whl
- Upload date:
- Size: 21.2 MB
- Tags: CPython 3.8, macOS 12.6+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bddff972073926c147ad79b4081f96ed834011b1ba0d73087891f8213c424c0b |
|
MD5 | 641655b1a7d95afbd4ea5e870055ae2f |
|
BLAKE2b-256 | baa4706915a82ac8aae9954e298fc6b5901af060d9baa3e5f22f2fbcabe3e8fa |
File details
Details for the file chrontext-0.7.1-cp38-cp38-macosx_11_0_arm64.whl
.
File metadata
- Download URL: chrontext-0.7.1-cp38-cp38-macosx_11_0_arm64.whl
- Upload date:
- Size: 19.8 MB
- Tags: CPython 3.8, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe2d19970e5f85e612b25d7627a502061cd503ed96081f94f13dcabf51dda414 |
|
MD5 | e99262b3505f28f9e1b19a8ccf2462dd |
|
BLAKE2b-256 | fb0dc2d1c02b8e33826813749a278e470709e984a6a10ff6a520e561d2cc96d3 |