Skip to content
Proyectos

Acerca de

Python COTTAS library for compressing and querying RDF

Datos y análisis

Cómo se miden estas cifras

What you can do

  • 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).

Crecimiento de estrellas medido

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
Recopilando historial

Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.

README.md

Original

3xmap-studio

License DOI Latest PyPI version Python Version PyPI status Documentation Status

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:

Documentation :bookmark_tabs:

Read the documentation.

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 or run:

pycottas -h

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},
}

Explorar proyectos relacionados

Cargando…