infiles := $(wildcard data/*.ttl data/*/*.ttl) turtlefiles := $(infiles:data/%.ttl=build/%/index.ttl) textfiles = $(turtlefiles:%.ttl=%.txt) rdfxmlfiles = $(turtlefiles:%.ttl=%.rdf) # TODO: resolve event:Event with prog:Programme being foaf:primaryTopic of <> htmlprogrammefiles = \ build/2011/cambridge/index.html \ build/2011/banjaluka/index.html \ build/2011/asia/index.html \ build/2014/europe/index.html \ build/2014/bruxelles-05/index.html \ build/2014/bruxelles-05-2/index.html \ build/2014/bruxelles-07/index.html \ build/2014/europe-08/index.html \ build/2015/brussels-03/index.html \ build/2015/peru/index.html \ build/2015/heidelberg/index.html \ build/2015/india/index.html \ build/2016/germany-04/index.html \ build/2017/montreal/index.html htmlfiles = $(htmlprogrammefiles) getbase = $(shell perl -ne '/^\@base\s+<(http.+)>/ and print $$1 and exit;' "$1") all: offline $(htmlfiles) offline: $(textfiles) $(rdfxmlfiles) clean: rm -rf build $(turtlefiles): build/%/index.ttl : data/%.ttl Makefile mkdir -p $(dir $@) cp $< $@ # $(eval base = $(call getbase, $<)) # rapper $(base:%=-I "%") -i turtle -o turtle "$<" > "$@" # perl -i -pe 's/ {4}/\t/g' "$@" $(textfiles): %.txt : %.ttl Makefile ln -fs $(notdir $<) $@ $(rdfxmlfiles): %.rdf : %.ttl Makefile $(eval base = $(call getbase, $<)) rapper $(base:%=-I "%") -i turtle -o rdfxml-abbrev "$<" > "$@" # Fetch and tidy programme rendering # * add doctype and title to validate # * add charset to not rely on server hinting # * refer to plaintext serialization (not self) of dataset $(htmlprogrammefiles): %.html : %.ttl Makefile $(eval base = $(call getbase, $<)) wget -O"$@" "http://programme.ecs.soton.ac.uk/tool.php?src=$(base)" perl -pi -0 \ -e 's,^(.*?]*>)(.*?)(?=),\n\n$$2$$1$$2,ms;' \ -e 's,>$(base)<,>hand-written Linked Open Data<,;' \ -e 's,$(base)\K,/index.txt,;' \ -e "s,class='[^'] *\Kprogramme_current',',;" \ -e "s,
now
,,g;" \ "$@"