Name | pyMogwai JSON |
Version |
0.1.1
JSON |
| download |
home_page | None |
Summary | PyMogwai is a Python-based implementation of the Gremlin graph traversal language, designed to create and handle knowledge graphs entirely in Python without the need for an external Gremlin server. |
upload_time | 2025-07-28 06:15:30 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | None |
keywords |
graph traversal
gremlin
knowledge graph
nicegui
pymogwai
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# PyMogwai
PyMogwai is a Python-based implementation of the Gremlin graph traversal language, designed to create and handle knowledge graphs entirely in Python without the need for an external Gremlin server.
[](https://pypi.org/project/pyMogwai/)
[](https://github.com/juupje/pyMogwai/actions/workflows/build.yml)
[](https://pypi.python.org/pypi/pyMogwai/)
[](https://github.com/juupje/pyMogwai/issues)
[](https://github.com/juupje/pyMogwai/issues/?q=is%3Aissue+is%3Aclosed)
[](https://juupje.github.io/pyMogwai/)
[](https://www.apache.org/licenses/LICENSE-2.0)
## Features
* Supports knowledge graph creation and manipulation
* Supports the import of arbitrary knowledge graphs with GraphML
* Implements a variety of traversal steps
* Enables one to traverse a graph with these steps
* Ability to integrate data from various sources like Excel, PDF and PowerPoint
* Simple and Pythonic API for graph operations
## Demo
[nicegui based demo](https://mogwai.bitplan.com/)
## Getting started
### Creating a Knowledge Graph
To create a graph using PyMogwai
```python
from mogwai.core import MogwaiGraph
graph = MogwaiGraph()
# Add nodes and edges
n1 = graph.add_labeled_node("person", name="Alice", properties={"Age": 30})
n2 = graph.add_labeled_node("person", name="Bob", properties={"Age": 28})
graph.add_labeled_edge(n1, n2, "knows")
```
### Import graphs
```python
from mogwai.parser.graphml_converter import graphml_to_mogwaigraph
graph = graphml_to_mogwaigraph(path, node_label_key="node_label", node_name_key="node_name", edge_label_key="edge_label")
```
### Performing Traversals
To perform any traversal of the graph, create a TraversalSource. Traversals start with a start step (`V()` or `E()`), which is followed by a sequence of steps. Note that a traversal can be executed by calling `.run()` on it.
```python
from mogwai.core.traversal import MogwaiGraphTraversalSource
g = MogwaiGraphTraversalSource(graph)
# Example traversal that returns every person in the graph as a list
res = g.V().has_label("person").to_list().run()
print(res)
```
In order to use anonymous traversal in complex queries, import the statics module:
```python
from mogwai.core.traversal import MogwaiGraphTraversalSource
from mogwai.core.steps.statics import *
g = MogwaiGraphTraversalSource(graph)
# Example traversal that returns every person in the graph as a list
query = g.V().has_label("person").filter_(properties('age').is_(gte(30))).to_list().by('name')
res = query.run()
print(res)
```
# History
This project started as part of the [RWTH Aachen i5 Knowledge Graph Lab SS2024](https://dbis.rwth-aachen.de/dbis/index.php/2023/knowledge-graph-lab-ss-2024/)
The original source is hosted at https://git.rwth-aachen.de/i5/teaching/kglab/ss2024/pymogwai
2024-08-15 the repository moved to github for better pypi integration
Raw data
{
"_id": null,
"home_page": null,
"name": "pyMogwai",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "Joep Geuskens <joep.geuskens@rwth-aachen.de>, Wolfgang Fahl <wf@bitplan.com>",
"keywords": "graph traversal, gremlin, knowledge graph, nicegui, pyMogwai",
"author": null,
"author_email": "Joep Geuskens <joep.geuskens@rwth-aachen.de>, Wolfgang Fahl <wf@bitplan.com>",
"download_url": "https://files.pythonhosted.org/packages/a4/c3/9cdf6d370d5c6e7bff18e9c1aa2ba58adcac774cd32cc39e7679883995fa/pymogwai-0.1.1.tar.gz",
"platform": null,
"description": "# PyMogwai\nPyMogwai is a Python-based implementation of the Gremlin graph traversal language, designed to create and handle knowledge graphs entirely in Python without the need for an external Gremlin server.\n\n[](https://pypi.org/project/pyMogwai/)\n[](https://github.com/juupje/pyMogwai/actions/workflows/build.yml)\n[](https://pypi.python.org/pypi/pyMogwai/)\n[](https://github.com/juupje/pyMogwai/issues)\n[](https://github.com/juupje/pyMogwai/issues/?q=is%3Aissue+is%3Aclosed)\n[](https://juupje.github.io/pyMogwai/)\n[](https://www.apache.org/licenses/LICENSE-2.0)\n\n## Features\n* Supports knowledge graph creation and manipulation\n* Supports the import of arbitrary knowledge graphs with GraphML\n* Implements a variety of traversal steps\n* Enables one to traverse a graph with these steps\n* Ability to integrate data from various sources like Excel, PDF and PowerPoint\n* Simple and Pythonic API for graph operations\n\n## Demo\n[nicegui based demo](https://mogwai.bitplan.com/)\n\n\n## Getting started\n\n### Creating a Knowledge Graph\nTo create a graph using PyMogwai\n```python\nfrom mogwai.core import MogwaiGraph\ngraph = MogwaiGraph()\n\n# Add nodes and edges\nn1 = graph.add_labeled_node(\"person\", name=\"Alice\", properties={\"Age\": 30})\nn2 = graph.add_labeled_node(\"person\", name=\"Bob\", properties={\"Age\": 28})\ngraph.add_labeled_edge(n1, n2, \"knows\")\n```\n### Import graphs\n```python\nfrom mogwai.parser.graphml_converter import graphml_to_mogwaigraph\n\ngraph = graphml_to_mogwaigraph(path, node_label_key=\"node_label\", node_name_key=\"node_name\", edge_label_key=\"edge_label\")\n```\n\n### Performing Traversals\nTo perform any traversal of the graph, create a TraversalSource. Traversals start with a start step (`V()` or `E()`), which is followed by a sequence of steps. Note that a traversal can be executed by calling `.run()` on it.\n\n\n```python\nfrom mogwai.core.traversal import MogwaiGraphTraversalSource\n\ng = MogwaiGraphTraversalSource(graph)\n\n# Example traversal that returns every person in the graph as a list\nres = g.V().has_label(\"person\").to_list().run()\nprint(res)\n```\n\nIn order to use anonymous traversal in complex queries, import the statics module:\n\n```python\nfrom mogwai.core.traversal import MogwaiGraphTraversalSource\nfrom mogwai.core.steps.statics import *\n\ng = MogwaiGraphTraversalSource(graph)\n\n# Example traversal that returns every person in the graph as a list\nquery = g.V().has_label(\"person\").filter_(properties('age').is_(gte(30))).to_list().by('name')\nres = query.run()\nprint(res)\n```\n\n# History\nThis project started as part of the [RWTH Aachen i5 Knowledge Graph Lab SS2024](https://dbis.rwth-aachen.de/dbis/index.php/2023/knowledge-graph-lab-ss-2024/)\nThe original source is hosted at https://git.rwth-aachen.de/i5/teaching/kglab/ss2024/pymogwai\n2024-08-15 the repository moved to github for better pypi integration",
"bugtrack_url": null,
"license": null,
"summary": "PyMogwai is a Python-based implementation of the Gremlin graph traversal language, designed to create and handle knowledge graphs entirely in Python without the need for an external Gremlin server.",
"version": "0.1.1",
"project_urls": {
"Documentation": "https://cr.bitplan.com/index.php/pyMogwai",
"Home": "https://github.com/juupje/pyMogwai",
"Source": "https://github.com/juupje/pyMogwai"
},
"split_keywords": [
"graph traversal",
" gremlin",
" knowledge graph",
" nicegui",
" pymogwai"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "2eb3114d17fd7fca6598b845db70c9c562e373af94580c89812406acb64cfda1",
"md5": "9c8584e55b7186d6f25eb88ffa923c16",
"sha256": "0ab514bce96122d8a63c36fb18e61ec11991a0b7aa67940f8af7cf8fea11ebc9"
},
"downloads": -1,
"filename": "pymogwai-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9c8584e55b7186d6f25eb88ffa923c16",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 1022112,
"upload_time": "2025-07-28T06:15:28",
"upload_time_iso_8601": "2025-07-28T06:15:28.970850Z",
"url": "https://files.pythonhosted.org/packages/2e/b3/114d17fd7fca6598b845db70c9c562e373af94580c89812406acb64cfda1/pymogwai-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a4c39cdf6d370d5c6e7bff18e9c1aa2ba58adcac774cd32cc39e7679883995fa",
"md5": "d8cf7dba824b595a486153ed22c07953",
"sha256": "1a53d4e111e293ff481fc4f80e0a66365d0217b757bd53fbf0d2d7892aa342e6"
},
"downloads": -1,
"filename": "pymogwai-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "d8cf7dba824b595a486153ed22c07953",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 6685055,
"upload_time": "2025-07-28T06:15:30",
"upload_time_iso_8601": "2025-07-28T06:15:30.868061Z",
"url": "https://files.pythonhosted.org/packages/a4/c3/9cdf6d370d5c6e7bff18e9c1aa2ba58adcac774cd32cc39e7679883995fa/pymogwai-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-28 06:15:30",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "juupje",
"github_project": "pyMogwai",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pymogwai"
}