Skip to content

pyscal/atomRDF

Repository files navigation

atomRDF

Note

atomRDF was previously called pyscal-rdf.

codecov Conda Version PyPI - Python Version DOI

atomRDF is a Python tool for ontology-based creation, manipulation, and querying of atomic-scale structures and simulation workflows.

The data model is implemented as Pydantic classes generated from the Conceptual Dictionary for Computational Materials Science ontologies maintained by OCDO:

  • CMSO — Computational Material Sample Ontology
  • CDCO — Crystallographic Defect Core Ontology
  • PODO, PLDO, LDO — point-, planar-, and line-defect ontologies
  • ASMO — Atomistic Simulation Methods Ontology

This makes every object created by atomRDF round-trippable between Python, JSON/YAML and RDF, with ontology-conformant semantics out of the box.

Installation

pip install atomrdf
# or via conda-forge
conda install -c conda-forge atomrdf

Optional features ship as extras — install only what you need:

pip install "atomrdf[oxigraph]"           # Oxigraph triple-store backend
pip install "atomrdf[sqlalchemy]"         # SQLAlchemy-backed store
pip install "atomrdf[materials_project]"  # Materials Project lookups (mp-api)
pip install "atomrdf[grainboundary]"      # aimsgb + pymatgen for grain boundaries
pip install "atomrdf[dislocation]"        # atomman for dislocation builders

Quickstart

from atomrdf import KnowledgeGraph
import atomrdf.build as build

# 1. open a knowledge graph (in-memory by default)
kg = KnowledgeGraph()

# 2. build a sample; it is automatically annotated and added to the graph
fe = build.bulk("Fe", cubic=True, graph=kg)

# 3. ask SPARQL questions
results = kg.query("""
    PREFIX cmso: <http://purls.helmholtz-metadaten.de/cmso/>
    SELECT ?sample ?n
    WHERE { ?sample cmso:hasNumberOfAtoms ?n }
""")
print(results)

# 4. persist
kg.write("fe.ttl", format="turtle")

See examples/ for end-to-end notebooks (getting started, grain boundaries, working with data, defects, SPARQL queries, …) and the full documentation at https://atomrdf.pyscal.org.

Upgrading from 0.12.x

1.0 introduces a few breaking changes (most notably Activity.initial_sampleinput_sample, and a couple of corrected ontology IRIs). See the migration guide and CHANGELOG.

Citing atomRDF

If you use atomRDF in academic work, please cite:

Guzmán, A. A., Menon, S., Hickel, T., & Sandfeld, S. (2026). Ontology-based knowledge graph infrastructure for interoperable atomistic simulation data. arXiv:2604.06230. https://arxiv.org/abs/2604.06230

BibTeX:

@misc{guzman2026ontologybasedknowledgegraphinfrastructure,
  title         = {Ontology-based knowledge graph infrastructure for interoperable atomistic simulation data},
  author        = {Abril Azocar Guzman and Sarath Menon and Tilmann Hickel and Stefan Sandfeld},
  year          = {2026},
  eprint        = {2604.06230},
  archivePrefix = {arXiv},
  primaryClass  = {cs.DB},
  url           = {https://arxiv.org/abs/2604.06230},
}

A software citation (Zenodo DOI) is also available via the badge above and CITATION.cff.

Acknowledgements

This work is supported by the NFDI-Matwerk consortia.

Funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under the National Research Data Infrastructure – NFDI 38/1 – project number 460247524

About

atomRDF is a python tool for ontology-based creation, manipulation, and querying of structures. atomRDF uses the Computational Material Sample Ontology (CMSO).

Topics

Resources

License

Stars

Watchers

Forks

Contributors