Powerful [R2]RML engine to create RDF knowledge graphs from heterogeneous data sources.
Project description
Morph-KGC is an engine that constructs RDF and RDF-star knowledge graphs from heterogeneous data sources with the R2RML, RML and RML-star mapping languages. Morph-KGC is built on top of pandas and it leverages mapping partitions to significantly reduce execution times and memory consumption for large data sources.
Citing Morph-KGC: If you used Morph-KGC in your work, please cite the SWJ paper:
@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}
}
Main Features
- Supports R2RML, RML and RML-star mapping languages.
- Input data formats:
- Output RDF and RDF-star serializations: N-Triples, N-Triples-star, N-Quads, N-Quads-star.
- Integration with RDFLib and Oxigraph.
- Remote data files and mapping files.
- Runs on Linux, Windows and macOS systems.
- Compatible with Python 3.7 or higher.
- Optimized to materialize large knowledge graphs.
Documentation
Tutorial
Learn quickly with the tutorial in Google Colaboratory!
Getting Started
PyPi is the fastest way to install Morph-KGC:
pip install morph-kgc
We recommend to use virtual environments to install Morph-KGC.
To run the engine via command line you just need to execute the following:
python3 -m morph_kgc config.ini
Check the documentation to see how to generate the configuration INI file. Here you can also see an example INI file.
It is also possible to run Morph-KGC as a library with RDFLib and Oxigraph:
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 = graph.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
Morph-KGC is available under the Apache License 2.0.
Author
Ontology Engineering Group, Universidad Politécnica de Madrid.
Contributors
See the full list of contributors here.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for morph_kgc-2.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc6277257afbbb7d2d8581e89627efd3fdf12e890a428521762e5827eb9a9a10 |
|
MD5 | 8296b2cd15b0a4fea1364e725d529a97 |
|
BLAKE2b-256 | 0a044cf8b1f4b8189991fc40204d6f6e20408559da0994708cf90ee959a9d63a |