Commit 8dcb9e84 authored by simei.yin's avatar simei.yin

Merge branch 'master' of ssh://gitlab.utc.fr/crozatst/hdoc

merge before commit
parents 23bf93a5 d49f64e7
<?xml version="1.0" encoding="UTF-8"?>
<project name="antModule" default="main" basedir="./">
<property name="node" value="false" ></property>
<target name="main" depends="transformation, testNode, insertion">
<echo>On a fini!!</echo>
</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="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>
\ No newline at end of file
const fs = require('fs');
var maki = require('maki-sushi');
const config = JSON.parse(fs.readFileSync('config.json'));
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(){
for(let i = 0; i < queries.length; ++i){
let q = queries[i];
console.log(q + ";");
if(q.indexOf('MATCH') !== -1){
setTimeout(function(){
maki.query.single(q + ';', function(status, response){
console.log("on insere un lien " + response);
});
}, 2000);
}
else{
maki.query.single(q, function(status, response){
console.log("on insere un noeud " + response);
});
}
}
})();
{
"name": "hdoc_to_neo4j",
"version": "1.0.0",
"main": "insert.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Félix Alié",
"license": "ISC",
"dependencies": {
"fs": "^0.0.1-security",
"maki-sushi": "^1.0.5"
},
"devDependencies": {},
"description": ""
}
@echo off
set ant=hdoc_to_neo4j.ant
set antparam=-Dprogram.param=%1
ant -buildfile %ant% %antparam%
pause
REM start /MIN java.exe -classpath "%scJarList%" -Xmx150m org.apache.tools.ant.Main -buildfile %ant% %antparam%
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment