]>
Pierre Choffet | Git repositories - wmo_to_wikidata.git/blob - demo.sh
3 # demo.sh - Process demonstration for WMO.
4 # Copyright (C) 2021 Pierre Choffet
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of version 3 of the GNU General Public License as published
8 # by the Free Software Foundation.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 Import OSCAR station metadata to Wikidata
24 USAGE: intro.sh <wdef_file> <station_id>
31 .g8
""8q. .M
"""bgd .g8"""bgd db
`7MM"""Mq. mm
32 .dP' `YM.
,MI
"Y .dP' `M ;MM: MM `MM. MM
33 dM' `MM `MMb. dM' ` ,V^MM. MM ,M9 mmMMmm ,pW"Wq.
34 MM MM
`YMMNq. MM ,M `MM MMmmdM9 MM
6W
' `Wb
35 MM. ,MP . `MM MM. AbmmmqMA MM YM. MM 8M M8
36 `Mb. ,dP' Mb dM
`Mb. ,' A' VML MM `Mb. MM YA.
,A9
37 `"bmmd"' P"Ybmmd" `"bmmmd'.AMA. .AMMA..JMML. .JMM. `Mbmo`Ybmd9'
40 `7MMF' A `7MF'db `7MM db `7MM mm
42 VM: ,VVM: ,V `7MM MM ,MP'`7MM ,M""bMM ,6"Yb.mmMMmm
,6"Yb.
43 MM. M' MM. M' MM MM ;Y MM ,AP MM 8) MM MM 8) MM
44 `MM A' `MM A' MM MM;Mm MM 8MI MM ,pm9MM MM ,pm9MM
45 :MM; :MM; MM MM `Mb. MM `Mb MM 8M MM MM 8M MM
46 VF VF .JMML..JMML. YA..JMML.`Wbmd"MML.
`Moo9^Yo.`Mbmo
`Moo9^Yo.
49 This tool has been written in 2021 as a one-time proof of concept to import
50 Oscar station metadata into Wikidata. It's not meant to be used outside of this
51 controlled environment as it would inevitably lead any careful user to
52 insert duplicates and wrong information into the Wikimedia project.
54 The full original code remains available here for educational purpose.
56 For up to date code, see the repository at
57 <https://git.choffet.net/?p=wmo_to_wikidata.git>
68 echo "File \"${1}\" doesn't exist." >&2
75 # Generate partial wdef file
76 PARTIAL_WDEF_PATH="$(mktemp)"
77 xmlstarlet tr xslts/isolate_station.xslt -s "wigos-id=${2}" "${1}" | xmlstarlet fo > "${PARTIAL_WDEF_PATH}"
80 ./import.sh "${PARTIAL_WDEF_PATH}" elements.log
81 rm "${PARTIAL_WDEF_PATH}"
82 echo "Import done" >&2