https://github.com/opencitations/oc_ocdm
Object mapping library for manipulating RDF graphs that are compliant with the OpenCitations datamodel.
https://github.com/opencitations/oc_ocdm
graphs object-mapping rdf sparql
Last synced: about 1 month ago
JSON representation
Object mapping library for manipulating RDF graphs that are compliant with the OpenCitations datamodel.
- Host: GitHub
- URL: https://github.com/opencitations/oc_ocdm
- Owner: opencitations
- License: other
- Created: 2020-12-17T14:56:50.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2026-06-09T09:50:20.000Z (about 2 months ago)
- Last Synced: 2026-06-09T11:22:15.976Z (about 2 months ago)
- Topics: graphs, object-mapping, rdf, sparql
- Language: Python
- Homepage: https://opencitations.github.io/oc_ocdm/
- Size: 135 MB
- Stars: 6
- Watchers: 4
- Forks: 2
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
- Citation: CITATION.cff
Awesome Lists containing this project
README
# oc_ocdm
[
](http://opencitations.net)
[](https://github.com/opencitations/oc_ocdm/actions/workflows/run_tests.yml)
[](https://opencitations.github.io/oc_ocdm/coverage/)
[](https://opencitations.github.io/oc_ocdm/)
[](https://github.com/opencitations/oc_ocdm/actions/workflows/reuse.yml)
[](https://opensource.org/licenses/ISC)
[](https://badge.fury.io/py/oc-ocdm)
[](https://zenodo.org/badge/latestdoi/322327342)
Python library for creating, manipulating, and exporting RDF data compliant with the [OpenCitations Data Model](https://figshare.com/articles/Metadata_for_the_OpenCitations_Corpus/3443876). It handles OCDM entities (bibliographic resources, agents, identifiers, etc.) without requiring direct knowledge of RDF or SPARQL.
## Quick start
```bash
pip install oc_ocdm
```
```python
from 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](https://opencitations.github.io/oc_ocdm/).