-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
115 lines (91 loc) · 4.09 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
all: clean data/target/lieferdienste.ttl README.md
data/target/lieferdienste.ttl: data/temp/all.nt | data/target
@echo "converting $< to Turtle ..."
@echo "writing to $@ ..."
@bin/to_ttl.sh $< $@
data/temp/void_description.nt: data/manual/void_description.ttl | data/temp
@echo "convert $< to N-Triples ..."
@echo "writing to $@ ..."
@rapper -i turtle $< > $@
data/temp/all.nt: data/temp/lieferdienste.nt data/manual/known_matches.nt data/temp/void_description.nt data/temp/modified.nt | data/temp
@echo "combining temporary N-Triples files ($^) ..."
@echo "writing to $@ ..."
@cat $^ > $@
data/temp/lieferdienste.nt: data/source/lieferdienste_simple_search.geojson data/source/lieferdienste_simple_search.csv | data/temp
@echo "converting $< to N-Triples ..."
@echo "writing to $@ ..."
@ruby bin/convert_businesses.rb $< $@
data/temp/berlin_amenity.json: | data/temp
@echo "extracting amenity nodes from OpenStreetMap ..."
@echo "writing to $@ ..."
@ruby bin/get_osm_nodes.rb amenity $@
data/temp/berlin_shop.json: | data/temp
@echo "extracting shop nodes from OpenStreetMap ..."
@echo "writing to $@ ..."
@ruby bin/get_osm_nodes.rb shop $@
data/temp/berlin_all.json: data/temp/berlin_amenity.json data/temp/berlin_shop.json | data/temp
@echo "combining extracted amenity and shop nodes ..."
@echo "writing to $@ ..."
@jq -s '[.[][]]' data/temp/*.json > $@
data/temp/matches.nt: data/temp/berlin_all.json data/temp/lieferdienste.nt | data/temp
@echo "trying to find matches between Datenportal and OSM ..."
@echo "writing to $@ ..."
@ruby bin/match_osm.rb data/temp/berlin_all.json data/temp/lieferdienste.nt $@ data/manual/known_matches.nt
@echo "done - to use the matches, you need to copy them over to data/manual/known_matches.nt ..."
.PHONY: data/source/lieferdienste_simple_search.csv
data/source/lieferdienste_simple_search.csv: | data/source
@echo "downloading CSV source from SimpleSearch API ..."
@echo "writing to $@ ..."
@curl -s "https://www.berlin.de/sen/web/service/liefer-und-abholdienste/index.php/index/all.csv?q=" --output $@
.PHONY: data/source/lieferdienste_simple_search.geojson
data/source/lieferdienste_simple_search.geojson: | data/source
@echo "downloading GeoJSON source from SimpleSearch API ..."
@echo "writing to $@ ..."
@curl -s "https://www.berlin.de/sen/web/service/liefer-und-abholdienste/index.php/index/all.gjson?q=" --output $@
.PHONY: data/temp/modified.nt
data/temp/modified.nt: | data/temp
@echo "write current date as N-Triples to $@ ..."
@date '+<https://daten.berlin.de/ds/delivery_and_pickup/> <http://purl.org/dc/terms/modified> "%Y-%m-%d"^^<http://www.w3.org/2001/XMLSchema#date> .' > $@
.PHONY: data/temp/type_stats.csv
data/temp/type_stats.csv: data/temp/all+types.nt queries/count_types.rq
@echo "query $< for type counts ..."
@echo "writing to $@ ..."
@arq --data $< --query $(word 2,$^) --results=CSV > $@
data/temp/all+types.nt: data/temp/all.nt data/manual/schema_org_types.nt
@echo "combining $^ ..."
@echo "writing to $@ ..."
@cat $^ > $@
data/temp/type_stats.md: data/temp/type_stats.csv
@echo "generating markdown table from csv in $< ..."
@echo "writing to $@ ..."
@ruby bin/csv_2_md_table.rb $< $@ "Type Statistics" "llr"
data/temp/type_stats_curie.md: data/temp/type_stats.md
@echo "replacing full URIs with CURIEs in $< ..."
@echo "writing to $@ ..."
@ruby bin/namespace_2_md_link.rb ./conf/namespaces.rb $< $@
.PHONY: data/temp/date.txt
data/temp/date.txt: | data/temp
@echo "write current date ..."
@date "+Last changed: %Y-%m-%d" > $@
clean: clean-source clean-temp clean-target
clean-source:
@echo "deleting source folder ..."
@rm -rf data/source
clean-temp:
@echo "deleting temp folder ..."
@rm -rf data/temp
clean-target:
@echo "deleting target folder ..."
@rm -rf data/target
data/source:
@echo "creating source directory ..."
@mkdir -p data/source
data/temp:
@echo "creating temp directory ..."
@mkdir -p data/temp
data/target:
@echo "creating target directory ..."
@mkdir -p data/target
README.md: README/main.md data/temp/type_stats_curie.md README/license.md data/temp/date.txt
@echo "combine parts to generate $@ ..."
@cat $^ > $@