Skip to content

Commit

Permalink
Bug fixes in Docker deployment + rel 1.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
frmichel committed Aug 23, 2023
1 parent 0c34bf2 commit f501790
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 22 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog

## [CURRENT 1.3.2 SNAPSHOT] 2022-01-12
## [CURRENT 1.3.2] 2023-08-23

Add Docker deplyment.

## [1.3.2 SNAPSHOT] 2022-01-12
- fix bug in sha1() mixed path
- document the sha1() mixed path
- (partially) fix bug in pushDown: for any field that is an ObjectID with $oid field (such as "_id"), the value of the $oid is pushed instead of the serialization f the field itself
Expand Down
10 changes: 5 additions & 5 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
"license": "https://spdx.org/licenses/Apache-2.0",
"codeRepository": "https://github.com/frmichel/morph-xr2rml",
"datePublished": "2015-04-02",
"dateModified": "2021-07-30",
"dateModified": "2023-08-23",
"downloadUrl": "https://www.dropbox.com/sh/djnztipsclvcskw/AABT1JagzD4K4aCALDNVj-yra?dl=0",
"issueTracker": "https://github.com/frmichel/morph-xr2rml/issues",
"name": "Morph-xR2RML",
"version": "1.3.1",
"name": "Morph-xR2RML: MongoDB-to-RDF translation",
"version": "1.3.2",
"identifier": "10.5281/zenodo.5148233",
"description": "Morph-xR2RML is an implementation of the xR2RML mapping language that enables the description of mappings from relational or non relational databases to RDF. It comes with connectors for relational databases (MySQL, PostgreSQL, MonetDB) and the MongoDB NoSQL database.",
"developmentStatus": "active",
"description": "Morph-xR2RML is an implementation of the xR2RML mapping language (https://www.i3s.unice.fr/~fmichel/xr2rml_specification_v5.1.html) that enables the description of mappings from relational or non relational databases to RDF. It comes with connectors for relational databases (MySQL, PostgreSQL, MonetDB) and the MongoDB NoSQL database.",
"developmentStatus": "inactive",
"referencePublication": [
"https://hal.science/hal-01207828",
"https://hal.science/hal-01280951",
Expand Down
15 changes: 7 additions & 8 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,31 @@ docker-compose up -d

Now, both containers are started and ready to process data.

Script `run.sh` provides an example of how to (1) import data located in `mongo_import` into MongoDB, and (2) run Morph-xR2RML to translate the data to RDF and store the result in `xr2rml_output`.
Script `run.sh` provides an example of how to run the different steps manually: (1) import data located in `mongo_import` into MongoDB, and (2) run Morph-xR2RML to translate the data to RDF and store the result in `xr2rml_output`.


### Description of each folder

- `mongo_db`: will contain the actual Mongo database, so that you don't need to re-import files everytime you rerun it.
- `mongo_db`: will contain the actual Mongo database, so that you don't need to re-import files everytime you rerun Morph-xR2RML.
- `mongo_tools`: set of handy bash scripts to import json/csv/tsv data into MongoDB.
- `mongo_import`: copy your files to import in this folder, it is mouned in the MongoDB container.
- `xr2rml_config`: mapping files, morph.properties, log configuration file, and bash scripts to run Morph-xR2RML. This folder is mouned in the Morph-xR2RML container.
- `mongo_import`: copy your files to import in this folder, it is moutned in the MongoDB container.
- `xr2rml_config`: mapping files (morph.properties, log configuration file) and bash scripts to run Morph-xR2RML. This folder is mounted in the Morph-xR2RML container.
- `xr2rml_config`: where the RDF files will be written.
- `run.sh`: example script showing how to import data into MongoDB and run Morph-xR2RML to translate the data to RDF.
- `run.sh`: example script showing how to use evrything from your machine, i.e. to import data into MongoDB and run Morph-xR2RML to translate the data to RDF.



### Accessing Logs

The `docker-compose.yml` mounts the Morph-xR2RML log directory to the Docker host in directory `log`.

Check it if an error occurs or if your mapping does not generate the expected triples.


### Changing Morph-xR2RML configuration and mappings

Put your mapping files in folder `xr2rml_config`. Script `run_xr2rml.sh` will be used to run the transltation from within the container.
Put your mapping files in folder `xr2rml_config`. Script `xr2rml_config/run_xr2rml.sh` will be used to run the transltation from within the container.

Mapping files can also be templates, with 2 predefined placeholders: `{{collection}}` and `{{dataset}}`. Script `run_xr2rml_template.sh` wil replace them before running the translation. Check the example mapping `xr2rml_config/mapping_movies.ttl` and how it is used by script `run.sh`.
Mapping files can also be templates, with 2 predefined placeholders: `{{collection}}` and `{{dataset}}`. Script `xr2rml_config/run_xr2rml_template.sh` will replace them before running the translation. Check the example mapping `xr2rml_config/mapping_movies.ttl` and how it is used by script `run.sh`.

The main Morph-xR2RML configuration file is editable at ```xr2rml_config/morph.properties```. In particular that's where you would change the name of the MongoDB database.

Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3.2'
services:

morph-xr2rml:
image: frmichel/morph-xr2rml
image: frmichel/morph-xr2rml:1.3.2
container_name: morph-xr2rml
networks:
- xr2rml-net
Expand Down
2 changes: 1 addition & 1 deletion docker/mongo_tools/import-file.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ index_col=$5
if [[ -z "$index_col" ]] ; then help; fi

# Optional
extra_script=$5
extra_script=$6


# Functions definitions
Expand Down
2 changes: 1 addition & 1 deletion docker/mongo_tools/import-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ mongo_drop_import_file_index() {
_collection_c=$4
_index_col_c=$5

mongoimport --drop --type=_type --headerline --ignoreBlanks -d $_database_c -c $_collection_c $_file_c
mongoimport --drop --type=$_type --headerline --ignoreBlanks -d $_database_c -c $_collection_c $_file_c
mongo --eval "db.${_collection_c}.createIndex({${_index_col_c}: 1})" localhost/$_database_c --quiet
mongo --eval "db.${_collection_c}.count()" localhost/$_database_c --quiet
}
5 changes: 1 addition & 4 deletions docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ docker exec -w /mongo_tools $MONGO_CONTAINER \
/bin/bash import-json-files.sh $DB $COLLECTION id

# --- Run the translation to RDF
# Note that at start-up Morph-xR2RML shows these warning messages, just ignore them:
# SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
# SLF4J: Defaulting to no-operation (NOP) logger implementation
# SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
# Note that at start-up Morph-xR2RML shows 3 SLF4J warning messages, just ignore them.
docker exec -w /xr2rml_config $XR2RML_CONTAINER \
/bin/bash run_xr2rml_template.sh mapping_movies.ttl movies.ttl dataset1.0 $COLLECTION
2 changes: 1 addition & 1 deletion docker/xr2rml_config/run_xr2rml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ java -Xmx4g \
-jar "$JAR" \
--configDir $CONFIG_DIR \
--configFile xr2rml.properties \
--mappingFile $CONFIG/$mappingFile \
--mappingFile $CONFIG_DIR/$mappingFile \
--output $OUTPUT_DIR/$output \
>> $log
date >> $log
Binary file modified docker/xr2rml_docker.zip
Binary file not shown.

0 comments on commit f501790

Please sign in to comment.