Skip to main content

Tests Pyright Ruff Coverage REUSE status

OC GraphEnricher

OC GraphEnricher enriches OpenCitations Data Model (OCDM) compliant knowledge graphs by finding missing identifiers and deduplicating entities.

Documentation: https://opencitations.github.io/oc_graphenricher/

Quick start

pip install oc-graphenricher
from oc_ocdm.graph.graph_set import GraphSet
from oc_ocdm.reader import Reader
from rdflib import Graph

from oc_graphenricher.enricher import GraphEnricher
from oc_graphenricher.deduplication import GraphDeduplicator
from oc_graphenricher.storage import single_file_storage

graph = Graph().parse("data/input.nt", format="nt11")

reader = Reader()
graph_set = GraphSet(base_iri="https://w3id.org/oc/meta/")
reader.import_entities_from_graph(
    graph_set,
    graph,
    enable_validation=False,
    resp_agent="https://w3id.org/oc/meta/prov/pa/2",
)

GraphEnricher(
    graph_set=graph_set,
    storage=single_file_storage(
        graph_path="enriched.json",
        provenance_path="provenance.json",
    ),
).enrich()
GraphDeduplicator(
    graph_set=graph_set,
    storage=single_file_storage(
        graph_path="deduplicated.json",
        provenance_path="provenance.json",
    ),
).deduplicate_and_save()

By default, GraphDeduplicator does not merge contributor roles only because author names are similar. To enable that opt-in behavior, pass merge_similar_named_contributors=True.

Use deduplicate() instead of deduplicate_and_save() when another application needs to manage storage or provenance output itself. Use preferred_survivors with a set of entity URIs to keep selected entities when duplicate clusters are merged. Without a preferred survivor, duplicate clusters keep the entity with more functional metadata. Ties use URI order. Use merge_clusters() when another application has already selected the merge clusters, for example from a reviewed CSV. The mapping key is the surviving entity URI and the values are the URIs to merge into it. This method does not discover or merge any extra duplicates outside the provided mapping.

For configuration options and usage details, see the documentation.

License

Distributed under the ISC License. See LICENSE.

To cite the latest version of this software (2.1.12), use this BibTeX entry:

@software{oc-graphenricher-2.1.12,
author = {Gabriele Pisciotta and Arcangelo Massari and Elia Rizzetto and Arianna Moretti and Ilaria De Dominicis and Silvio Peroni and Simone Persiani and Davide Brembilla},
title = {oc-graphenricher},
url = {https://archive.softwareheritage.org/swh:1:snp:6d8bfb5983216c17c071209ec59c48fe217b07ab;origin=https://github.com/opencitations/oc_graphenricher},
version = {2.1.12},
year = {2026}
}

Metadata

Release files for oc-graphenricher 2.1.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oc-graphenricher 2.1.13
File Size Uploaded Provenance Actions
oc_graphenricher-2.1.13.tar.gz 25.2 kB Without provenance Details for oc_graphenricher-2.1.13.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for oc-graphenricher 2.1.13
File Interpreter ABI Platform Actions
oc_graphenricher-2.1.13-py3-none-any.whl Python 3 none any Details for oc_graphenricher-2.1.13-py3-none-any.whl

Total release size: 52.4 kB

Release files / oc_graphenricher-2.1.13.tar.gz

Download URL oc_graphenricher-2.1.13.tar.gz
Size 25.2 kB
Tags Source
SHA-256 checksum
How to use checksums
cdcc1748b050d3576fc22045bdf1f78bebf1b53c9fc0e6a692967e03397c2edf
BLAKE2b-256 checksum
How to use checksums
bd4578977a69d6c7cff963d0d1ab997855af1102953fdd8b7511c842a15e1af4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / oc_graphenricher-2.1.13-py3-none-any.whl

Download URL oc_graphenricher-2.1.13-py3-none-any.whl
Size 27.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b1fee6cf7137d96dc40b73e25dfa54d9d32cd3e7dcb488665591f5baeb26dc07
BLAKE2b-256 checksum
How to use checksums
32ad388c4b949fa305241ee4d12988b819468d873c10412dc75645706bedcdf6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for oc-graphenricher 2.1.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page