Commit b2002165 authored by Baptiste Perraud's avatar Baptiste Perraud

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

parents b27107ad c9935765
......@@ -18,7 +18,15 @@
<xsl:apply-templates select="*"/>
</ol>
</xsl:template>
<xsl:template match="code">
Code (non pris en compte pour l'instant) :<br/>
<xsl:apply-templates select="@*|node()"/>
<br/>
</xsl:template>
<xsl:template match="code[preceding-sibling::code]">
<xsl:apply-templates select="@*|node()"/>
<br/>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
......
......@@ -52,10 +52,7 @@
Titre (non pris en compte pour l'instant) :
<xsl:apply-templates select="@*|node()"/>
</xsl:template>
<xsl:template match="code">
Code (non pris en compte pour l'instant) :
<xsl:apply-templates select="@*|node()"/>
</xsl:template>
<xsl:template match="page">
<xsl:apply-templates select="@*|node()"/>
</xsl:template>
......
File mode changed from 100644 to 100755
......@@ -54,7 +54,8 @@ Step by step :
* searchDocByAuthor.xqm
* searchDocByTitle.xqm
* searchSectionByTitle.xqm
P.S. the symbols "(: :)" are used for adding comments in xQuery files
TODO List
------------------
......
......@@ -547,6 +547,17 @@
<xsl:apply-templates select="./*"/>
</sc:cell>
</xsl:template>
<!-- Display images -->
<xsl:template match="h:img">
<sp:txt>
<cp:txt>
<sc:para xml:space="preserve">
<sc:inlineImg role="ico" sc:refUri="res/{./@src}"/>
</sc:para>
</cp:txt>
</sp:txt>
</xsl:template>
<xsl:template match="h:header"/>
<!-- Its content is already used in <xsl:template match="h:section"> -->
......
......@@ -12,16 +12,29 @@ Kapilraj Thangeswaran
This module is able to extract data from a file in Hdoc format and insert them into MongoDB.
## Dependencies
In order to work properly this module needs
- In order to make this module work you have to download and install Node.js from the [Node.js download page](https://nodejs.org/en/).
- If needed, download and install MongoDB from the [MongoDB download page](https://www.mongodb.com/download-center#community).
In order to work properly this module needs :
- to download and install Node.js
For windows :
- from the [Node.js download page](https://nodejs.org/en/)
For linux (instruction for debian 8, may vary depending on your distrbution) execute the followings commands :
- `su`
- `apt install nodejs`
- `apt install node`
- `apt install npm`
- to download and install MongoDB
For Windows :
- from the [MongoDB download page](https://www.mongodb.com/download-center#community)
For linux :
- `su & apt install mongodb`
## Instructions
1. Install dependencies
2. Add all your hdoc documents in an "input" folder
3. Add or edit "config.xml" file in "input" folder (for more details, please check "Input configuration")
4. Edit "config.json" file from "mongo" folder (for more details, please check "Mongo configuration")
5. Execute run.bat or run.sh
5. Make sure that MongoDB is running (`mongod.exe --rest --jsonp` command from "MongoDB/Server/3.2/bin" folder)
6. Execute run.bat or chmod +x run.sh & ./run.sh
## Web
This module provides a Web application to access MongoDB and execute simples requests.
......
......@@ -58,9 +58,27 @@
<delete dir="${tmpdir}" />
</target>
<target name="mongoDB" depends="main">
<exec executable="node" dir="mongo">
<arg line="main.js"/>
</exec>
</target>
<condition property="isWindows">
<os family="windows" />
</condition>
<condition property="isUnix">
<os family="unix" />
</condition>
<target name="windowsMongoDB" if="isWindows" depends="main">
<exec executable="node" dir="mongo">
<arg line="main.js"/>
</exec>
</target>
<target name="linuxMongoDB" if="isUnix" depends="main">
<exec executable="nodejs" dir="mongo">
<arg line="main.js"/>
</exec>
</target>
<target name="mongoDB" depends="windowsMongoDB, linuxMongoDB">
<echo>End</echo>
</target>
</project>
\ No newline at end of file
......@@ -42,8 +42,8 @@ var removeDocument = function(db, collection, json) {
MongoClient.connect(url, function(err, db) {
assert.equal(null, err);
fs.readdir(outputFolder, (err, files) => {
files.forEach(file => {
fs.readdir(outputFolder, function(err, files) {
files.forEach(function(file) {
var json = JSON.parse(fs.readFileSync(outputFolder + "/" + file));
if(config.request === 'insert') {
insertDocument(db, config.collection, json);
......
#!/bin/sh
#!/bin/bash
lib="lib"
ant="hdoc_to_mongo.ant"
antparam="-Dprogram.param=$1"
......
#!/bin/bash
npm link mongodb
......@@ -29,7 +29,7 @@
}
</xsl:template>
<xsl:template match="div[@data-hdoc-type='question']" >
<xsl:template match="div[@data-hdoc-type='question' and position() != last()]" >
{
<xsl:apply-templates select="div[@data-hdoc-type='description']"/>
<xsl:apply-templates select="div[@data-hdoc-type='solution']"/>
......
......@@ -24,6 +24,13 @@ Dependance
This project can be used alone if you only want to convert an HDOC into a Neo4j requests file or directly insert data in neo4j local database.
WARNINGS:
1) If you want to insert data automatically in a database, you need to have nodeJS installed!
Windows: https://nodejs.org/en/ and download + install the last stable version
Linux: install with your distribution's package manager
2) You need to configure the node/config.json file properly to fit with the parameters of the dabase you want to insert in. (host, db and password).
User documentation
------------------
......@@ -42,7 +49,8 @@ You have to respect the following steps :
Unsupported
-----------
There is no shared public database for now.
The "References" links are not fully supported yet. The opale_to_hdoc part is done, but needs an implementation in hdoc_to_neo4j.
Known bugs
----------
......
......@@ -73,10 +73,10 @@
<trycatch property="foo" reference="bar">
<try>
<jing file="${tmpdir}/META-INF/container.xml" rngfile="${Schema}/container/hdoc1-container.rng"></jing>
<echo>Validation container.xml ok !</echo>
<echo>container.xml is valid</echo>
</try>
<catch>
<echo>Validation failed</echo>
<echo>Warning : Validation for container.xml failed</echo>
</catch>
</trycatch>
......
......@@ -51,10 +51,10 @@
<trycatch property="foo" reference="bar">
<try>
<jing file="{$TempDirectory}/{$path}" rngfile="${{Schema}}/xhtml/hdoc1-xhtml.rng"></jing>
<echo>Validation content.xml ok !</echo>
<echo>content.xml is valid</echo>
</try>
<catch>
<echo>Validation failed</echo>
<echo>Warning : Validation for content.xml failed</echo>
</catch>
</trycatch>
......
......@@ -118,3 +118,5 @@ During the conversion process, the converter is using the converter mindmapping_
## Capitalization
* Concerning the xsl malfunction, we know that the issue comes from a mispriority between nodes without childs and nodes with childs who aren't named "nodes". There is a confusion between the two because previous implementation didn't take the seconds into account. We didnt manage to find a way to force the xsl to recognize those nodes, but this is where you should look if you happen to need to fix the issue. A simple but time consuming fix would be to rewrite the xsl with the functionnality in mind, but we didn't took that option as we lacked time. The problematic functions are at the root of the xsl transformation, and therefore a simple fix hasn't been found yet.
* There's post on the Scenari forum to explain what has been achieved so far with the mindmapping_to_opale project. Here is the link to the post : https://forums.scenari.org/t/transformation-dune-framindmap-en-module-opale/1079
<?xml version="1.0" encoding="UTF-8" standalone="no"?><map version="0.8.1"><node CREATED="1450696201432" ID="2nngtspni6hi1484pfec44c8lk" MODIFIED="1450696201432" TEXT="MindMapping"><node CREATED="1450696201432" ID="00lp6bpfm6jibhcjrpdonrhoqb" MODIFIED="1450696201432" POSITION="right" TEXT="#1 MindMapping to Hdoc"><node CREATED="1450696201432" ID="3qm1jgu7dfgs328jthlek5fd4e" MODIFIED="1450696201432" TEXT="Prendre en main le projet existant"/><node CREATED="1450696201432" ID="0u38ectmhqqp4p08p5guvgij71" MODIFIED="1450696201432" TEXT="#wrng Corriger les bugs existants"><node CREATED="1450696201432" ID="6cl96umgglk7bg98n0u6v3tena" MODIFIED="1450696201432" TEXT="#p Il subsiste des bugs dans la transformation."/></node><node CREATED="1450696201432" ID="3b1t9o2te6enh59j4iv48f4mdi" MODIFIED="1450696201432" TEXT="Restructurer le ant"/></node><node CREATED="1450696201432" ID="6lohsep5crh5g3ngj8ld8loei6" MODIFIED="1450696201432" POSITION="right" TEXT="#2 MindMapping to Opale"><node CREATED="1450696201432" ID="5pl3210hq6if3nv7r2chtjstmo" MODIFIED="1450696201432" TEXT="Faire la connexion avec le transformateur Hdoc to Opale"/><node CREATED="1450696201432" ID="3haa2fgohe9j4n04ilddco84uh" MODIFIED="1450696201432" TEXT="Permettre la personnalisation de l'organisation du module"><node CREATED="1450696201432" ID="4ie264076qt3tnlu0pqpp1dh1p" MODIFIED="1450696201432" TEXT="#ex A l'aide de hashtag"><node CREATED="1450696201432" ID="6qegjh2snbh0s21cn7sdukun6v" MODIFIED="1450696201432" TEXT="#p L'idée est d'utiliser les hashtag pour identifier le type de contenu"/></node><node CREATED="1450696201432" ID="23mafrh60fmdmkjsp1jdg6c58g" MODIFIED="1450696201432" TEXT="#ex A l'aide d'attributs"><node CREATED="1450696201432" ID="3cofh24e4l95fo0pgcqiefc3gv" MODIFIED="1450696201432" TEXT="#p L'idée est d'utiliser les attributs pour identifier le type de contenu"/></node></node><node CREATED="1450696201432" ID="11k2hbkcu415e1mgk5c5ucr48k" MODIFIED="1450696201432" TEXT="Permettre la personnalisation dy type de noeud (Intro, conclusion etc.)"><node CREATED="1450696201432" ID="5pf0idbv9nln725d14rs1c1p0a" MODIFIED="1450696201432" TEXT="#ex A l'aide d'attributs"><node CREATED="1450696201432" ID="6pa7h6p941mljiimpb18tv628g" MODIFIED="1450696201432" TEXT="#p L'idée est d'utiliser les hashtag pour identifier le type de contenu"/></node><node CREATED="1450696201432" ID="48799q1i5c6rns3smpa8vnekfb" MODIFIED="1450696201432" TEXT="#ex A l'aide de hashtag"><node CREATED="1450696201432" ID="1j3m1erstm0171a1i29hg3dgj6" MODIFIED="1450696201432" TEXT="#p L'idée est d'utiliser les attributs pour identifier le type de contenu"/></node></node><node CREATED="1450696201432" ID="4npf8jpvak3lffn9c1rsogi0sq" MODIFIED="1450696201432" TEXT="Permettre la personnalisation grâce aux couleurs/icônes"/></node><node CREATED="1450696201432" ID="3n8v43p8qb005puq3qiv7aiubc" MODIFIED="1450696201432" POSITION="right" TEXT="#3 MindMapping to Optim"><node CREATED="1450696201432" ID="2bn1la3apnjf1fi8qqfqde226t" MODIFIED="1450696201432" TEXT="#def Faire la connexion avec le transformateur Hdoc to Optim"><node CREATED="1450696201432" ID="2juvq1lehuivco8c1h0scqh1lr" MODIFIED="1450696201432" TEXT="#p Le connecteur hdoc_to_optim n'est pas encore opérationnel"/></node></node><node CREATED="1450696201432" ID="3s00si3hquol4pldg7lo9opjd6" MODIFIED="1450696201432" POSITION="right" TEXT="#4 MindMapping to Lexique"><node CREATED="1450696201432" ID="37jlfl25iuaoe6f2cpiv30qksd" MODIFIED="1450696201432" TEXT="#p Faire la connexion avec le transformateur Hdoc to Lexique"/></node><node CREATED="1450696201432" ID="27gnl6pgottjfiukpa3ulfdjrj" MODIFIED="1450696201432" POSITION="left" TEXT="#5 Prendre d'autres outils de carte mentales en entrée"><node CREATED="1450696201432" ID="6ci8ukhfg8fd96vsvgn9sb30cr" MODIFIED="1450696201432" TEXT="#a http://hdoc.crzt.fr/www/co/hdocConverter.html"/></node><node CREATED="1450696201432" ID="24d41nnnnvvu7fv5m8m4vegu0g" MODIFIED="1450696201432" POSITION="left" TEXT="#intro This converter aims at convert a given MindMapping file into a Hdoc file which then will be imported in Opale (advanced only)."/><node CREATED="1450696201432" ID="6a7pr2b5vvmq6na5964dhf9e13" MODIFIED="1450696201432" POSITION="left" TEXT="#conclu DONE : MindMapping to Hdoc, MindMapping to Opale TODO : MindMapping to Optim, MindMapping to Lexique"/></node></map>
\ No newline at end of file
......@@ -54,4 +54,6 @@ Step by step :
Available library modules :
* searchDocByAuthor.xqm
* searchDocByTitle.xqm
* searchSectionByTitle.xqm
\ No newline at end of file
* searchSectionByTitle.xqm
P.S. the symbols "(: :)" are used for adding comments in xQuery files
\ No newline at end of file
......@@ -31,16 +31,19 @@ A savoir que les contenus opale de plusieurs machines/utilisateurs peuvent être
##Utilisation
-------------
L'utilisation complète d'opale_to_elasticSearch nécessite l'utilisation de la stack ELK (ElasticSearch, Logstash, Kibana).
- Télécharger ElasticSearch : https://www.elastic.co/fr/downloads/elasticsearch
- Télécharger Logstash : https://www.elastic.co/fr/downloads/logstash
- Télécharger Kibana : https://www.elastic.co/fr/downloads/kibana
- Télécharger le fichier de conf de Logstash : https://www.dropbox.com/s/lkz3dgmto2d378m/esconf.conf?dl=0
- Mettre le fichier téléchargé dans %{dossier_installation_logstash}/
- Télécharger ElasticSearch : https://www.elastic.co/fr/downloads/elasticsearch et extraire l'archive
- Télécharger Logstash : https://www.elastic.co/fr/downloads/logstash et extraire l'archive
- Télécharger Kibana : https://www.elastic.co/fr/downloads/kibana et extraire l'archive
- Mettre le fichier esconf.conf situé dans opale_to_elasticSearch/logstash/conf/ dans %{dossier_installation_logstash}/
- Editer le fichier esconf.conf : ligne 11, remplacez "path => ["/opale_to_elasticSearch/logstash/input/*.json"]" par "path => ["%{votreCheminAbsolu}/opale_to_elasticSearch/logstash/input/*.json"]"
- Sauvegarder les modifications.
Etapes :
- aller dans votre dossier d'installation d'elasticsearch et lancer bin/elasticsearch
- aller dans votre dossier d'installation de kibana et lancer bin/kibana
- aller dans votre dossier d'installation de logstash et lancer bin/logstash - f esconf.conf
- Attendre les messages de logstash qui indiquent le lancement sans problème.
- lancer la transformation opale_to_elasticsearch en mettant d'abord les *.scar dans opale_to_elasticsearch/input
- Le dossier de sortie n'est pas le classique opale_to_elasticsearch/output mais opale_to_elasticsearch/logstash/input afin de faire directement le lien avec Logstash
- Normalement les log de logstash indique l'insertion des sorties de la transformation, il arrive pour le moment qu'il ne le fasse qu'au moment où logstash s'arrête, l'arrêter alors.
- aller sur http://localhost:5601/app/kibana#/dashboard/NF29_DATA_DASHBOARD?_g=(filters%3A!()%2CrefreshInterval%3A(display%3AOff%2Cpause%3A!f%2Cvalue%3A0)%2Ctime%3A(from%3Anow%2Fy%2Cmode%3Aquick%2Cto%3Anow%2Fy))
\ No newline at end of file
- aller sur http://localhost:5601/app/kibana#/dashboard/NF29_DATA_DASHBOARD?_g=(filters%3A!()%2CrefreshInterval%3A(display%3AOff%2Cpause%3A!f%2Cvalue%3A0)%2Ctime%3A(from%3Anow%2Fy%2Cmode%3Aquick%2Cto%3Anow%2Fy))
input
{
file
{
codec => multiline
{
pattern => '^\{'
negate => true
what => previous
}
path => ["/elasticSearch/logstash/input/*.json"]
start_position => "beginning"
sincedb_path => "/dev/null"
exclude => "*.gz"
}
}
filter
{
mutate
{
replace => [ "message", "%{message}" ]
gsub => [ 'message','\n','']
}
if [message] =~ /^{.*}$/
{
json { source => message }
}
}
output
{
stdout {}
elasticsearch { "hosts" => ["localhost:9200"] }
}
......@@ -32,6 +32,14 @@
<!-- MODULE's COMPONENTS -->
<body>
<xsl:apply-templates select="child::*[name() != 'op:ueM']"/>
<section data-hdoc-type="references">
<header>
<h1>Liste des grains liés</h1>
</header>
<li>
<xsl:apply-templates mode="ref" select=".//sp:comp[op:pbTi/sp:title = 'Voir aussi']"/>
</li>
</section>
</body>
</html>
</xsl:template>
......@@ -536,5 +544,11 @@
</xsl:template>
<xsl:template match="*"/>
<xsl:template mode="ref" match="sp:comp[op:pbTi/sp:title = 'Voir aussi']">
<xsl:for-each select="./op:res//sc:uLink">
<ul><xsl:value-of select="."/> - <xsl:value-of select="./@sc:refUri"/></ul>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
......@@ -12,18 +12,31 @@ Kapilraj Thangeswaran
This module is able to extract data from a file in Opale format and insert them into MongoDB.
## Dependencies
In order to work properly this module needs
- In order to make this module work you have to download and install Node.js from the [Node.js download page](https://nodejs.org/en/).
- If needed, download and install MongoDB from the [MongoDB download page](https://www.mongodb.com/download-center#community).
In order to work properly this module needs :
- [`opale_to_hdoc`](https://gitlab.utc.fr/crozatst/hdoc/tree/master/opale_to_hdoc) (Opale to Hdoc conversion)
- [`hdoc_to_mongo`](https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_mongo) (Hdoc to Mongo conversion)
- to download and install Node.js
For windows :
- from the [Node.js download page](https://nodejs.org/en/)
For linux (instruction for debian 8, may vary depending on your distrbution) execute the followings commands :
- `su`
- `apt install nodejs`
- `apt install node`
- `apt install npm`
- to download and install MongoDB
For Windows :
- from the [MongoDB download page](https://www.mongodb.com/download-center#community)
For linux :
- `su & apt install mongodb`
## Instructions
1. Install dependencies
2. Add all your hdoc documents in an "input" folder
3. Add or edit "config.xml" file in "input" folder (for more details, please check "Input configuration")
4. Edit "config.json" file from "mongo" folder in "hdoc_to_mongo" module (for more details, please check "Mongo configuration")
5. Execute run.bat or run.sh
5. Make sure that MongoDB is running (`mongod.exe --rest --jsonp` command from "MongoDB/Server/3.2/bin" folder)
6. Execute run.bat or chmod +x run.sh & ./run.sh
## Input configuration
You can add or edit "config.xml" in "input" folder to provide more information about your documents.
......
#!/bin/sh
#!/bin/bash
lib="lib"
ant="opale_to_mongo.ant"
antparam="-Dprogram.param=$1"
......
......@@ -24,6 +24,13 @@ Dependance
This project can be used alone if you only want to convert a .scar into a Neo4j requests file or directly insert data in neo4j local database.
WARNINGS:
1) If you want to insert data automatically in a database, you need to have nodeJS installed!
Windows: https://nodejs.org/en/ and download + install the last stable version
Linux: install with your distribution's package manager
2) You need to configure the ../hdoc_to_neo4j/node/config.json file properly to fit with the parameters of the dabase you want to insert in. (host, db and password).
User documentation
------------------
......@@ -42,7 +49,8 @@ You have to respect the following steps :
Unsupported
-----------
There is no shared public database for now.
The "References" links are not fully supported yet. The opale_to_hdoc part is done, but needs an implementation in hdoc_to_neo4j.
Known bugs
----------
......
......@@ -8,7 +8,7 @@
<basename property="filename" file="${inputFile}" suffix=".xml"/>
<!-- Path -->
<property name="resultPath" value="${basedir}/result"/>
<property name="resultPath" value="${basedir}/output"/>
<property name="hdoc_to_canoprof" location="${basedir}/../hdoc_to_canoprof"/>
<target name="main">
......
......@@ -2,7 +2,7 @@
<project name="wikiToCanoprof" default="main" basedir="..">
<!-- Path -->
<property name="resultPath" value="${basedir}/result"/>
<property name="resultPath" value="${basedir}/output"/>
<property name="hdoc_to_canoprof" location="${basedir}/../hdoc_to_canoprof"/>
<target name="main">
......
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