A tool to enrich any OCDM compliant Knowledge Graph, finding new identifiers and deduplicating entities
Project description
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.
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file oc_graphenricher-2.1.1.tar.gz.
File metadata
- Download URL: oc_graphenricher-2.1.1.tar.gz
- Upload date:
- Size: 20.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03da11b58ac0b253bf96ea0c5eebcf7f3f60b0493fb025030c3cf3992b1d4d7f
|
|
| MD5 |
581f54f5203049534d649da55949f36b
|
|
| BLAKE2b-256 |
9ba6f0846464000e706546650ac26dd9805fc98173da6c02e81f9f97986cad15
|
File details
Details for the file oc_graphenricher-2.1.1-py3-none-any.whl.
File metadata
- Download URL: oc_graphenricher-2.1.1-py3-none-any.whl
- Upload date:
- Size: 23.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61af107a1ed4114c7f9458dd702c6fdd2a5590e0522d5934f2e4c0efa3a047c8
|
|
| MD5 |
0c26a9b3d23e5ec6e16dc5e40b0ae1e5
|
|
| BLAKE2b-256 |
96994252294b2ead508815b82c7a61259057aee92cd717aa0b8b4280457fac90
|