All Projects → biolink → kgx

biolink / kgx

Licence: BSD-3-Clause license
KGX is a Python library for exchanging Knowledge Graphs

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to kgx

PheKnowLator
PheKnowLator: Heterogeneous Biomedical Knowledge Graphs and Benchmarks Constructed Under Alternative Semantic Models
Stars: ✭ 74 (-5.13%)
Mutual labels:  knowledge-graph, biolink-model
ComplexNetwork
中国娱乐圈关系挖掘,可以快速的查询明星之间的关系。This is a complex network of course assignments. The realization of the relationship analysis and visualization of China's entertainment industry, you can quickly query the relationship between the stars
Stars: ✭ 24 (-69.23%)
Mutual labels:  knowledge-graph
Agriculture knowledgegraph
农业知识图谱(AgriKG):农业领域的信息检索,命名实体识别,关系抽取,智能问答,辅助决策
Stars: ✭ 2,957 (+3691.03%)
Mutual labels:  knowledge-graph
awesome-knowledge-graphs
Graph databases, Knowledge Graphs, SPARQ
Stars: ✭ 56 (-28.21%)
Mutual labels:  knowledge-graph
Cool-NLPCV
Some Cool NLP and CV Repositories and Solutions (收集NLP中常见任务的开源解决方案、数据集、工具、学习资料等)
Stars: ✭ 143 (+83.33%)
Mutual labels:  knowledge-graph
R-MeN
Transformer-based Memory Networks for Knowledge Graph Embeddings (ACL 2020) (Pytorch and Tensorflow)
Stars: ✭ 74 (-5.13%)
Mutual labels:  knowledge-graph
Drkg
A knowledge graph and a set of tools for drug repurposing
Stars: ✭ 231 (+196.15%)
Mutual labels:  knowledge-graph
CONVEX
As far as we know, CONVEX is the first unsupervised method for conversational question answering over knowledge graphs. A demo and our benchmark (and more) can be found at
Stars: ✭ 24 (-69.23%)
Mutual labels:  knowledge-graph
BiLSTM-and-CNN-for-Link-Prediction
Keras implementation of path-based link prediction model for knowledge graph completion
Stars: ✭ 17 (-78.21%)
Mutual labels:  knowledge-graph
KCL
Code and Data for the paper: Molecular Contrastive Learning with Chemical Element Knowledge Graph [AAAI 2022]
Stars: ✭ 61 (-21.79%)
Mutual labels:  knowledge-graph
OLGA
an Ontology SDK
Stars: ✭ 36 (-53.85%)
Mutual labels:  knowledge-graph
ZS-F-VQA
Code and Data for paper: Zero-shot Visual Question Answering using Knowledge Graph [ ISWC 2021 ]
Stars: ✭ 51 (-34.62%)
Mutual labels:  knowledge-graph
Awesome-Federated-Learning-on-Graph-and-GNN-papers
Federated learning on graph, especially on graph neural networks (GNNs), knowledge graph, and private GNN.
Stars: ✭ 206 (+164.1%)
Mutual labels:  knowledge-graph
Zincbase
A batteries-included kit for knowledge graphs
Stars: ✭ 249 (+219.23%)
Mutual labels:  knowledge-graph
hugo-documentation-theme
📖 Project Docs / Knowledge Base template for Hugo Website Builder. 创建项目文档
Stars: ✭ 101 (+29.49%)
Mutual labels:  knowledge-graph
Grakn
TypeDB: a strongly-typed database
Stars: ✭ 2,947 (+3678.21%)
Mutual labels:  knowledge-graph
knowledge-graph-change-language
Tools for working with KGCL
Stars: ✭ 14 (-82.05%)
Mutual labels:  knowledge-graph
rclc
Rich Context leaderboard competition, including the corpus and current SOTA for required tasks.
Stars: ✭ 20 (-74.36%)
Mutual labels:  knowledge-graph
everything
The semantic desktop search engine
Stars: ✭ 22 (-71.79%)
Mutual labels:  knowledge-graph
KBQA-Exploration
知识图谱初探,关系抽取,实体抽取,基于kb的问答,基于es的问答,知识图谱可视化
Stars: ✭ 45 (-42.31%)
Mutual labels:  knowledge-graph

Knowledge Graph Exchange

Python Run testsDocumentation Status Quality Gate Status Maintainability Rating Coverage PyPI Docker

KGX (Knowledge Graph Exchange) is a Python library and set of command line utilities for exchanging Knowledge Graphs (KGs) that conform to or are aligned to the Biolink Model.

The core datamodel is a Property Graph (PG), represented internally in Python using a networkx MultiDiGraph model.

KGX allows conversion to and from:

KGX will also provide validation, to ensure the KGs are conformant to the Biolink Model: making sure nodes are categorized using Biolink classes, edges are labeled using valid Biolink relationship types, and valid properties are used.

Internal representation is a property graph, specifically a networkx MultiDiGraph.

The structure of this graph is expected to conform to the Biolink Model standard, as specified in the KGX format specification.

In addition to the main code-base, KGX also provides a series of command line operations.

Error Detection and Reporting

Non-redundant JSON-formatted structured error logging is now provided in KGX Transformer, Validator, GraphSummary and MetaKnowledgeGraph operations. See the various unit tests for the general design pattern (using the Validator as an example here):

from kgx.validator import Validator
from kgx.transformer import Transformer

Validator.set_biolink_model("2.11.0")

# Validator assumes the currently set Biolink Release
validator = Validator()

transformer = Transformer(stream=True)

transformer.transform(
    input_args = {
        "filename": [
            "graph_nodes.tsv",
            "graph_edges.tsv",
        ],
        "format": "tsv",
    },
    output_args={
        "format": "null"
    },
    inspector=validator,
)

# Both the Validator and the Transformer can independently capture errors

# The Validator, from the overall semantics of the graph...
# Here, we just report severe Errors from the Validator (no Warnings)
validator.write_report(open("validation_errors.json", "w"), "Error")

# The Transformer, from the syntax of the input files... 
# Here, we catch *all* Errors and Warnings (by not providing a filter)
transformer.write_report(open("input_errors.json", "w"))

The JSON error outputs will look something like this:

{
    "ERROR": {
        "MISSING_EDGE_PROPERTY": {
            "Required edge property 'id' is missing": [
                "A:123->X:1",
                "B:456->Y:2"
            ],
            "Required edge property 'object' is missing": [
                "A:123->X:1"
            ],
            "Required edge property 'predicate' is missing": [
                "A:123->X:1"
            ],
            "Required edge property 'subject' is missing": [
                "A:123->X:1",
                "B:456->Y:2"
            ]
        }
    },
    "WARNING": {
        "DUPLICATE_NODE": {
          "Node 'id' duplicated in input data": [
            "MONDO:0010011",
            "REACT:R-HSA-5635838"
          ]
        }
    }
}

This system reduces the significant redundancies of earlier line-oriented KGX logging text output files, in that graph entities with the same class of error are simply aggregated in lists of names/identifiers at the leaf level of the JSON structure.

The top level JSON tags originate from the MessageLevel class and the second level tags from the ErrorType class in the error_detection module, while the third level messages are hard coded as log_error method messages in the code.

It is likely that additional error conditions within KGX can be efficiently captured and reported in the future using this general framework.

Installation

The installation for KGX requires Python 3.9 or greater.

Installation for users

Installing from PyPI

KGX is available on PyPI and can be installed using pip as follows,

pip install kgx

To install a particular version of KGX, be sure to specify the version number,

pip install kgx==0.5.0

Installing from GitHub

Clone the GitHub repository and then install,

git clone https://github.com/biolink/kgx
cd kgx
python setup.py install

Installation for developers

Setting up a development environment

To build directly from source, first clone the GitHub repository,

git clone https://github.com/biolink/kgx
cd kgx

Then install the necessary dependencies listed in requirements.txt,

pip3 install -r requirements.txt

For convenience, make use of the venv module in Python3 to create a lightweight virtual environment,

python3 -m venv env
source env/bin/activate

pip install -r requirements.txt

To install KGX you can do one of the following,

pip install .

# OR 

python setup.py install

Setting up a testing environment for Neo4j

This release of KGX supports graph source and sink transactions with the 4.3 release of Neo4j.

KGX has a suite of tests that rely on Docker containers to run Neo4j specific tests.

To set up the required containers, first install Docker on your local machine.

Once Docker is up and running, run the following commands:

docker run -d --rm --name kgx-neo4j-integration-test \
            -p 7474:7474 -p 7687:7687 \
            --env NEO4J_AUTH=neo4j/test  \
            neo4j:4.3
docker run -d --rm --name kgx-neo4j-unit-test  \
            -p 8484:7474 -p 8888:7687 \
            --env NEO4J_AUTH=neo4j/test \
            neo4j:4.3

Note: Setting up the Neo4j container is optional. If there is no container set up then the tests that rely on them are skipped.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].