Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
hdoc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Stephane Crozat
hdoc
Commits
e09fad7e
Commit
e09fad7e
authored
Dec 15, 2016
by
Tyrannas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
supporting multiFiles
parent
cc199b9d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
14 deletions
+52
-14
hdoc_to_neo4j/hdoc_to_neo4j.ant
hdoc_to_neo4j/hdoc_to_neo4j.ant
+39
-10
hdoc_to_neo4j/lib/ant-contrib.jar
hdoc_to_neo4j/lib/ant-contrib.jar
+0
-0
hdoc_to_neo4j/node/insert.js
hdoc_to_neo4j/node/insert.js
+13
-4
No files found.
hdoc_to_neo4j/hdoc_to_neo4j.ant
View file @
e09fad7e
<?xml version="1.0" encoding="UTF-8"?>
<project
name=
"antModule"
default=
"main"
basedir=
"./"
>
<taskdef
resource=
"net/sf/antcontrib/antlib.xml"
>
<classpath>
<pathelement
location=
"lib/ant-contrib.jar"
/>
</classpath>
</taskdef>
<property
name=
"node"
value=
"false"
></property>
<target
name=
"main"
depends=
"transformation, testNode, insertion"
>
<echo>
On a fini!!
</echo>
<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"
/>
</target>
<target
name=
"transformation"
depends=
"preparation"
>
<echo>
On transforme le fichier!!
</echo>
<xslt
in=
"./input/unziped/content.xml"
out=
"./output/result.cql"
style=
"./xsl/hdoc_to_neo4j.xsl"
classpath=
"./lib/saxon9he.jar"
>
<factory
name=
"net.sf.saxon.TransformerFactoryImpl"
/>
</xslt>
</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>
<unzip
src=
"./input/result.hdoc"
dest=
"./input/unziped/"
/>
</target>
<target
name=
"unZip"
>
<unzip
src=
"./input/${file}"
dest=
"./input/unziped/"
overwrite=
"false"
/>
</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>
<target
name=
"insertion"
if=
"wantToInsert"
>
<exec
executable=
"node"
dir=
"./node"
>
...
...
hdoc_to_neo4j/lib/ant-contrib.jar
0 → 100644
View file @
e09fad7e
File added
hdoc_to_neo4j/node/insert.js
View file @
e09fad7e
const
fs
=
require
(
'
fs
'
);
var
maki
=
require
(
'
maki-sushi
'
);
const
config
=
JSON
.
parse
(
fs
.
readFileSync
(
'
config.json
'
));
const
testFolder
=
'
../output/
'
;
fs
.
readdir
(
testFolder
,
(
err
,
files
)
=>
{
files
.
forEach
(
file
=>
{
let
q
=
fs
.
readFileSync
(
"
../output/
"
+
file
).
toString
().
replace
(
/
[\n\t\r]
/g
,
''
).
replace
(
/
\s{4,}
/g
,
''
).
split
(
'
;
'
);
q
.
pop
();
insert
(
q
);
});
})
maki
.
config
.
setId
(
config
.
db
,
config
.
pwd
);
maki
.
config
.
setEndpoint
(
config
.
host
,
config
.
path
);
maki
.
config
.
setPort
(
config
.
port
);
var
queries
=
fs
.
readFileSync
(
'
../output/result.cql
'
).
toString
().
replace
(
/
[\n\t\r]
/g
,
''
).
replace
(
/
\s{4,}
/g
,
''
).
split
(
'
;
'
);
queries
.
pop
();
(
function
main
(
){
function
insert
(
queries
){
for
(
let
i
=
0
;
i
<
queries
.
length
;
++
i
){
let
q
=
queries
[
i
];
console
.
log
(
q
+
"
;
"
);
...
...
@@ -26,5 +35,5 @@ queries.pop();
});
}
}
}
)();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment