Skip to main content

A tool to enrich any OCDM compliant Knowledge Graph, finding new identifiers and deduplicating entities

Project description

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.instancematching import InstanceMatching
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(
    g_set=graph_set,
    storage=single_file_storage(
        graph_path="enriched.json",
        provenance_path="provenance.json",
    ),
).enrich()
InstanceMatching(
    g_set=graph_set,
    storage=single_file_storage(
        graph_path="matched.json",
        provenance_path="provenance.json",
    ),
).match()

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

For configuration options and usage details, see the documentation.

License

Distributed under the ISC License. See LICENSE.

Project details


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-1.0.1.tar.gz (18.8 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-1.0.1-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: oc_graphenricher-1.0.1.tar.gz
  • Upload date:
  • Size: 18.8 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

Hashes for oc_graphenricher-1.0.1.tar.gz
Algorithm Hash digest
SHA256 d7613b28333eafada0813080a06d104cfa6082ba888f2a1d91c5d7facf3414f4
MD5 b2472d51c1439588108767a1ae113f1a
BLAKE2b-256 d6f0f275bf22558354c0b9edd6b281e502770d1ecd838e3ea7189f940e6bdcdb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: oc_graphenricher-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 22.2 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

Hashes for oc_graphenricher-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f85672e2011b42d27f2f071e906423e12a23894802fcd7277976bcb832135c78
MD5 62c403946c33fd376c8d1d6f133f837b
BLAKE2b-256 e959d7feec4a1b9cfc24af64cd053de43abc393412eb360fc4c21346fa9a27a9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page