Skip to content

Commit

Permalink
Added adjustments for:
Browse files Browse the repository at this point in the history
- Producing nquads formatted RDF
- Allow to configure named graph via env variable
- Update CHANGELOG
  • Loading branch information
julianrojas87 committed Jun 15, 2021
1 parent 85711f8 commit bb43f46
Show file tree
Hide file tree
Showing 15 changed files with 199 additions and 71 deletions.
18 changes: 11 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,26 @@

All notable changes to this project will be documented in this file.

## [v2.0.0-alpha](https://github.com/julianrojas87/era-data-mappings/compare/v1.2.1...v2.0.0-alpha) (2021-04-12)
## [v2.0.0](https://github.com/julianrojas87/era-data-mappings/compare/v1.2.1...v2.0.0) (2021-04-12)

### Raw Data: [ERA-KG-v2.0.0-alpha](https://drive.google.com/file/d/1yCDOHc7AERsPNCgrqnPfPMEyrT6Z_U__/view?usp=sharing)
### Raw Data: [ERA-KG-v2.0.0](https://cloud.ilabt.imec.be/index.php/s/PogwXPSr8yEkKmo)

### Features and Bug Fixes

* Full mapping refactoring to adopt a topological model in accordance with the [RailTopoModel](http://www.railtopomodel.org/en/download/irs30100-apr16-7594BCA1524E14224D0.html?file=files/download/RailTopoModel/180416_uic_irs30100.pdf)
* Full mapping refactoring to adopt a topological model in following the [RailTopoModel](http://www.railtopomodel.org/en/download/irs30100-apr16-7594BCA1524E14224D0.html?file=files/download/RailTopoModel/180416_uic_irs30100.pdf)
* Parallel mapping process based on GNU parallel
* Mappings for micro and meso elements from RailML sources
* Mappings for RailML signals
* Mappings for micro and meso elements from RailML sources (moved to independent branch [railml-mappings](https://github.com/julianrojas87/era-data-mappings/tree/railml-mappings))
* Mappings for RailML signals (moved to independent branch [railml-mappings](https://github.com/julianrojas87/era-data-mappings/tree/railml-mappings))
* Mappings for micro and meso elements from RINF source
* Aggregation of micro and meso elements
* Mappings for `era:SectionOfLine` entities
* Mappings to link RINF OPs to RailML meso NetElements
* Mappings to link RINF SoLs to RailML meso NetElements
* Mappings to link RINF OPs to RailML meso NetElements (moved to independent branch [railml-mappings](https://github.com/julianrojas87/era-data-mappings/tree/railml-mappings))
* Mappings to link RINF SoLs to RailML meso NetElements (moved to independent branch [railml-mappings](https://github.com/julianrojas87/era-data-mappings/tree/railml-mappings))
* Adjust internal connectivity table for creating proper URIs
* Removed ECVVR, RSRD and RailML sources and mappings (moved to independent branch [railml-mappings](https://github.com/julianrojas87/era-data-mappings/tree/railml-mappings))
* Bump RML mapper to v4.10.0
* Produce N-Quads formatted RDF by default
* Allow to configure the named graph IRI via environment variable

## [v1.2.1](https://github.com/julianrojas87/era-data-mappings/compare/v1.2.0...v1.2.1) (2021-03-03)

Expand Down
1 change: 1 addition & 0 deletions conf.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
KG_VERSION=2.0.0-alpha
NAMED_GRAPH=http://era.europa.eu/knowledge-graph
RINF_HOST=//10.10.160.21:1433
RINF_USER=SA
RINF_PWD=ChooChoo2020
Expand Down
34 changes: 21 additions & 13 deletions map-turtle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,22 @@ parseYARRRML() {
mapRML() {
local file_path=$1
local file=${file_path##*/}
local output_file="knowledge-graph/${file%_rml*}.ttl"
local output_file="knowledge-graph/${file%_rml*}.nq"

if [ $(stat -c %s $output_file 2>/dev/null || echo -e 0) -gt 0 ]; then
echo "$file_path has already been mapped"
else
echo "Mapping '$file_path' and storing output in '$output_file'"
time java -Xmx4096m -cp rmlmapper-4.10.0.jar:mssql-jdbc-8.2.0.jre11.jar be.ugent.rml.cli.Main -s turtle -m $file_path > $output_file
time java -Xmx4096m -cp rmlmapper-4.10.0.jar:mssql-jdbc-8.2.0.jre11.jar be.ugent.rml.cli.Main -m $file_path > $output_file
fi
}
# Export the mapRML function so it can be seen by parallel
export -f mapRML

# Download the YARRML parser
downloadYARRRML
# Download the turtle file merge tool
downloadTTLMerge
# downloadTTLMerge

# Parse YARRRML files to RML
for f in ${mappings_directory}/*.yml; do
Expand All @@ -67,14 +68,21 @@ done
# Execute RML mappings in parallel based on available cores
ls ${rml_directory}/*.ttl | parallel -j+0 'mapRML {}'

# Merge resulting RDF (nquads) files into one
echo "Merging mapped ERA RDF files into a single file for version $1"
find ${output_directory}/ -iname '*.nq' -not -name 'RINF-ERATV-skos-concepts.nq' -exec cat {} +> ${output_directory}/${knowledge_graph}$1.nq
#cat ${output_directory}/* > ${output_directory}/${knowledge_graph}$1.nq
echo "Compressing resulting RDF file"
gzip ${output_directory}/${knowledge_graph}$1.nq

# Merge resulting RDF (turtle) files into one
if [ ! -d ${output_directory}/${knowledge_graph}$1.ttl.gz ]; then
echo "Merging mapped ERA RDF files into a single file for version $1"
./ttl-merge/index.js -i ${output_directory} \
-e ${output_directory}/RINF-ERATV-skos-concepts.ttl \
-p prefixes.json > ${knowledge_graph}$1.ttl
mv ${knowledge_graph}$1.ttl ${output_directory}/${knowledge_graph}$1.ttl
echo "Compressing resulting RDF file"
gzip ${output_directory}/${knowledge_graph}$1.ttl
fi
echo "The ERA Knowledge Graph v$1 has created successfully and compressed into ${output_directory}/${knowledge_graph}$1.ttl.gz file!"
#if [ ! -d ${output_directory}/${knowledge_graph}$1.ttl.gz ]; then
# echo "Merging mapped ERA RDF files into a single file for version $1"
# ./ttl-merge/index.js -i ${output_directory} \
# -e ${output_directory}/RINF-ERATV-skos-concepts.ttl \
# -p prefixes.json > ${knowledge_graph}$1.ttl
# mv ${knowledge_graph}$1.ttl ${output_directory}/${knowledge_graph}$1.ttl
# echo "Compressing resulting RDF file"
# gzip ${output_directory}/${knowledge_graph}$1.ttl
#fi
echo "The ERA Knowledge Graph v$1 has created successfully and compressed into ${output_directory}/${knowledge_graph}$1.nq.gz file!"
1 change: 1 addition & 0 deletions mappings/ERATV-manufacturers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ mappings:
parameters:
- [grel:valueParameter, $(RegisteredBusinessNumber)]
- [grel:valueParameter2, ""]
graphs: ${NAMED_GRAPH}
Loading

0 comments on commit bb43f46

Please sign in to comment.