Metadata-Version: 2.4
Name: momapy_kb
Version: 0.4.1
Summary: Momapy maps to KB
Author-email: Adrien Rougny <adrienrougny@gmail.com>
License: GPL-3.0-or-later
License-File: COPYING
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.10
Requires-Dist: colorama>=0.4.6
Requires-Dist: fieldz-kb>=0.3.1
Requires-Dist: frozendict>=2.4.6
Requires-Dist: jinja2>=3.1.3
Requires-Dist: momapy>=0.13.0
Provides-Extra: all
Requires-Dist: fieldz-kb[clingo]; extra == 'all'
Requires-Dist: fieldz-kb[falkordb]; extra == 'all'
Requires-Dist: fieldz-kb[falkordblite]; extra == 'all'
Requires-Dist: fieldz-kb[neo4j]; extra == 'all'
Provides-Extra: clingo
Requires-Dist: fieldz-kb[clingo]; extra == 'clingo'
Provides-Extra: falkordb
Requires-Dist: fieldz-kb[falkordb]; extra == 'falkordb'
Provides-Extra: falkordblite
Requires-Dist: fieldz-kb[falkordblite]; extra == 'falkordblite'
Provides-Extra: neo4j
Requires-Dist: fieldz-kb[neo4j]; extra == 'neo4j'
Description-Content-Type: text/markdown

# momapy_kb

[![License](https://img.shields.io/github/license/adrienrougny/momapy_kb)](<https://github.com/adrienrougny/momapy_kb/blob/main/COPYING>)
A library to integrate SBGN and CellDesigner maps into graph databases and logic programs.
This library relies on [momapy](https://github.com/adrienrougny/momapy) for handling maps.

## Features

- **Multiple Labelled Property Graph backends**: save maps in a Neo4j, FalkorDB or FalkorDBLite (embedded) database
- **A Clingo/ASP backend**: convert maps to logic programming facts
- **Collection management**: organize maps into named collections
- **Layout element queries**: query model elements and retrieve corresponding layout elements for rendering

## Installation

```bash
pip install momapy-kb[neo4j]        # Neo4j support
pip install momapy-kb[falkordb]     # FalkorDB support
pip install momapy-kb[falkordblite] # FalkorDBLite (embedded) support
pip install momapy-kb[clingo]       # Clingo/ASP support
pip install momapy-kb[all]          # Everything
```

## Quick example

```python
import momapy_kb.lpg.session
import momapy_kb.lpg.backends.neo4j

backend = momapy_kb.lpg.backends.neo4j.Neo4jBackend(
    hostname="localhost",
    username="neo4j",
    password="password",
)

with momapy_kb.lpg.session.Session(backend) as session:
    # save a CellDesigner map to the Neo4j database
    session.save_from_file("model.xml", integration_mode="hash")

    # query model elements, return them as momapy objects
    results = session.execute_query_as_objects(
        "MATCH (n:Protein) RETURN n"
    )

    # query model elements, return corresponding layout elements
    layout_results = session.execute_query_as_layout_elements(
        "MATCH (n:Reaction) RETURN n"
    )
```

## Documentation

Full documentation is available at [https://adrienrougny.github.io/momapy_kb/](https://adrienrougny.github.io/momapy_kb/).
