MOI: MeSH Ontology Importer for Neo4j
MOI imports a MeSH ontology file into a Neo4j graph database and performs postprocessing for consistent labeling and property handling.
Quickstart
Create a configuration file with your Neo4j connection details.
For example, save it in your home directory as moi.conf
:
[neo4j]
uri = bolt://localhost:7687
username = neo4j
password = myfancypassword
Start the program by providing the location of your configuration file and the folder containing the ontology files:
python3 src/moi.py --conf ~/moi.conf --files ~/mesh_files
Requirements
- make sure python3 is installed
- install the required libraries with
pip install -r requirements.txt
- have a running Neo4j instance (version 5)
- the Neo4j instance must have the Neosemantics and APOC plugin installed
- ontology files must be provided in one of the supported formats:
.owl
,.xrdf
,.ttl
,.nt
- create the configuration file as described in the Quickstart section
General structure of the repository
The two main scripts that do things are:
methods_moi.py
– contains helper functions for:
- creating the Neo4j graph configuration (constraints, n10s settings)
- importing ontology files into Neo4j
- postprocessing imported MeSH nodes (renaming labels, flattening properties)
moi.py
– the main scripts:
- loads configuration
- iterates over ontology files
- *runs the import and postprocessing steps