Metadata-Version: 2.1
Name: morph_kgc
Version: 2.5.0
Summary: Powerful [R2]RML engine to create RDF knowledge graphs from heterogeneous data sources.
Project-URL: Documentation, https://morph-kgc.readthedocs.io/en/latest/documentation/
Project-URL: Source, https://github.com/morph-kgc/morph-kgc
Project-URL: Tracker, https://github.com/morph-kgc/morph-kgc/issues
Project-URL: CI, https://github.com/morph-kgc/morph-kgc/actions
Project-URL: Homepage, https://morph-kgc.readthedocs.io/en/latest/
Project-URL: History, https://github.com/morph-kgc/morph-kgc/releases
Author-email: Julián Arenas-Guerrero <julian.arenas.guerrero@upm.es>
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: Data Integration,Knowledge Graph,Morph-KGC,R2RML,RDF,RML,RML-star
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Database
Classifier: Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator
Classifier: Topic :: Software Development :: Pre-processors
Classifier: Topic :: Utilities
Requires-Python: >=3.7
Requires-Dist: duckdb<2.0.0,>=0.7.0
Requires-Dist: elementpath<5.0.0,>=4.0.1
Requires-Dist: falcon<4.0.0,>=3.0.0
Requires-Dist: jsonpath-python<2.0.0,>=1.0.6
Requires-Dist: pandas<2.0.0,>=1.4.0
Requires-Dist: pyoxigraph<1.0.0,>=0.3.10
Requires-Dist: rdflib<7.0.0,>=6.1.1
Requires-Dist: sql-metadata<3.0.0,>=2.6.0
Requires-Dist: sqlalchemy<2.0.0,>=1.4.0
Provides-Extra: all
Requires-Dist: morph-kgc[excel]; extra == 'all'
Requires-Dist: morph-kgc[mssql]; extra == 'all'
Requires-Dist: morph-kgc[mysql]; extra == 'all'
Requires-Dist: morph-kgc[oracle]; extra == 'all'
Requires-Dist: morph-kgc[postgresql]; extra == 'all'
Requires-Dist: morph-kgc[spss]; extra == 'all'
Requires-Dist: morph-kgc[tabular]; extra == 'all'
Provides-Extra: excel
Requires-Dist: odfpy<2.0.0,>=1.4.1; extra == 'excel'
Requires-Dist: openpyxl<4.0.0,>=3.0.0; extra == 'excel'
Provides-Extra: mssql
Requires-Dist: pymssql<3.0.0,>=2.2.7; extra == 'mssql'
Provides-Extra: mysql
Requires-Dist: cryptography<40.0.0,>=39.0.0; extra == 'mysql'
Requires-Dist: pymysql<2.0.0,>=1.0.2; extra == 'mysql'
Provides-Extra: oracle
Requires-Dist: cx-oracle<9.0.0,>=8.3.0; extra == 'oracle'
Provides-Extra: performance
Requires-Dist: bottleneck<2.0.0,>=1.3.0; extra == 'performance'
Requires-Dist: numexpr<3.0.0,>=2.7.0; extra == 'performance'
Provides-Extra: postgresql
Requires-Dist: psycopg2-binary<3.0.0,>=2.9.5; extra == 'postgresql'
Provides-Extra: spss
Requires-Dist: pyreadstat<2.0.0,>=1.2.0; extra == 'spss'
Provides-Extra: tabular
Requires-Dist: pyarrow<12.0.0,>=11.0.0; extra == 'tabular'
Provides-Extra: test
Requires-Dist: odfpy<2.0.0,>=1.4.1; extra == 'test'
Requires-Dist: openpyxl<4.0.0,>=3.0.0; extra == 'test'
Requires-Dist: pyarrow<12.0.0,>=11.0.0; extra == 'test'
Requires-Dist: pytest<8.0.0,>=7.0.0; extra == 'test'
Description-Content-Type: text/markdown

<p align="center">
<img src="https://github.com/morph-kgc/morph-kgc/blob/main/docs/assets/logo.png" height="100" alt="morph">
</p>

[![License](https://img.shields.io/pypi/l/morph-kgc.svg)](https://github.com/morph-kgc/morph-kgc/blob/main/LICENSE)
[![DOI](https://zenodo.org/badge/311956260.svg?style=flat)](https://zenodo.org/badge/latestdoi/311956260)
[![Latest PyPI version](https://img.shields.io/pypi/v/morph-kgc?style=flat)](https://pypi.python.org/pypi/morph-kgc)
[![Python Version](https://img.shields.io/pypi/pyversions/morph-kgc.svg)](https://pypi.python.org/pypi/morph-kgc)
[![PyPI status](https://img.shields.io:/pypi/status/morph-kgc?)](https://pypi.python.org/pypi/morph-kgc)
[![build](https://github.com/morph-kgc/morph-kgc/actions/workflows/ci.yml/badge.svg)](https://github.com/morph-kgc/morph-kgc/actions/workflows/ci.yml)
[![Documentation Status](https://readthedocs.org/projects/morph-kgc/badge/?version=latest)](https://morph-kgc.readthedocs.io/en/latest/?badge=latest)
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1ByFx_NOEfTZeaJ1Wtw3UwTH3H3-Sye2O?usp=sharing)

**Morph-KGC** is an engine that constructs **[RDF](https://www.w3.org/TR/rdf11-concepts/)** and **[RDF-star](https://w3c.github.io/rdf-star/cg-spec/2021-12-17.html)** knowledge graphs from heterogeneous data sources with the **[R2RML](https://www.w3.org/TR/r2rml/)**, **[RML](https://rml.io/specs/rml/)** and **[RML-star](https://kg-construct.github.io/rml-star-spec/)** mapping languages. Morph-KGC is built on top of [pandas](https://pandas.pydata.org/) and it leverages *mapping partitions* to significantly reduce execution times and memory consumption for large data sources.

## Features :sparkles:

- Supports **[R2RML](https://www.w3.org/TR/r2rml/)**, **[RML](https://rml.io/specs/rml/)** and **[RML-star](https://kg-construct.github.io/rml-star-spec/)** mapping languages.
- Transformation functions with **[RML+FnO](https://kg-construct.github.io/fnml-spec/)**.
- **[RML views](https://www.w3.org/TR/r2rml/#r2rml-views)** over tabular data sources and **[JSON](https://www.json.org)** files.
- Input data formats:
    - **Relational databases**: **[MySQL](https://www.mysql.com/)**, **[PostgreSQL](https://www.postgresql.org/)**, **[Oracle](https://www.oracle.com/database/)**, **[Microsoft SQL Server](https://www.microsoft.com/sql-server)**, **[MariaDB](https://mariadb.org/)**, **[SQLite](https://www.sqlite.org)**.
    - **Tabular files**: **[CSV](https://en.wikipedia.org/wiki/Comma-separated_values)**, **[TSV](https://en.wikipedia.org/wiki/Tab-separated_values)**, **[Excel](https://www.microsoft.com/en-us/microsoft-365/excel)**, **[Parquet](https://parquet.apache.org/documentation/latest/)**, **[Feather](https://arrow.apache.org/docs/python/feather.html)**, **[ORC](https://orc.apache.org/)**, **[Stata](https://www.stata.com/)**, **[SAS](https://www.sas.com)**, **[SPSS](https://www.ibm.com/analytics/spss-statistics-software)**, **[ODS](https://en.wikipedia.org/wiki/OpenDocument)**.
    - **Hierarchical files**: **[JSON](https://www.json.org)**, **[XML](https://www.w3.org/TR/xml/)**.
    - **In-memory data structures**: **[Python Dictionaries](https://docs.python.org/3/tutorial/datastructures.html#dictionaries)**, **[DataFrames](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html)**.
- Integration with **[RDFLib](https://rdflib.readthedocs.io)** and **[Oxigraph](https://pyoxigraph.readthedocs.io/en/latest/)**.
- **Remote** data files and mapping files.
- **Optimized** to materialize large knowledge graphs.
- Runs on **Linux**, **Windows** and **macOS** systems.

## Documentation :bookmark_tabs:

**[Read the documentation](https://morph-kgc.readthedocs.io/en/latest/documentation/)**.

## Tutorial :woman_teacher:

Learn quickly with the tutorial in **[Google Colaboratory](https://colab.research.google.com/drive/1ByFx_NOEfTZeaJ1Wtw3UwTH3H3-Sye2O?usp=sharing)**!

## Getting Started :rocket:

**[PyPi](https://pypi.org/project/morph-kgc/)** is the fastest way to install Morph-KGC:
```bash
pip install morph-kgc
```

We recommend to use **[virtual environments](https://docs.python.org/3/library/venv.html#)** to install Morph-KGC.

To run the engine via **command line** you just need to execute the following:
```bash
python3 -m morph_kgc config.ini
```

Check the **[documentation](https://morph-kgc.readthedocs.io/en/latest/documentation/#configuration)** to see how to generate the configuration **INI file**. **[Here](https://github.com/morph-kgc/morph-kgc/blob/main/examples/configuration-file/default_config.ini)** you can also see an example INI file.

It is also possible to run Morph-KGC as a **library** with **[RDFLib](https://rdflib.readthedocs.io)** and **[Oxigraph](https://pyoxigraph.readthedocs.io/en/latest/)**:
```python
import morph_kgc

# generate the triples and load them to an RDFLib graph
g_rdflib = morph_kgc.materialize('/path/to/config.ini')
# work with the RDFLib graph
q_res = g_rdflib.query('SELECT DISTINCT ?classes WHERE { ?s a ?classes }')

# generate the triples and load them to Oxigraph
g_oxigraph = morph_kgc.materialize_oxigraph('/path/to/config.ini')
# work with Oxigraph
q_res = g_oxigraph.query('SELECT DISTINCT ?classes WHERE { ?s a ?classes }')

# the methods above also accept the config as a string
config = """
            [DataSource1]
            mappings: /path/to/mapping/mapping_file.rml.ttl
            db_url: mysql+pymysql://user:password@localhost:3306/db_name
         """
g_rdflib = morph_kgc.materialize(config)
```

## License :unlock:

Morph-KGC is available under the **[Apache License 2.0](https://github.com/morph-kgc/morph-kgc/blob/main/LICENSE)**.

## Author & Contact :mailbox_with_mail:

- **[Julián Arenas-Guerrero](https://github.com/arenas-guerrero-julian/) - [julian.arenas.guerrero@upm.es](mailto:julian.arenas.guerrero@upm.es)**

*[Ontology Engineering Group](https://oeg.fi.upm.es)*, *[Universidad Politécnica de Madrid](https://www.upm.es/internacional)*.

## Citing :speech_balloon:

If you used Morph-KGC in your work, please cite the **[SWJ paper](https://content.iospress.com/download/semantic-web/sw223135?id=semantic-web%2Fsw223135)**:

```bib
@article{arenas2022morph,
  title   = {{Morph-KGC: Scalable knowledge graph materialization with mapping partitions}},
  author  = {Arenas-Guerrero, Julián and Chaves-Fraga, David and Toledo, Jhon and Pérez, María S. and Corcho, Oscar},
  journal = {Semantic Web},
  year    = {2022},
  doi     = {10.3233/SW-223135}
}
```

## Contributors :woman_technologist:

See the full list of contributors **[here](https://github.com/morph-kgc/morph-kgc/graphs/contributors)**.

## Sponsor :shield:

<p align="center">
<img src="https://github.com/morph-kgc/morph-kgc/blob/main/docs/assets/BASF.png" height="100" alt="BASF">
</p>
