knowledge-graph


Nameknowledge-graph JSON
Version 0.0.30 PyPI version JSON
download
home_pagehttps://github.com/hyroai/knowledge-graph/
SummaryA library to store data in a knowledge graph
upload_time2023-07-30 11:12:51
maintainer
docs_urlNone
authorHyro AI
requires_python>=3.11
license
keywords tag1 tag2
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## 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

After merging your new branch to the main branch, You need to publish a new version to PyPI. On the repo's main view go to the "Code" tab on top and then press on releases.
Click "Draft a new release" and create you new release with semantic version that follows the rules here: https://semver.org/.
Publishing your new release will create a new version on PyPI using the latest commit on main.

## 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`.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hyroai/knowledge-graph/",
    "name": "knowledge-graph",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": "",
    "keywords": "tag1,tag2",
    "author": "Hyro AI",
    "author_email": "contact@hyro.ai",
    "download_url": "https://files.pythonhosted.org/packages/ec/49/b07d475cbd8c38e11271ff3680b6305d68373ad5c155cda7e13ceea128d5/knowledge-graph-0.0.30.tar.gz",
    "platform": null,
    "description": "## Setup\n\nInstall knowledge-graph using these commands:\n\n```\ngit clone https://github.com/hyroai/knowledge-graph.git\npip install -e ./knowledge-graph\npip install cloud-utils@https://github.com/hyroai/cloud-utils/tarball/master\n```\n\n## Publish to PyPI\n\nAfter merging your new branch to the main branch, You need to publish a new version to PyPI. On the repo's main view go to the \"Code\" tab on top and then press on releases.\nClick \"Draft a new release\" and create you new release with semantic version that follows the rules here: https://semver.org/.\nPublishing your new release will create a new version on PyPI using the latest commit on main.\n\n## When to use `querying.py` vs `querying_raw.py`\n\nBoth 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).\n\nThe 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).\n\nConsequently, 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.\n\nIn contexts where all you have is `Node`, use `querying.py`.\n\nIf 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`.\n\n## Do not use the internal modules inside the `knowledge_graph` directory\n\nInstead, rely on the imports in `knowledge_graph/__init__.py`, possibly add what you need there (in rare cases this is required).\n\n## Relations naming conventions\n\nRelation 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`.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A library to store data in a knowledge graph",
    "version": "0.0.30",
    "project_urls": {
        "Homepage": "https://github.com/hyroai/knowledge-graph/"
    },
    "split_keywords": [
        "tag1",
        "tag2"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6e3afe7a645384a3eb6f8c0fa123a27f798d8162d291a3a7ba86c410dfad0701",
                "md5": "62ed62f4c81463ac439b709c1499adcc",
                "sha256": "2df0dba807e29aac07c2818018a85626437988123ab2a03388915d15f2b30ad3"
            },
            "downloads": -1,
            "filename": "knowledge_graph-0.0.30-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "62ed62f4c81463ac439b709c1499adcc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 19164,
            "upload_time": "2023-07-30T11:12:49",
            "upload_time_iso_8601": "2023-07-30T11:12:49.773199Z",
            "url": "https://files.pythonhosted.org/packages/6e/3a/fe7a645384a3eb6f8c0fa123a27f798d8162d291a3a7ba86c410dfad0701/knowledge_graph-0.0.30-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ec49b07d475cbd8c38e11271ff3680b6305d68373ad5c155cda7e13ceea128d5",
                "md5": "ecb95b1f4bf469e4668564b0af10d2e6",
                "sha256": "dd9aadbfb301a18300ab17004c05429e58ff727e2da4d9c30d67db89d6f96ff5"
            },
            "downloads": -1,
            "filename": "knowledge-graph-0.0.30.tar.gz",
            "has_sig": false,
            "md5_digest": "ecb95b1f4bf469e4668564b0af10d2e6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 16220,
            "upload_time": "2023-07-30T11:12:51",
            "upload_time_iso_8601": "2023-07-30T11:12:51.320532Z",
            "url": "https://files.pythonhosted.org/packages/ec/49/b07d475cbd8c38e11271ff3680b6305d68373ad5c155cda7e13ceea128d5/knowledge-graph-0.0.30.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-30 11:12:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hyroai",
    "github_project": "knowledge-graph",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "knowledge-graph"
}
        
Elapsed time: 0.10498s