kglab


Namekglab JSON
Version 0.6.6 PyPI version JSON
download
home_pagehttps://derwen.ai/docs/kgl/
SummaryA simple abstraction layer in Python for building knowledge graphs
upload_time2022-11-24 02:49:14
maintainer
docs_urlNone
authorPaco Nathan
requires_python>=3.7
licenseMIT
keywords controlled vocabulary cugraph deep learning embedding gpu graph algorithms igraph inference interactive visualization json-ld knowledge graph managing namespaces morph-kgc n3 networkx owl pandas parquet probabilistic soft logic psl pyvis rapids rdf rml roam research serialization shacl skos sparql statistical relational learning topology turtle validation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # kglab

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.6360664.svg)](https://doi.org/10.5281/zenodo.6360664)
![Licence](https://img.shields.io/github/license/DerwenAI/kglab)
![Repo size](https://img.shields.io/github/repo-size/DerwenAI/kglab)
![GitHub commit activity](https://img.shields.io/github/commit-activity/w/DerwenAI/kglab?style=plastic)
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
[![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/DerwenAI/kglab.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/DerwenAI/kglab/context:python)
![CI](https://github.com/DerwenAI/kglab/workflows/CI/badge.svg)
[![Docker Pulls](https://img.shields.io/docker/pulls/derwenai/kglab.svg?maxAge=604800)](https://hub.docker.com/r/derwenai/kglab/)
![downloads](https://img.shields.io/pypi/dm/kglab)
![sponsor](https://img.shields.io/github/sponsors/ceteri)


Welcome to *Graph Data Science*:
<https://derwen.ai/docs/kgl/>

The **kglab** library provides a simple abstraction layer in Python 3.7+
for building knowledge graphs, leveraging Pandas, NetworkX, RAPIDS, RDFLib,
Morph-KGC, pythonPSL, and many more.

> **SPECIAL REQUEST:**  
> Which features would you like in an open source Python library for building knowledge graphs?  
> Please add your suggestions through this survey:  
> https://forms.gle/FMHgtmxHYWocprMn6  
> This will help us prioritize the **kglab** roadmap.


## Reviews

[@kaaloo](https://github.com/kaaloo): 
> "Feels like it's a Hugging Face for graphs! 🤯"


## Getting Started

See the ["Getting Started"](https://derwen.ai/docs/kgl/start/)
section of the online documentation.

We recommend installing from [PyPi](https://pypi.python.org/pypi/kglab):
```bash
python3 -m pip install kglab
```

If you work directly from this Git repo, be sure to install the 
dependencies:
```bash
python3 -m pip install -U pip wheel
python3 -m pip install -r requirements.txt
```

Alternatively, to install dependencies using `conda`:
```bash
conda env create -f environment.yml --force
conda activate kglab
```

Then to run some simple uses of this library:
```python
import kglab

# create a KnowledgeGraph object
kg = kglab.KnowledgeGraph()

# load RDF from a URL
kg.load_rdf("http://bigasterisk.com/foaf.rdf", format="xml")

# measure the graph
measure = kglab.Measure()
measure.measure_graph(kg)

print("edges: {}\n".format(measure.get_edge_count()))
print("nodes: {}\n".format(measure.get_node_count()))

# serialize as a string in "Turtle" TTL format
ttl = kg.save_rdf_text()
print(ttl)
```

See the **tutorial notebooks** in the `examples` subdirectory for
sample code and patterns to use in integrating **kglab** with other
graph libraries in Python:
<https://derwen.ai/docs/kgl/tutorial/>


> **WARNING when installing in an existing environment:**  
> Installing a new package in an existing environment may reveal  
> or create version conflicts. See the **kglab** requirements  
> in `requirements.txt` before you do. For example, there are  
> [known version conflicts](https://github.com/DerwenAI/kglab/issues/160) regarding NumPy (>= 1.19.4) and [TensorFlow 2+](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/pip_package/setup.py) (~-1.19.2)


<details>
  <summary>Using Docker</summary>

For a simple approach to running the tutorials, see use of _docker compose_:
<https://derwen.ai/docs/kgl/tutorial/#use-docker-compose>

Also, container images for each release are available on DockerHub:
<https://hub.docker.com/repository/docker/derwenai/kglab>

To build a container image and run it for the tutorials:
```bash
docker build --pull --rm -f "docker/Dockerfile" -t kglab:latest .
docker run -p 8888:8888 -it kglab
```

To build and run a container image for testing:
```bash
docker build --pull --rm -f "docker/testsuite.Dockerfile" -t kglabtest:latest .
docker run --rm -it kglabtest
```
</details>


<details>
  <summary>Build Instructions</summary>

<strong>
Note: unless you are contributing code and updates,
in most use cases won't need to build this package locally.
</strong>

Instead, simply install from
[PyPi](https://pypi.python.org/pypi/kglab)
or use [Conda](https://docs.conda.io/).

To set up the build environment locally, see the 
["Build Instructions"](https://derwen.ai/docs/kgl/build/)
section of the online documentation.
</details>


<details>
  <summary>Semantic Versioning</summary>

Before <strong>kglab</strong> reaches release <code>v1.0.0</code> the 
types and classes may undergo substantial changes and the project is 
not guaranteed to have a consistent API.

Even so, we'll try to minimize breaking changes.
We'll also be sure to provide careful notes.

See:
[changelog.txt](https://github.com/DerwenAI/kglab/blob/main/changelog.txt)
</details>


<details>
  <summary>Contributing Code</summary>

We welcome people getting involved as contributors to this open source
project!

For detailed instructions please see:
[CONTRIBUTING.md](https://github.com/DerwenAI/kglab/blob/main/CONTRIBUTING.md)
</details>


<details>
  <summary>License and Copyright</summary>

Source code for **kglab** plus its logo, documentation, and examples
have an [MIT license](https://spdx.org/licenses/MIT.html) which is
succinct and simplifies use in commercial applications.

All materials herein are Copyright &copy; 2020-2022 Derwen, Inc.
</details>


<details>
  <summary>Attribution</summary>
Please use the following BibTeX entry for citing **kglab** if you use
it in your research or software.
Citations are helpful for the continued development and maintenance of
this library.

```bibtex
@software{kglab,
  author = {Paco Nathan},
  title = {{kglab: a simple abstraction layer in Python for building knowledge graphs}},
  year = 2020,
  publisher = {Derwen},
  doi = {10.5281/zenodo.6360664},
  url = {https://github.com/DerwenAI/kglab}
}
```
</details>


<img
 alt="illustration of a knowledge graph, plus laboratory glassware"
 src="https://raw.githubusercontent.com/DerwenAI/kglab/main/docs/assets/logo.png"
 width="231"
/>


## Kudos

Many thanks to our open source [sponsors](https://github.com/sponsors/ceteri);
and to our contributors:
[@ceteri](https://github.com/ceteri),
[@dvsrepo](https://github.com/dvsrepo),
[@Ankush-Chander](https://github.com/Ankush-Chander),
[@louisguitton](https://github.com/louisguitton),
[@tomaarsen](https://github.com/tomaarsen),
[@Mec-iS](https://github.com/Mec-iS),
[@cutterkom](https://github.com/cutterkom),
[@RishiKumarRay](https://github.com/RishiKumarRay),
[@Tpt](https://github.com/Tpt),
[@ArenasGuerreroJulian](https://github.com/ArenasGuerreroJulian),
[@fils](https://github.com/fils),
[@gauravjaglan](https://github.com/gauravjaglan),
[@pebbie](https://github.com/pebbie),
[@CatChenal](https://github.com/CatChenal),
[@jake-aft](https://github.com/jake-aft),
[@dmoore247](https://github.com/dmoore247),
plus general support from [Derwen, Inc.](https://derwen.ai/);
the [Knowledge Graph Conference](https://www.knowledgegraph.tech/)
and [Connected Data World](https://connected-data.world/);
plus an even larger scope of [use cases](https://derwen.ai/docs/kgl/use_case/)
represented by their communities;
[Kubuntu Focus](https://kfocus.org/),
the [RAPIDS team @ NVIDIA](https://rapids.ai/),
[Gradient Flow](https://gradientflow.com/),
and
[Manning Publications](https://www.manning.com/).

<img
 alt="kglab contributors"
 src="https://contributors-img.web.app/image?repo=derwenai/kglab"
/>


## Star History

[![Star History Chart](https://api.star-history.com/svg?repos=derwenai/kglab&type=Date)](https://star-history.com/#derwenai/kglab&Date)

            

Raw data

            {
    "_id": null,
    "home_page": "https://derwen.ai/docs/kgl/",
    "name": "kglab",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "controlled vocabulary,cugraph,deep learning,embedding,gpu,graph algorithms,igraph,inference,interactive visualization,json-ld,knowledge graph,managing namespaces,morph-kgc,n3,networkx,owl,pandas,parquet,probabilistic soft logic,psl,pyvis,rapids,rdf,rml,roam research,serialization,shacl,skos,sparql,statistical relational learning,topology,turtle,validation",
    "author": "Paco Nathan",
    "author_email": "paco@derwen.ai",
    "download_url": "https://files.pythonhosted.org/packages/c1/1b/2ac759825153ec49e416e714f798abd1e1a2e1e7644c84acc245a38872c9/kglab-0.6.6.tar.gz",
    "platform": null,
    "description": "# kglab\n\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.6360664.svg)](https://doi.org/10.5281/zenodo.6360664)\n![Licence](https://img.shields.io/github/license/DerwenAI/kglab)\n![Repo size](https://img.shields.io/github/repo-size/DerwenAI/kglab)\n![GitHub commit activity](https://img.shields.io/github/commit-activity/w/DerwenAI/kglab?style=plastic)\n[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)\n[![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)\n[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/DerwenAI/kglab.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/DerwenAI/kglab/context:python)\n![CI](https://github.com/DerwenAI/kglab/workflows/CI/badge.svg)\n[![Docker Pulls](https://img.shields.io/docker/pulls/derwenai/kglab.svg?maxAge=604800)](https://hub.docker.com/r/derwenai/kglab/)\n![downloads](https://img.shields.io/pypi/dm/kglab)\n![sponsor](https://img.shields.io/github/sponsors/ceteri)\n\n\nWelcome to *Graph Data Science*:\n<https://derwen.ai/docs/kgl/>\n\nThe **kglab** library provides a simple abstraction layer in Python 3.7+\nfor building knowledge graphs, leveraging Pandas, NetworkX, RAPIDS, RDFLib,\nMorph-KGC, pythonPSL, and many more.\n\n> **SPECIAL REQUEST:**  \n> Which features would you like in an open source Python library for building knowledge graphs?  \n> Please add your suggestions through this survey:  \n> https://forms.gle/FMHgtmxHYWocprMn6  \n> This will help us prioritize the **kglab** roadmap.\n\n\n## Reviews\n\n[@kaaloo](https://github.com/kaaloo): \n> \"Feels like it's a Hugging Face for graphs! \ud83e\udd2f\"\n\n\n## Getting Started\n\nSee the [\"Getting Started\"](https://derwen.ai/docs/kgl/start/)\nsection of the online documentation.\n\nWe recommend installing from [PyPi](https://pypi.python.org/pypi/kglab):\n```bash\npython3 -m pip install kglab\n```\n\nIf you work directly from this Git repo, be sure to install the \ndependencies:\n```bash\npython3 -m pip install -U pip wheel\npython3 -m pip install -r requirements.txt\n```\n\nAlternatively, to install dependencies using `conda`:\n```bash\nconda env create -f environment.yml --force\nconda activate kglab\n```\n\nThen to run some simple uses of this library:\n```python\nimport kglab\n\n# create a KnowledgeGraph object\nkg = kglab.KnowledgeGraph()\n\n# load RDF from a URL\nkg.load_rdf(\"http://bigasterisk.com/foaf.rdf\", format=\"xml\")\n\n# measure the graph\nmeasure = kglab.Measure()\nmeasure.measure_graph(kg)\n\nprint(\"edges: {}\\n\".format(measure.get_edge_count()))\nprint(\"nodes: {}\\n\".format(measure.get_node_count()))\n\n# serialize as a string in \"Turtle\" TTL format\nttl = kg.save_rdf_text()\nprint(ttl)\n```\n\nSee the **tutorial notebooks** in the `examples` subdirectory for\nsample code and patterns to use in integrating **kglab** with other\ngraph libraries in Python:\n<https://derwen.ai/docs/kgl/tutorial/>\n\n\n> **WARNING when installing in an existing environment:**  \n> Installing a new package in an existing environment may reveal  \n> or create version conflicts. See the **kglab** requirements  \n> in `requirements.txt` before you do. For example, there are  \n> [known version conflicts](https://github.com/DerwenAI/kglab/issues/160) regarding NumPy (>= 1.19.4) and [TensorFlow 2+](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/pip_package/setup.py) (~-1.19.2)\n\n\n<details>\n  <summary>Using Docker</summary>\n\nFor a simple approach to running the tutorials, see use of _docker compose_:\n<https://derwen.ai/docs/kgl/tutorial/#use-docker-compose>\n\nAlso, container images for each release are available on DockerHub:\n<https://hub.docker.com/repository/docker/derwenai/kglab>\n\nTo build a container image and run it for the tutorials:\n```bash\ndocker build --pull --rm -f \"docker/Dockerfile\" -t kglab:latest .\ndocker run -p 8888:8888 -it kglab\n```\n\nTo build and run a container image for testing:\n```bash\ndocker build --pull --rm -f \"docker/testsuite.Dockerfile\" -t kglabtest:latest .\ndocker run --rm -it kglabtest\n```\n</details>\n\n\n<details>\n  <summary>Build Instructions</summary>\n\n<strong>\nNote: unless you are contributing code and updates,\nin most use cases won't need to build this package locally.\n</strong>\n\nInstead, simply install from\n[PyPi](https://pypi.python.org/pypi/kglab)\nor use [Conda](https://docs.conda.io/).\n\nTo set up the build environment locally, see the \n[\"Build Instructions\"](https://derwen.ai/docs/kgl/build/)\nsection of the online documentation.\n</details>\n\n\n<details>\n  <summary>Semantic Versioning</summary>\n\nBefore <strong>kglab</strong> reaches release <code>v1.0.0</code> the \ntypes and classes may undergo substantial changes and the project is \nnot guaranteed to have a consistent API.\n\nEven so, we'll try to minimize breaking changes.\nWe'll also be sure to provide careful notes.\n\nSee:\n[changelog.txt](https://github.com/DerwenAI/kglab/blob/main/changelog.txt)\n</details>\n\n\n<details>\n  <summary>Contributing Code</summary>\n\nWe welcome people getting involved as contributors to this open source\nproject!\n\nFor detailed instructions please see:\n[CONTRIBUTING.md](https://github.com/DerwenAI/kglab/blob/main/CONTRIBUTING.md)\n</details>\n\n\n<details>\n  <summary>License and Copyright</summary>\n\nSource code for **kglab** plus its logo, documentation, and examples\nhave an [MIT license](https://spdx.org/licenses/MIT.html) which is\nsuccinct and simplifies use in commercial applications.\n\nAll materials herein are Copyright &copy; 2020-2022 Derwen, Inc.\n</details>\n\n\n<details>\n  <summary>Attribution</summary>\nPlease use the following BibTeX entry for citing **kglab** if you use\nit in your research or software.\nCitations are helpful for the continued development and maintenance of\nthis library.\n\n```bibtex\n@software{kglab,\n  author = {Paco Nathan},\n  title = {{kglab: a simple abstraction layer in Python for building knowledge graphs}},\n  year = 2020,\n  publisher = {Derwen},\n  doi = {10.5281/zenodo.6360664},\n  url = {https://github.com/DerwenAI/kglab}\n}\n```\n</details>\n\n\n<img\n alt=\"illustration of a knowledge graph, plus laboratory glassware\"\n src=\"https://raw.githubusercontent.com/DerwenAI/kglab/main/docs/assets/logo.png\"\n width=\"231\"\n/>\n\n\n## Kudos\n\nMany thanks to our open source [sponsors](https://github.com/sponsors/ceteri);\nand to our contributors:\n[@ceteri](https://github.com/ceteri),\n[@dvsrepo](https://github.com/dvsrepo),\n[@Ankush-Chander](https://github.com/Ankush-Chander),\n[@louisguitton](https://github.com/louisguitton),\n[@tomaarsen](https://github.com/tomaarsen),\n[@Mec-iS](https://github.com/Mec-iS),\n[@cutterkom](https://github.com/cutterkom),\n[@RishiKumarRay](https://github.com/RishiKumarRay),\n[@Tpt](https://github.com/Tpt),\n[@ArenasGuerreroJulian](https://github.com/ArenasGuerreroJulian),\n[@fils](https://github.com/fils),\n[@gauravjaglan](https://github.com/gauravjaglan),\n[@pebbie](https://github.com/pebbie),\n[@CatChenal](https://github.com/CatChenal),\n[@jake-aft](https://github.com/jake-aft),\n[@dmoore247](https://github.com/dmoore247),\nplus general support from [Derwen, Inc.](https://derwen.ai/);\nthe [Knowledge Graph Conference](https://www.knowledgegraph.tech/)\nand [Connected Data World](https://connected-data.world/);\nplus an even larger scope of [use cases](https://derwen.ai/docs/kgl/use_case/)\nrepresented by their communities;\n[Kubuntu Focus](https://kfocus.org/),\nthe [RAPIDS team @ NVIDIA](https://rapids.ai/),\n[Gradient Flow](https://gradientflow.com/),\nand\n[Manning Publications](https://www.manning.com/).\n\n<img\n alt=\"kglab contributors\"\n src=\"https://contributors-img.web.app/image?repo=derwenai/kglab\"\n/>\n\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=derwenai/kglab&type=Date)](https://star-history.com/#derwenai/kglab&Date)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A simple abstraction layer in Python for building knowledge graphs",
    "version": "0.6.6",
    "project_urls": {
        "DOI": "https://doi.org/10.5281/zenodo.6360664",
        "Discussions": "https://www.linkedin.com/groups/6725785/",
        "DockerHub": "https://hub.docker.com/r/derwenai/kglab",
        "Homepage": "https://derwen.ai/docs/kgl/",
        "Issues": "https://github.com/DerwenAI/kglab/issues",
        "Source": "https://github.com/DerwenAI/kglab",
        "Tutorial": "https://derwen.ai/docs/kgl/tutorial/"
    },
    "split_keywords": [
        "controlled vocabulary",
        "cugraph",
        "deep learning",
        "embedding",
        "gpu",
        "graph algorithms",
        "igraph",
        "inference",
        "interactive visualization",
        "json-ld",
        "knowledge graph",
        "managing namespaces",
        "morph-kgc",
        "n3",
        "networkx",
        "owl",
        "pandas",
        "parquet",
        "probabilistic soft logic",
        "psl",
        "pyvis",
        "rapids",
        "rdf",
        "rml",
        "roam research",
        "serialization",
        "shacl",
        "skos",
        "sparql",
        "statistical relational learning",
        "topology",
        "turtle",
        "validation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c8e8daecb9f77920bdcbba1ab772ca7ad990f39a3026aca00419411cc0667197",
                "md5": "97f72b9b3f22554338b4b7a1d5fe481e",
                "sha256": "8a8ee90b557ce2a167f70f7fe0c331fe609f1f0f850da8328f1eb953c26b14a6"
            },
            "downloads": -1,
            "filename": "kglab-0.6.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "97f72b9b3f22554338b4b7a1d5fe481e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 57409,
            "upload_time": "2022-11-24T02:49:12",
            "upload_time_iso_8601": "2022-11-24T02:49:12.381578Z",
            "url": "https://files.pythonhosted.org/packages/c8/e8/daecb9f77920bdcbba1ab772ca7ad990f39a3026aca00419411cc0667197/kglab-0.6.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c11b2ac759825153ec49e416e714f798abd1e1a2e1e7644c84acc245a38872c9",
                "md5": "03aba9a02f2b181e4bef0c9b1e20968f",
                "sha256": "a3bd85f01f16fc1e44449650132becee1afa47dd08ec105b52147adf2bbb7a78"
            },
            "downloads": -1,
            "filename": "kglab-0.6.6.tar.gz",
            "has_sig": false,
            "md5_digest": "03aba9a02f2b181e4bef0c9b1e20968f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 60783,
            "upload_time": "2022-11-24T02:49:14",
            "upload_time_iso_8601": "2022-11-24T02:49:14.263190Z",
            "url": "https://files.pythonhosted.org/packages/c1/1b/2ac759825153ec49e416e714f798abd1e1a2e1e7644c84acc245a38872c9/kglab-0.6.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-11-24 02:49:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "DerwenAI",
    "github_project": "kglab",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "kglab"
}
        
Elapsed time: 0.11512s