Skip to content

Latest commit

 

History

History
82 lines (54 loc) · 3.91 KB

README.md

File metadata and controls

82 lines (54 loc) · 3.91 KB

OBG-gen: Ontology-Based GraphQL Server Generation for Data Access and Integration

OBG-gen Logo

A GraphQL-based framework for data access and integration in which a global domain ontology drives the generation of a GraphQL server that answers requests by querying the heterogeneous data sources. The core of this framework contains an algorithm to generate a GraphQL schema based on an ontology, and a generic GraphQL resolver function as a library based on semantic mappings.

The Framework of OBG-gen for Data Access and Integration

entities

  • GrapahQL Server Generation Process
    • (i): Ontology-based GraphQL schema generation
    • (ii): Generic resolver function implementation based on semantic mappings

Getting Started

Installation (tested with python version 3.9)

  • Following packages are needed and successfully installed messages are shown:
pip install ariadne
pip install Flask
pip install requests
pip install pandas
pip install sqlalchemy
pip install sympy
pip install PyMySQL
pip install rdflib

Successfully installed anyio-3.4.0 ariadne-0.14.0 graphql-core-3.1.6 idna-3.3 sniffio-1.2.0 starlette-0.17.1 typing-extensions-4.0.1
Successfully installed Flask-2.0.2 Jinja2-3.0.3 MarkupSafe-2.0.1 Werkzeug-2.0.2 click-8.0.3 itsdangerous-2.0.1
Successfully installed charset-normalizer-2.0.8 requests-2.26.0 urllib3-1.26.7
Successfully installed numpy-1.21.4 pandas-1.3.4 python-dateutil-2.8.2 pytz-2021.3 six-1.16.0
Successfully installed greenlet-1.1.2 sqlalchemy-1.4.27
Successfully installed mpmath-1.2.1 sympy-1.9
Successfully installed PyMySQL-1.0.2
Successfully installed isodate-0.6.0 pyparsing-3.0.6 rdflib-6.0.2

Usage

Pre-Step (i): Generate GraphQL schema from an ontology and output (*)-schema.graphql and (*)2graphql.json files in current folder.

python ./schema_generator/graphql_schema_gen.py ./schema_generator/mdo.ttl

Pre-Step (ii): Parse a RML mappings file and output the (*).json file in current folder, which will be an input of the generic resolver function.

python ./mapping_parser/mapping_parser.py ./mapping_parser/semantic_mappings/mdo-mappings-mysql-1K.ttl

Step 1: Set up the GraphQL server.

python app.py ./schema_generator/mdo-schema.graphql ./schema_generator/mdo2graphql.json ./mapping_parser/mdo-mappings-mysql-1K.json 

* Serving Flask app "app" (lazy loading)
* Environment: development
* Debug mode: on
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger PIN: 540-041-748

Then the GraphQL server can be accessed via http://127.0.0.1:5000/graphql as shown below.

first_query

You don't have to re-run Pre-Step (i) and/or Pre-Step (ii) if you have not changed your ontology and/or RML mappings.

Evaluation

You can find more details regarding the evaluation of the framework in this folder.

Publication

Li H, Hartig O, Armiento R, Lambrix P. Ontology-based GraphQL server generation for data access and data integration. Semantic Web. 2024. DOI: 10.3233/SW-233550