Skip to main content

A library to store data in a knowledge graph

Project description

Setup

Install knowledge-graph using these commands:

git clone https://github.com/hyroai/knowledge-graph.git
pip install -e ./knowledge-graph
pip install cloud-utils@https://github.com/hyroai/cloud-utils/tarball/master

Publish to PyPI

In order to publish a new version to PyPI you need to release a new version on github with semantic version that follows the rules here: https://semver.org/

When to use querying.py vs querying_raw.py

Both modules provide querying abilities, but querying.py relies on a global store of kgs, storred by their hash value. The code retrieves the kg instance from this map ad hoc. This was built so we can have a serializable representation of a node in the kg, Node, which has graph_id and node_id, and not have to serialize the entire kg any time we serialize an object containing them (e.g. if we're serializing or hashing a NounPhrase for some reason).

The global store is an impure component that can make some code have different behaviours depending on what happened before (whether or not the kg was loaded).

Consequently, in contexts where you have a Element and KnowledgeGraph, prefer using querying_raw.py, giving the graph instance explicitly. This is mainly when creating graphs or enriching them.

In contexts where all you have is Node, use querying.py.

If you implement new querying functions, you can implement them in querying_raw.py, and lift them to querying.py using storage.run_on_kg_and_node.

Do not use the internal modules inside the knowledge_graph directory

Instead, rely on the imports in knowledge_graph/__init__.py, possibly add what you need there (in rare cases this is required).

Relations naming conventions

Relation are the middle part of the triplet. Although they can safely be named anything, we use a naming convention that serves as mnemonic device. For example the relation person/gender implies the left hand side is an entity representing a person, whereas the right hand side is a gender, so we can expect a triplet like Alice,person/gender,female.

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

knowledge-graph-0.0.6.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

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

knowledge_graph-0.0.6-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file knowledge-graph-0.0.6.tar.gz.

File metadata

  • Download URL: knowledge-graph-0.0.6.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for knowledge-graph-0.0.6.tar.gz
Algorithm Hash digest
SHA256 f4deffa2d53f3c033373062f94bafe9b0a5ec90b4c1ee4cf1e1aa2c3567d5ced
MD5 7445969349416877885dee39cd541bd6
BLAKE2b-256 798ae565e8c203db86a98e737e4d6fe476bb9d925e6400515e43f1218ceeb505

See more details on using hashes here.

File details

Details for the file knowledge_graph-0.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for knowledge_graph-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 6f5d6062f2d4170b07fe0e6689e7e1f6a94e8183c424a5c93448b20f9e33a877
MD5 6d9323d7fab0c985021f822cc48f7ab4
BLAKE2b-256 5672a580aceabea5bda44040f4734c449d199110fd0ca03e7d7d8c15a12686d5

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