Python library for creating, manipulating, and exporting RDF data compliant with the OpenCitations Data Model. It handles OCDM entities (bibliographic resources, agents, identifiers, etc.) without requiring direct knowledge of RDF or SPARQL.
pip install oc_ocdmfrom oc_ocdm.graph import GraphSet
from oc_ocdm import Storer
g_set = GraphSet("https://w3id.org/oc/meta/")
br = g_set.add_br("https://w3id.org/oc/meta/prov/pa/1")
br.has_title("OpenCitations Meta")
br.create_journal_article()
doi = g_set.add_id("https://w3id.org/oc/meta/prov/pa/1")
doi.create_doi("10.1162/qss_a_00292")
br.has_identifier(doi)
storer = Storer(g_set)
storer.store_graphs_in_file("output.jsonld")For guides, API reference, and examples, see the documentation.