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.11), use this BibTeX entry:

@software{oc-graphenricher-2.1.11,
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:3748b2d0f0328a02bfc8f0e160cb45711f30892f;origin=https://github.com/opencitations/oc_graphenricher},
version = {2.1.11},
year = {2026}
}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oc_graphenricher-2.1.12.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oc_graphenricher-2.1.12-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

Details for the file oc_graphenricher-2.1.12.tar.gz.

File metadata

  • Download URL: oc_graphenricher-2.1.12.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","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}

File hashes

Hashes for oc_graphenricher-2.1.12.tar.gz
Algorithm Hash digest
SHA256 bc98c0af82253c75c4273828a9790cc38796eaeb42b7bf9bd5c5007168c6af5a
MD5 4256af4c58333e55d58cb10520a004cd
BLAKE2b-256 0d4f7094edb753801dda0ebcaaa93f33ed912a9a8baaa189c1acf9451d4dc54c

See more details on using hashes here.

File details

Details for the file oc_graphenricher-2.1.12-py3-none-any.whl.

File metadata

  • Download URL: oc_graphenricher-2.1.12-py3-none-any.whl
  • Upload date:
  • Size: 27.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","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}

File hashes

Hashes for oc_graphenricher-2.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 08e96117266fcc876443f6f670715f27151b5c9628f92512359b7c46ee5ad80d
MD5 4cb1a629cfdeb1621c96610b019a887c
BLAKE2b-256 20052845434b3f50a1e190be35961f5001a8800ddb8e150d2839afe9c28be103

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.1.12 This release

2 files

2.1.11

2 files

2.1.10

2 files

2.1.9

2 files

2.1.8

2 files

2.1.7

2 files

2.1.6

2 files

2.1.5

2 files

2.1.4

2 files

2.1.3

2 files

2.1.2

2 files

2.1.1

2 files

2.1.0

2 files

2.0.0

2 files

1.0.1

2 files

1.0.0

2 files

0.2.5

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 files

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