Skip to main content

No project description provided

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. Chrontext Metadata Representation

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. Chrontext sequence diagram

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chrontext-0.8.13.tar.gz (8.9 MB view details)

Uploaded Source

Built Distributions

chrontext-0.8.13-cp311-none-win_amd64.whl (22.0 MB view details)

Uploaded CPython 3.11 Windows x86-64

chrontext-0.8.13-cp311-cp311-manylinux_2_28_x86_64.whl (28.1 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.28+ x86-64

chrontext-0.8.13-cp311-cp311-macosx_12_0_x86_64.whl (21.0 MB view details)

Uploaded CPython 3.11 macOS 12.0+ x86-64

chrontext-0.8.13-cp311-cp311-macosx_11_0_arm64.whl (19.9 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

chrontext-0.8.13-cp310-none-win_amd64.whl (22.0 MB view details)

Uploaded CPython 3.10 Windows x86-64

chrontext-0.8.13-cp310-cp310-manylinux_2_28_x86_64.whl (28.1 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

chrontext-0.8.13-cp310-cp310-macosx_12_0_x86_64.whl (21.0 MB view details)

Uploaded CPython 3.10 macOS 12.0+ x86-64

chrontext-0.8.13-cp310-cp310-macosx_11_0_arm64.whl (19.9 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

chrontext-0.8.13-cp39-none-win_amd64.whl (22.0 MB view details)

Uploaded CPython 3.9 Windows x86-64

chrontext-0.8.13-cp39-cp39-manylinux_2_28_x86_64.whl (28.1 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

chrontext-0.8.13-cp39-cp39-macosx_12_0_x86_64.whl (21.0 MB view details)

Uploaded CPython 3.9 macOS 12.0+ x86-64

chrontext-0.8.13-cp39-cp39-macosx_11_0_arm64.whl (19.9 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

chrontext-0.8.13-cp38-none-win_amd64.whl (22.0 MB view details)

Uploaded CPython 3.8 Windows x86-64

chrontext-0.8.13-cp38-cp38-manylinux_2_28_x86_64.whl (28.1 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.28+ x86-64

chrontext-0.8.13-cp38-cp38-macosx_12_0_x86_64.whl (21.0 MB view details)

Uploaded CPython 3.8 macOS 12.0+ x86-64

chrontext-0.8.13-cp38-cp38-macosx_11_0_arm64.whl (19.9 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

File details

Details for the file chrontext-0.8.13.tar.gz.

File metadata

  • Download URL: chrontext-0.8.13.tar.gz
  • Upload date:
  • Size: 8.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.5.0

File hashes

Hashes for chrontext-0.8.13.tar.gz
Algorithm Hash digest
SHA256 b10ec9903963fa82743dab297ce884bcbabf9f2dd694c5853cf480f9b46c27d2
MD5 62b889afbfde4d288a08d0f38e0f54e3
BLAKE2b-256 5bd3d76cd71e7b9e1389da9b885236de1a8d7a3f08b08cdf9e6b9b5ac481f572

See more details on using hashes here.

File details

Details for the file chrontext-0.8.13-cp311-none-win_amd64.whl.

File metadata

File hashes

Hashes for chrontext-0.8.13-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 ac0b798b1df7d9fa043c9936a98de6b1f07d68782597c44789b26d8066c186b3
MD5 694362adfbd9b56673c7db6a273781ee
BLAKE2b-256 b05c51c33cf134d0ea9e1f206946efae8475660a66a55bbca69ead6398743377

See more details on using hashes here.

File details

Details for the file chrontext-0.8.13-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for chrontext-0.8.13-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 eef31528e5595382732721f3c1c3501177428a12d0e2d8cf2deb6dd2ed4e39e2
MD5 c7d395ca13a50566c54af23e36694bc6
BLAKE2b-256 bbb5c59943f2c76736ed05b4274bdc974f21436afde45eb67d159e14510fbf76

See more details on using hashes here.

File details

Details for the file chrontext-0.8.13-cp311-cp311-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for chrontext-0.8.13-cp311-cp311-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 668f47bd36a0963b4835776c41ad15be31b8a3c88afcbeebb3abbd26fc80111c
MD5 ae4d6eb9d322b0bdf32d8c82e7a78e15
BLAKE2b-256 e1f04cf431cd77a77921029ccf5d7fe3932715a190d634b51d3a56c8138a4597

See more details on using hashes here.

File details

Details for the file chrontext-0.8.13-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for chrontext-0.8.13-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 86f71bdbeab5cef4e96e4c472fbe8d06b29a5eeab741b2acfd6990f3f9723719
MD5 841e37741f5ead66ff8bf1fd7cbb02cc
BLAKE2b-256 21dcf0b78938196805ecf7ecf0380974ee86d55ece5590e8819680c6da2e6578

See more details on using hashes here.

File details

Details for the file chrontext-0.8.13-cp310-none-win_amd64.whl.

File metadata

File hashes

Hashes for chrontext-0.8.13-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 924ee0230a9dac1fd3b797834e159fe556a52e73f4c2b1143b55d8d653b6b90f
MD5 12300052cb64987d7c05cc00a4cb07fd
BLAKE2b-256 3b13e1179d550dc3aa26328173d978c3e29d6498cc3d8bce82ea57a957449133

See more details on using hashes here.

File details

Details for the file chrontext-0.8.13-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for chrontext-0.8.13-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ed6d2844ee93983a4378dcbd2b563b5e88581ad6053eb8c3ca044c0f716726dc
MD5 b0500fc385f0ef2323c620329c71e976
BLAKE2b-256 ecb8239aba8ad16184d0841cbf69e2a985df7da7e3d41d00fba98b1648343460

See more details on using hashes here.

File details

Details for the file chrontext-0.8.13-cp310-cp310-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for chrontext-0.8.13-cp310-cp310-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 9fe8bb8f5154d4efeed9b813fac2d86ac721a17c8da98c088d837af49919bb3e
MD5 140adc6afe40837de875da77c4f3906c
BLAKE2b-256 d5c991863db1e5cab718f26c52e3eb655c80cfd9036ad127394bb45f06aac534

See more details on using hashes here.

File details

Details for the file chrontext-0.8.13-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for chrontext-0.8.13-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a249fd11f7a491d7dcd0c95b03e298f933d4a920697c7a37d7dbb2e7a76a987b
MD5 715677700bb50204481eb270e42060c2
BLAKE2b-256 dfff140bfdfec7c2764cf538a937e1567c1d647c2ec74f17c5f562e65ec7534c

See more details on using hashes here.

File details

Details for the file chrontext-0.8.13-cp39-none-win_amd64.whl.

File metadata

File hashes

Hashes for chrontext-0.8.13-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 72d021e9b584f23dd2bacf10326e96b0b185541d6a8bd0a2f037c50f52c81a7f
MD5 0a982ff7686f233a76386a44f7e6fba7
BLAKE2b-256 a8a14f9a3ac115f57b9e6949ca2da290ca9d34346b0d9e0c783a0367650f0feb

See more details on using hashes here.

File details

Details for the file chrontext-0.8.13-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for chrontext-0.8.13-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 23b7adae62c99112a3a72a1e156bc99b1c523dccb60265489880bacffb179a14
MD5 8222625052a3dad9b70f380276858851
BLAKE2b-256 201045fcedbd13990d10d2b7084a1b840a5ba1d980824727609199571f86da2f

See more details on using hashes here.

File details

Details for the file chrontext-0.8.13-cp39-cp39-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for chrontext-0.8.13-cp39-cp39-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 9bf9a73486cb15b4eb7e55aa08e7890b5ac870017402e71cf789030f93d98c6b
MD5 9874a8fc294632954711a3b1de0095dd
BLAKE2b-256 73d8a4595eef83a6f2f53a96c157b2e7d125310eda8e49a63b0c93b640b0bc47

See more details on using hashes here.

File details

Details for the file chrontext-0.8.13-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for chrontext-0.8.13-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a237902ef46380f3b4696f9fc3d55cada16deb3fa9b2149440eb380d0efb6fb8
MD5 4186d2631bd19c1caebdc22cf4806d01
BLAKE2b-256 29926c5a39b8364084fb3c4e0cdcf9662ce15e191920c2fba38ce55e1298f974

See more details on using hashes here.

File details

Details for the file chrontext-0.8.13-cp38-none-win_amd64.whl.

File metadata

File hashes

Hashes for chrontext-0.8.13-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 14a6e87d4747890fb7a3ea3d3b875617c9f07324091980b9527dbee55d290ff2
MD5 a8447ee7f819f232c05e5f792ca0d5f8
BLAKE2b-256 48b44961ac8d66cceecd39eab5af3fc3a12b5e04924b45e3c17f3091864d046d

See more details on using hashes here.

File details

Details for the file chrontext-0.8.13-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for chrontext-0.8.13-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e56a75829a6b62bcb5c6de9b214282744fe3cf775ac56d1505d327823cb1a96f
MD5 131d31a6a80f866c8d170425456b66bf
BLAKE2b-256 0354fc44cab631160c0829c8cb0c1003ea32e912aa4038b0b36737ed085fe64d

See more details on using hashes here.

File details

Details for the file chrontext-0.8.13-cp38-cp38-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for chrontext-0.8.13-cp38-cp38-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 97d536108451e3f9a0714a8d67f254c905ba3e68c2503945ed37130ffe2f1a39
MD5 651ef82123d483d7c138c51890c3875a
BLAKE2b-256 14d9dc37fd9c98b058d72bfe7697913c9a1993bba6629d4c21c511e1a0fdfdf1

See more details on using hashes here.

File details

Details for the file chrontext-0.8.13-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for chrontext-0.8.13-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6fa611547cc0382c5156cb7029b86ac16c45940626762162e86b3d4fb171eec8
MD5 b19b5b387f68dde4f5216f255f6459c6
BLAKE2b-256 cc96d4081f35eadced62ce46fbe4abff40691b962a5c42ace621621bb28eb7f8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page