Project

General

Profile

1
##### Vars/functions
2

    
3
coreMaps := DwC-VegBIEN.specimens.csv VegX-VegBIEN.organisms.csv
4
chRootMaps := VegX-VegBIEN.plots.csv VegX-VegBIEN.stems.csv
5
joinedMaps := $(filter-out DwC-% VegX-%,$(wildcard *-VegBIEN.*.csv))
6
all := $(wildcard for_review/*) $(joinedMaps) $(chRootMaps)
7

    
8
##### General targets
9

    
10
all: _always $(coreMaps) $(chRootMaps)
11
	@#./join DwC VegBIEN
12
	./join VegX VegBIEN
13
	./review
14

    
15
.SUFFIXES:
16

    
17
_always:
18
.PHONY: _always
19

    
20
clean: _always
21
	$(RM) $(all)
22

    
23
remake: _always clean all ;
24

    
25
##### Core maps cleanup
26

    
27
bin := ../bin
28

    
29
$(coreMaps): %: .%.last_cleanup
30
	$(bin)/in_place $@ $(bin)/simplify_xpath
31
	$(bin)/in_place $@ $(bin)/sort 1 0
32
	touch -r $@ $<
33
.PRECIOUS: .%.last_cleanup
34
# Ignore last_cleanup file if it doesn't exist
35
.%.last_cleanup:
36

    
37
##### Maps generated with ch_root
38

    
39
chRoot = $(bin)/ch_root <$< >$@
40

    
41
VegX-VegBIEN.plots.csv: VegX-VegBIEN.organisms.csv
42
	env \
43
left_in_root='/*s/individualOrganismObservation/*ID->/*s/plotObservation' \
44
left_out_root='/*s/plotObservation' \
45
right_in_root='/taxonoccurrence/*_id/locationevent' \
46
right_out_root='/locationevent' \
47
$(chRoot)
48

    
49
VegX-VegBIEN.stems.csv: VegX-VegBIEN.organisms.csv
50
	env \
51
left_in_root='/*s/individualOrganismObservation->/*s/individualOrganismObservation[relatedItem[relationshipType=stemParent]/relatedItemID]' \
52
left_out_root='/*s/individualOrganismObservation[relatedItem[relationshipType=stemParent]/relatedItemID]' \
53
right_in_root='/taxonoccurrence/aggregateoccurrence/*_id/plantobservation/stemobservation' \
54
right_out_root='/stemobservation' \
55
$(chRoot)
(4-4/20)