Powerful RDF Knowledge Graph Generation with [R2]RML Mappings
×
morph-kgc
Powerful RDF Knowledge Graph Generation with [R2]RML Mappings
×
License
Description:
Loading...
Permissions:
- Loading...
Conditions:
- Loading...
Limitations:
- Loading...
×
Usage
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 can 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)