-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (41 loc) · 1.24 KB
/
Makefile
File metadata and controls
47 lines (41 loc) · 1.24 KB
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
#------Init
musypher_repo_addr = https://gitlab.inria.fr/skrid/data-ingestion.git
DB_folders := $(filter-out Musypher/ venv/,${wildcard */})
all_cql = ${DB_folders:%/=%/load_DB.cql}
MEI_DIR = mei
CYPHER_DIR = cypher
#------Rules
#---All
.PHONY: all
all: load_all_DB.cql
#---Get Musypher from repo
Musypher:
git clone $(musypher_repo_addr) $@
cd $@; pip install -r requirements.txt
#---Run the makefile in each folder to generate the makefile, and make the cypher dumps with Musypher
%/load_DB.cql: Musypher
@echo Creating files for collection $* ...
cd "$*" && make
@echo "======================================="
@echo "Converting the MEI files to cypher dump"
@echo "======================================="
@python3 Musypher/main.py -nv -o $*/$(CYPHER_DIR)/ -q $@ $*/$(MEI_DIR)/*.mei
#---Aggregate all cql files in an other cql file.
load_all_DB.cql: $(all_cql)
@echo Generating file $@.
@echo "CALL apoc.cypher.runFiles([" > $@
@for k in $^; do \
echo "'$$(realpath $$k)', " >> $@; \
done;
@sed '$$ s/, $$//' $@ > tmp;
@rm $@;
@mv tmp $@;
@echo "], {statistics: false});" >> $@;
#---Clean
.PHONY: clean
clean:
@echo Cleaning.
@rm -f load_all_DB.cql
@for collection in $(DB_folders); do \
cd "$$collection" && make clean && cd ..; \
done