-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,5 @@ shrinkwrap.yaml | |
pnpm-lock.yaml | ||
dist | ||
|
||
data | ||
*.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
DIR=$(dirname "$0") | ||
BASE_IRI="https://lod.codefor.de/" | ||
BIN_DIR="$DIR/../.bin" | ||
DATA_DIR="$DIR/data" | ||
|
||
echo 'Fetching rmlmapper' | ||
wget -q --show-progress --progress=dot:mega -c -N -O "$BIN_DIR/rmlmapper.jar" https://github.com/RMLio/rmlmapper-java/releases/download/v7.0.0/rmlmapper-7.0.0-r374-all.jar | ||
|
||
rm -rf "$DATA_DIR" | ||
mkdir -p "$DATA_DIR" | ||
|
||
echo 'Preparing data…' | ||
cp "$DIR/../../../de-zhv.zip" "$DATA_DIR/source.zip" | ||
unzip "$DATA_DIR/source.zip" -d "$DATA_DIR/unzipped" | ||
find "$DATA_DIR/unzipped/" -name "*.csv" -exec mv '{}' "$DATA_DIR/source.csv" \; | ||
|
||
pnpx csvtojson --delimiter=";" "$DATA_DIR/source.csv" > "$DATA_DIR/source.json" | ||
|
||
echo 'Applying mapping…' | ||
java -jar "$BIN_DIR/rmlmapper.jar" -m "$DIR/mapping.ttl" -s turtle --strict --base-iri "$BASE_IRI" > "$DATA_DIR/output.ttl" | ||
|
||
echo 'Compressing output…' | ||
cat "$DATA_DIR/source.csv" | gzip > "$DATA_DIR/output.ttl.gz" | ||
|
||
# echo 'Done.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
@prefix bahnhof: <https://lod.bahnhof.de/vocabulary/db/>. | ||
@prefix codeforde: <https://lod.codefor.de/vocabulary/codeforde/>. | ||
@prefix dct: <http://purl.org/dc/terms/>. | ||
@prefix dbo: <https://dbpedia.org/ontology/>. | ||
@prefix foaf: <http://xmlns.com/foaf/0.1/>. | ||
@prefix geo: <http://www.opengis.net/ont/geosparql#>. | ||
@prefix gn: <http://www.geonames.org/ontology#>. | ||
@prefix juso: <http://rdfs.co/juso/>. | ||
@prefix netex: <https://lod.bahnhof.de/vocabulary/netex/>. | ||
@prefix owl: <http://www.w3.org/2002/07/owl#>. | ||
@prefix ql: <http://semweb.mmlab.be/ns/ql#>. | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. | ||
@prefix rml: <http://semweb.mmlab.be/ns/rml#>. | ||
@prefix rr: <http://www.w3.org/ns/r2rml#>. | ||
@prefix schema: <http://schema.org/>. | ||
@prefix status: <http://www.w3.org/2003/06/sw-vocab-status/ns#>. | ||
@prefix wdt: <http://www.wikidata.org/prop/direct/>. | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>. | ||
|
||
# level 1 (stop place) | ||
|
||
[ a rr:TriplesMap ] | ||
rml:logicalSource [ | ||
rml:source "data/source.json"; | ||
rml:referenceFormulation ql:JSONPath; | ||
rml:iterator "$[?(@.Type == 'S')]" | ||
]; | ||
rr:subjectMap [ | ||
rr:template "resource/by-key/ifopt/{.DHID}"; | ||
rr:class netex:StopPlace | ||
]; | ||
rr:predicateObjectMap [ | ||
rr:predicate netex:topographicPlace; | ||
rr:objectMap [ | ||
rr:termType rr:IRI; | ||
rr:template "resource/by-key/ags/{.MunicipalityCode}" | ||
] | ||
], [ | ||
rr:predicate bahnhof:ifoptStopId; | ||
rr:objectMap [ | ||
rr:datatype xsd:string; | ||
rr:termType rr:Literal; | ||
rml:reference "$.DHID" | ||
] | ||
], [ | ||
rr:predicate netex:name; | ||
rr:objectMap [ | ||
rr:datatype xsd:string; | ||
rr:termType rr:Literal; | ||
rml:reference "$.Name" | ||
] | ||
]. | ||
# todo: other attributes | ||
|
||
# todo: level 2 (quay - platform), level 3 (quay - platform edge) |