Python COTTAS library for compressing and querying RDF.
Project description
pycottas is a library for working with compressed RDF files in the COTTAS format. COTTAS stores triples as a triple table in Apache Parquet. It is built on top of DuckDB and provides an HDT-like interface.
Features :sparkles:
- Compression and decompression of RDF files.
- Querying COTTAS files with triple patterns.
- RDFLib store backend for querying COTTAS files with SPARQL.
- Supports RDF datasets (quads).
- Can be used as a library or via command line.
- Serve COTTAS files as an SPARQL endpoint.
Documentation :bookmark_tabs:
Getting Started :rocket:
PyPI is the fastest way to install pycottas:
pip install pycottas
We recommend to use virtual environments to install pycottas.
import pycottas
from rdflib import Graph, URIRef
pycottas.rdf2cottas('my_file.ttl', 'my_file.cottas', index='spo')
res = pycottas.search('my_file.cottas', '?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?o')
print(res)
pycottas.cottas2rdf('my_file.cottas', 'my_file.nt')
# COTTASDocument class for querying with triple patterns
cottas_doc = pycottas.COTTASDocument('my_file.cottas')
# the triple pattern can be a string (below) or a tuple of RDFLib terms
res = cottas_doc.search('?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?o')
# COTTASStore class for querying with SPARQL
graph = Graph(store=pycottas.COTTASStore('my_file.cottas'))
res = graph.query('''
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?s ?o WHERE {
?s rdf:type ?o .
} LIMIT 10''')
for row in res:
print(row)
To execute via command line check the docs. It is also possible to serve COTTAS files as an SPARQL endpoint with pycottas-endpoint.
License :unlock:
pycottas is available under the Apache License 2.0.
Author & Contact :mailbox_with_mail:
Universidad Politécnica de Madrid.
Citing :speech_balloon:
If you used pycottas in your work, please cite the ISWC paper:
@inproceedings{arenas2026cottas,
title = {{COTTAS: Columnar Triple Table Storage for Efficient and Compressed RDF Management}},
author = {Arenas-Guerrero, Julián and Ferrada, Sebastián},
booktitle = {Proceedings of the 24th International Semantic Web Conference},
year = {2026},
publisher = {Springer Nature Switzerland},
isbn = {978-3-032-09530-5},
pages = {313--331},
doi = {10.1007/978-3-032-09530-5_18},
}
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 Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pycottas-1.1.0.tar.gz.
File metadata
- Download URL: pycottas-1.1.0.tar.gz
- Upload date:
- Size: 557.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6232aa0410bfff36afd07a745b834b46460dd4b6b766c9da53c1f26c73d8883d
|
|
| MD5 |
112747e5ebb8afd7747f55920f3acad7
|
|
| BLAKE2b-256 |
4fdef0d14c4c434c0577331277105aac154d368d98279bdcb14fc8bbd324dfcc
|
Provenance
The following attestation bundles were made for pycottas-1.1.0.tar.gz:
Publisher:
pypi-publish.yml on arenas-guerrero-julian/pycottas
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycottas-1.1.0.tar.gz -
Subject digest:
6232aa0410bfff36afd07a745b834b46460dd4b6b766c9da53c1f26c73d8883d - Sigstore transparency entry: 772529244
- Sigstore integration time:
-
Permalink:
arenas-guerrero-julian/pycottas@80d6f5441f5eca8734a089f73ac04a8421fb3a64 -
Branch / Tag:
refs/tags/1.1.0 - Owner: https://github.com/arenas-guerrero-julian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@80d6f5441f5eca8734a089f73ac04a8421fb3a64 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pycottas-1.1.0-py3-none-any.whl.
File metadata
- Download URL: pycottas-1.1.0-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed63bf0a2ee7ebc5bd36db3b4954af6ee0dc652f35e2ab5e4eb974a48adfa98a
|
|
| MD5 |
249e64483fdd2bdcb4858cd97db6d4d4
|
|
| BLAKE2b-256 |
61064f4b2de72eeccec08c4ac4381e506a154d3fd4f9916fdad890b128f91353
|
Provenance
The following attestation bundles were made for pycottas-1.1.0-py3-none-any.whl:
Publisher:
pypi-publish.yml on arenas-guerrero-julian/pycottas
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycottas-1.1.0-py3-none-any.whl -
Subject digest:
ed63bf0a2ee7ebc5bd36db3b4954af6ee0dc652f35e2ab5e4eb974a48adfa98a - Sigstore transparency entry: 772529249
- Sigstore integration time:
-
Permalink:
arenas-guerrero-julian/pycottas@80d6f5441f5eca8734a089f73ac04a8421fb3a64 -
Branch / Tag:
refs/tags/1.1.0 - Owner: https://github.com/arenas-guerrero-julian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@80d6f5441f5eca8734a089f73ac04a8421fb3a64 -
Trigger Event:
release
-
Statement type: