pyMogwai


NamepyMogwai JSON
Version 0.0.8 PyPI version JSON
download
home_pageNone
SummaryPyMogwai 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_time2024-11-20 17:16:10
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseApache-2.0
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.

[![pypi](https://img.shields.io/pypi/pyversions/pyMogwai)](https://pypi.org/project/pyMogwai/)
[![Github Actions Build](https://github.com/juupje/pyMogwai/actions/workflows/build.yml/badge.svg)](https://github.com/juupje/pyMogwai/actions/workflows/build.yml)
[![PyPI Status](https://img.shields.io/pypi/v/pyMogwai.svg)](https://pypi.python.org/pypi/pyMogwai/)
[![GitHub issues](https://img.shields.io/github/issues/juupje/pyMogwai.svg)](https://github.com/juupje/pyMogwai/issues)
[![GitHub closed issues](https://img.shields.io/github/issues-closed/juupje/pyMogwai.svg)](https://github.com/juupje/pyMogwai/issues/?q=is%3Aissue+is%3Aclosed)
[![API Docs](https://img.shields.io/badge/API-Documentation-blue)](https://juupje.github.io/pyMogwai/)
[![License](https://img.shields.io/github/license/juupje/pyMogwai.svg)](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/bc/86/a9453dda67050b05c7587cf4d772816a6fe5450d35205778a51649c55cb0/pymogwai-0.0.8.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[![pypi](https://img.shields.io/pypi/pyversions/pyMogwai)](https://pypi.org/project/pyMogwai/)\n[![Github Actions Build](https://github.com/juupje/pyMogwai/actions/workflows/build.yml/badge.svg)](https://github.com/juupje/pyMogwai/actions/workflows/build.yml)\n[![PyPI Status](https://img.shields.io/pypi/v/pyMogwai.svg)](https://pypi.python.org/pypi/pyMogwai/)\n[![GitHub issues](https://img.shields.io/github/issues/juupje/pyMogwai.svg)](https://github.com/juupje/pyMogwai/issues)\n[![GitHub closed issues](https://img.shields.io/github/issues-closed/juupje/pyMogwai.svg)](https://github.com/juupje/pyMogwai/issues/?q=is%3Aissue+is%3Aclosed)\n[![API Docs](https://img.shields.io/badge/API-Documentation-blue)](https://juupje.github.io/pyMogwai/)\n[![License](https://img.shields.io/github/license/juupje/pyMogwai.svg)](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": "Apache-2.0",
    "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.0.8",
    "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": "",
            "digests": {
                "blake2b_256": "443109dbf3ba11da8668265272be180d599074d320728122419c39653ae51044",
                "md5": "89d2624a23b00604c0ceee9604af228c",
                "sha256": "dbc8c75986e0b561287f33e89cc21df6feb4eea2f534125ad298bc4503a96304"
            },
            "downloads": -1,
            "filename": "pymogwai-0.0.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "89d2624a23b00604c0ceee9604af228c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 1013186,
            "upload_time": "2024-11-20T17:16:08",
            "upload_time_iso_8601": "2024-11-20T17:16:08.020172Z",
            "url": "https://files.pythonhosted.org/packages/44/31/09dbf3ba11da8668265272be180d599074d320728122419c39653ae51044/pymogwai-0.0.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bc86a9453dda67050b05c7587cf4d772816a6fe5450d35205778a51649c55cb0",
                "md5": "1eee211e34d514cdaecb13da4213e6fe",
                "sha256": "1ac96a441375fb481f3559a987b9f48c34ad6fc698bb14e93906e86bd2a3e1a1"
            },
            "downloads": -1,
            "filename": "pymogwai-0.0.8.tar.gz",
            "has_sig": false,
            "md5_digest": "1eee211e34d514cdaecb13da4213e6fe",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 6613925,
            "upload_time": "2024-11-20T17:16:10",
            "upload_time_iso_8601": "2024-11-20T17:16:10.051484Z",
            "url": "https://files.pythonhosted.org/packages/bc/86/a9453dda67050b05c7587cf4d772816a6fe5450d35205778a51649c55cb0/pymogwai-0.0.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-20 17:16:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "juupje",
    "github_project": "pyMogwai",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pymogwai"
}
        
Elapsed time: 1.53402s