hdoc_to_neo4j.ant 2.16 KB
Newer Older
1
2
<?xml version="1.0" encoding="UTF-8"?>
<project name="antModule" default="main" basedir="./">
3
4
5
6
7
    <taskdef resource="net/sf/antcontrib/antlib.xml">
        <classpath>
            <pathelement location="lib/ant-contrib.jar"/>
        </classpath>
    </taskdef> 
8
9
10

    <property name="node" value="false" ></property>
    
Tyrannas's avatar
Tyrannas committed
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
    <target name="main" depends="preparation, testNode">
        <for param="filename">
            <path>
                <fileset dir="./input" includes="*.hdoc"/>
            </path>
            <sequential>
                <var name="newFileName" unset="true"/>
                <basename  property="newFileName" file="@{filename}"/>
                <antcall target="unZip">
                    <param name="file" value="${newFileName}"/>
                </antcall>

                <antcall target="transformation">
                    <param name="file" value="${newFileName}"/>
                </antcall> 
                <echo>${newFileName}</echo>
            </sequential>
        </for>
        <antcall target="insertion"/>
30
31
32
33
34
35
36
37
38
    </target>
    
    <target name="preparation">
        <echo>On initialise le dossier!</echo>
        <delete dir="./output"></delete>
        <mkdir dir="./output"></mkdir>
        <delete dir="./input/unziped"></delete>
        <mkdir dir='./input/unziped'></mkdir>
    </target>
Tyrannas's avatar
Tyrannas committed
39
40

    <target name="unZip">
41
        <unzip src="./input/${file}" dest="./input/unziped/" overwrite="false"/>
Tyrannas's avatar
Tyrannas committed
42
43
44
45
46
47
48
49
50
51
52
    </target>

    <target name="transformation">
        <sequential>
            <xslt in="./input/unziped/content.xml" out="./output/${file}.cql" style="./xsl/hdoc_to_neo4j.xsl" classpath="./lib/saxon9he.jar">
                <factory name="net.sf.saxon.TransformerFactoryImpl"/>
            </xslt>
            <delete dir="./input/unziped"/>
            <mkdir dir="./input/unziped"/>
        </sequential>
    </target>
53
54


55
56
57
58
59
60
61
62
63
64
65
66
67
    <target name="insertion" if="wantToInsert">
        <exec executable="node" dir="./node">
            <arg line="insert.js"/>
        </exec>
    </target>

    <target name="testNode">
        <condition property="wantToInsert">
            <matches pattern="true" string="${node}"/>
        </condition>
    </target>

</project>