Commit 5861e4f4 authored by Neveux Anais's avatar Neveux Anais
Browse files

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

parents 0dad12f3 5553bcb3
*/input/*
*/tmp/*
*/output/*
!*/input/.gitkeep
!*/tmp/.gitkeep
!*/output/.gitkeep
*/node_modules*/
*.DS_Store*
......@@ -34,6 +34,9 @@
<!-- Initialize folders -->
<target name="init">
<!-- create folders (to be sure) -->
<delete>
<fileset file="${out}/*.hdoc"/>
</delete>
<mkdir dir="${unzipfolder}"/>
<mkdir dir="${tmp}"/>
<mkdir dir="${out}"/>
......@@ -60,6 +63,9 @@
<target name="process_canoscar" depends="check_scar" if="${canoprof.is_canoprof_scar}">
<!-- TODO change test.xml to the temporary file created while fusioning all the xml files -->
<copy tofile="${unzipfolder}/Test.programme">
<fileset file="${unzipfolder}/*.programme"/>
</copy>
<xslt style="xsl/programmation.xsl" in="${unzipfolder}/Test.programme" out="${hdoc}/content.xml" classpath="./lib/saxon9he.jar">
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
</xslt>
......
......@@ -22,31 +22,49 @@ Dependance
This project can be used alone if you want to import an HDOC file into basex.
## User stories
User stories
------------------
- Among a group of courses, user can search by title, author or keywords of the course.
- By searching a certain keyword, user can obtain the sections that contain it with their hierarchy levels in the course.
- In a certain section, by searching a key word, user can obtain paragraphes that contain it.
- In a certain section, by searching a key word, user can obtain paragraphs that contain it.
- User can get definitions related to a keyword
- User can get examples whose titles contain a keyword
Step by step :
[Step 1 : File transformation]
- Put the files .hdoc you want to deal with in the folder [input](https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex/input)
[`Step 1 : File transformation`]
- Put the files .hdoc you want to deal with in the folder [`input`](https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex/input)
- Run the transformation progam (Win : double click run.bat, Linux : execute run.sh)
- This transformation includes :
* Title, authors, keywords
* First Level section : title, type, paragraphs
[Step 2 : Create data base in basex]
[`Step 2 : Create data base in basex`]
- Download and install [BaseX](http://basex.org/products/download/all-downloads/)
- Run BasexGui
- In the Text Editor of BaseX, open the command script "createbd.bxs" in folder [`basex/command`](https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex/basex/command).
Follow the instructions in the script, and then execute it.
- In the Text Editor of BaseX, open the command script "createbd.bxs" in folder [`command`](https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex/basex/command).
Follow the instructions in the script, and then execute it.
[Step 3 : Make XQuery request]
- In the Text Editor of BaseX, you can open and execute xquery script "main.xq" in folder [`basex/xquery`](https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex/basex/xquery).
[`Step 3 : Make XQuery request`]
- In the Text Editor of BaseX, you can open and execute xquery script "main.xq" in folder [`xquery`](https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex/basex/xquery).
It's in this main module that we call predefined functions and execute script
- .xqm files are library modules where we have defined functions, we can go to these files for more detailed using instructions
Available library modules :
* searchDocByAuthor.xqm
* searchDocByTitle.xqm
* searchDocByTitle.xqm
\ No newline at end of file
* searchSectionByTitle.xqm
TODO List
------------------
- xlst Transformation :
* Remove text formats
* Sub sections
* Exercices
* Resources : images, ...
- XQuery requests :
* Search keywords in text
* Search sub sections by keywords in their titles
* Search exercices by keywords in their titles
\ No newline at end of file
(: this script with .xq as suffix is the main module :)
(: all functions defined in .xqm files (library modules) can be called here :)
import module namespace myNs = "https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex" at "searchSectionByTitle.xqm", "searchSectionByTitle.xqm", "searchDocByAuthor.xqm";
import module namespace myNs = "https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex" at "searchSectionByTitle.xqm", "searchDocByTitle.xqm", "searchDocByAuthor.xqm";
(: myNs:searchDocByTitle('^NF29_HdocEtherpad$', //document ):)
(: myNs:searchDocByTitle('^NF29_HdocEtherpad$', //document ) :)
(: myNs:searchSectionByTitle('contenu', //document) :)
(: myNs:searchDocByAuthor('montangé', //document) :)
......
......@@ -12,9 +12,9 @@ declare function myNs:searchDocByAuthor($name as xs:string, $docs as node()*) as
for $doc in $docs
return
for $author in $doc/authors/author
let $titre := $doc/titre
let $title := $doc/title
let $author_noAcc := translate($author, 'áàâäéèêëíìîïóòôöúùûüABCDEFGHIJKLMNOPQRSTUVWXYZ','aaaaeeeeiiiioooouuuuabcdefghijklmnopqrstuvwxyz')
where matches($author_noAcc, $name_noAcc)
group by $titre (: Avoid duplications of documents by their titre:)
group by $title (: Avoid duplications of documents by their titre:)
return $doc
};
\ No newline at end of file
......@@ -8,6 +8,6 @@ module namespace myNs = "https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to
declare function myNs:searchDocByTitle($name as xs:string, $docs as node()*) as node()*
{
for $doc in $docs
where matches($doc/titre, $name, "i")
where matches($doc/title, $name, "i")
return $doc
};
\ No newline at end of file
......@@ -12,7 +12,7 @@ declare function myNs:searchSectionByTitle($keyword as xs:string, $docs as node(
for $doc in $docs
return
for $section in $doc/sections/section
let $title_noAcc := translate($section/titresection, 'áàâäéèêëíìîïóòôöúùûüABCDEFGHIJKLMNOPQRSTUVWXYZ','aaaaeeeeiiiioooouuuuabcdefghijklmnopqrstuvwxyz')
let $title_noAcc := translate($section/titlesection, 'áàâäéèêëíìîïóòôöúùûüABCDEFGHIJKLMNOPQRSTUVWXYZ','aaaaeeeeiiiioooouuuuabcdefghijklmnopqrstuvwxyz')
where matches($title_noAcc, $keyword_noAcc)
return $section
};
\ No newline at end of file
......@@ -3,4 +3,4 @@ log=${basedir}/log
xsl=${basedir}/xsl
in=${basedir}/input
out=${basedir}/output
tmp=${basedir}/tmp
\ No newline at end of file
tmp=${basedir}/tmp
......@@ -37,7 +37,7 @@
</for>
<!-- Clean-->
<delete dir="${tmp}" failonerror="false"/>
<!-- <delete dir="${tmp}" failonerror="false"/> -->
</target>
......
......@@ -10,9 +10,9 @@
</xsl:template>
<xsl:template match="h:head" mode="title">
<titre>
<title>
<xsl:value-of select="./h:title"/>
</titre>
</title>
<xsl:apply-templates select="./h:meta"/>
</xsl:template>
......@@ -44,29 +44,32 @@
<xsl:template match="h:section">
<section>
<titresection>
<typesection>
<xsl:value-of select="@data-hdoc-type"/>
</typesection>
<titlesection>
<xsl:value-of select="./h:header/h:h1"/>
</titresection>
<contenu>
<paragraphes>
</titlesection>
<content>
<paragraphs>
<xsl:apply-templates select="h:div"/>
</paragraphes>
</paragraphs>
<xsl:apply-templates select="h:section" mode="soussect"/>
</contenu>
</content>
</section>
</xsl:template>
<xsl:template match="h:section" mode="soussect">
<soussection></soussection>
</xsl:template>
<xsl:template match="h:div" >
<xsl:if test="h:p">
<paragraphe>
<paragraph>
<xsl:value-of select="."/>
</paragraphe>
</paragraph>
</xsl:if>
<xsl:if test="h:ul">
<xsl:apply-templates select="h:ul"></xsl:apply-templates>
......@@ -75,9 +78,9 @@
</xsl:template>
<xsl:template match="h:ul">
<xsl:for-each select="h:li">
<paragraphe>
<paragraph>
<xsl:value-of select="h:p"/>
</paragraphe>
</paragraph>
</xsl:for-each>
</xsl:template>
......
......@@ -31,3 +31,39 @@ User Story
* Put the `.hdoc` files in the input folder
* Run `run.bat` or `run.sh` according to your operating system
* The output files are in the output folder
DONE
---
Opale Hdoc Canoprof
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Module fichier hdoc Programme
Objectif / Introduction / Conclusion du module Section contenant une div avec un header et du texte Séance contenant une activité de type description courte
Division ou activité Section Séance
Grain opale Section contenant une section Activité Texte et multimédia
Parties et sous-partie d’un grain section/section/section... Activité Texte et multimédia
Définition div avec un attribut data-hdoc-type = definiton Définition
Exemple div avec un attribut data-hdoc-type = example Exemple
Remarque div avec un attribut data-hdoc-type = remark Hypothèse (information?)
Conseil div avec un attribut data-hdoc-type = advice Conseil
Attention div avec un attribut data-hdoc-type = warning Attention
Complément div avec un attribut data-hdoc-type = complement Complément
Fondamental div avec un attribut data-hdoc-type = emphasis Méthode
Remarque : le texte, les listes, les tableaux fonctionnent.
TODO
---
Points particuliers de Canoprof :
Questions avec corrigé
Consigne élève
Remarque prof
Blocs :
Information Pas traité (à faire dans Opale_to_Hdoc et Hdoc_to_canoprof)
Méthode Pas traité (à faire dans Opale_to_Hdoc et Hdoc_to_canoprof)
Rappel Pas traité (à faire dans Opale_to_Hdoc et Hdoc_to_canoprof)
Syntaxe Pas traité Pas traité (à faire dans Opale_to_Hdoc et Hdoc_to_canoprof)
Texte légal Pas traité Pas traité (à faire dans Opale_to_Hdoc et Hdoc_to_canoprof)
Simulation Pas traité Pas traité (à faire dans Opale_to_Hdoc et Hdoc_to_canoprof)
\ No newline at end of file
......@@ -77,6 +77,17 @@
<xsl:if test="not(./h:header/h:h1/text())"> Untitled </xsl:if>
<xsl:value-of select="./h:header/h:h1"/>
</sp:title>
<!-- If a SOLO section have a div; this div become a Canoprof's resume of the current seance.
<xsl:if test="./h:div/*">
<sp:abstract>
<cp:txtDesc>
<xsl:apply-templates select="./h:div/*" mode="resume"/>
</cp:txtDesc>
</sp:abstract>
</xsl:if>
-->
</cp:sessionM>
<xsl:apply-templates select="./*"/>
</cp:session>
......@@ -144,10 +155,38 @@
</xsl:template>
<!-- CanoProf's Activite TetM (section) = hdoc's body/Section/Section/(Section...) = Opale's Grain (partie) -->
<!-- TODO -->
<xsl:template match="h:section" mode="CanoprofSection">
<sp:section>
<cp:textActivity>
<cp:activityM>
<sp:title>
<xsl:if test="not(./h:header/h:h1/text())"> Untitled </xsl:if>
<xsl:value-of select="./h:header/h:h1"/>
</sp:title>
<xsl:if test="(./h:header/h:div[@data-hdoc-type = 'introduction']/text())">
<xsl:apply-templates
select="./h:header/h:div[@data-hdoc-type = 'introduction']"/>
</xsl:if>
</cp:activityM>
<xsl:if test="./h:div/*">
<sp:body>
<cp:blocks>
<xsl:apply-templates select="./h:div"/>
</cp:blocks>
</sp:body>
</xsl:if>
<xsl:if test="./h:section/*">
<xsl:apply-templates select="./h:section" mode="CanoprofSection"/>
</xsl:if>
</cp:textActivity>
</sp:section>
</xsl:template>
<!-- TODO : intro/conlcusion/obj d'une activité....
<xsl:template match="h:section[@data-hdoc-type = 'introduction'] | h:section[@data-hdoc-type = 'conclusion']">
</xsl:template>
-->
<!-- Div related templates -->
<!-- Formatting content based on @data-hdoc-type -->
<xsl:template match="h:div">
......@@ -359,6 +398,18 @@
</xsl:if>
</xsl:template>
<!--
<xsl:template match="h:p | h:ul | h:ol" mode="resume">
<xsl:if test="not(preceding-sibling::h:p)">
<xsl:if test="not(preceding-sibling::h:ul)">
<xsl:if test="not(preceding-sibling::h:ol)">
<xsl:call-template name="blockloop"/>
</xsl:if>
</xsl:if>
</xsl:if>
</xsl:template>
-->
<xsl:template name="blockloop">
<xsl:for-each select=". | ./following-sibling::*">
<xsl:choose>
......@@ -401,6 +452,7 @@
</sc:inlineStyle>
</xsl:if>
</xsl:template>
<xsl:template match="h:em">
<xsl:if test="./* | ./text()">
<sc:inlineStyle role="emphasis">
......@@ -408,6 +460,7 @@
</sc:inlineStyle>
</xsl:if>
</xsl:template>
<xsl:template match="h:q">
<xsl:if test="./* | ./text()">
<sc:phrase role="quote">
......@@ -415,6 +468,7 @@
</sc:phrase>
</xsl:if>
</xsl:template>
<xsl:template match="h:sub">
<xsl:if test="./* | ./text()">
<sc:textLeaf role="ind">
......@@ -422,6 +476,7 @@
</sc:textLeaf>
</xsl:if>
</xsl:template>
<xsl:template match="h:sup">
<xsl:if test="./* | ./text()">
<sc:textLeaf role="exp">
......@@ -429,6 +484,7 @@
</sc:textLeaf>
</xsl:if>
</xsl:template>
<xsl:template match="h:a">
<xsl:if test="./* | ./text()">
<sc:phrase role="url">
......
......@@ -22,7 +22,7 @@ Dependance
----------
This project can be used alone if you only want to convert an HDOC into a Neo4j requests file.
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.
User documentation
......@@ -34,11 +34,9 @@ You have to respect the following steps :
2 - Modifier le fichier config.json (dans le dossier node) avec la base de données locale et le mot de passe personnel (base publique à venir)
3 - En ligne de commande, executer "npm install" pour installer les packages nodes (en attendant une automatisation future de la tache)
3 - Lancer le fichier runWithNode (choisissez l'extension selon votre OS)
4 - Lancer le fichier runWithNode (choisissez l'extension selon votre OS)
5 - Admirez le graph créé avec neo4j dans votre navigateur (sur localhost:7474)
4 - Admirez le graph créé avec neo4j dans votre navigateur (sur localhost:7474)
Unsupported
......
......@@ -31,12 +31,12 @@
</xsl:template>
<!-- Traitement spécial pour les objectifs, ils ont parfois la même longueur -->
<xsl:template match="body/section/section/section[@data-hdoc-type='aims']">
<xsl:template match="body/section/section/section[@data-hdoc-type='aims' or @data-hdoc-type='synthesis']">
MERGE (i:<xsl:value-of select="./@data-hdoc-type"/> {title:"<xsl:value-of select="concat(./header/h1,' - ', parent::section/header/h1, ' (',string-length(.), ')')"/>"});
MATCH (l1 {title:"<xsl:value-of select="concat(./header/h1,' - ', parent::section/header/h1, ' (',string-length(.), ')')"/>"}), (l2 {title:"<xsl:value-of select="concat(parent::section/header/h1,' (',string-length(parent::section), ')')"/>"}) MERGE (l2)-[:LIEN]->(l1);
</xsl:template>
<xsl:template match="body/section/section/section[not(@data-hdoc-type='aims')]">
<xsl:template match="body/section/section/section[not(@data-hdoc-type='aims' or @data-hdoc-type='synthesis')]">
MERGE (i:<xsl:value-of select="./@data-hdoc-type"/> {title:"<xsl:value-of select="concat(./header/h1,' (',string-length(.), ')')"/>"});
MATCH (l1 {title:"<xsl:value-of select="concat(./header/h1,' (',string-length(.), ')')"/>"}), (l2 {title:"<xsl:value-of select="concat(parent::section/header/h1,' (',string-length(parent::section), ')')"/>"}) MERGE (l2)-[:LIEN]->(l1);
</xsl:template>
......
!tmp/.gitkeep
!input/.gitkeep
!output/.gitkeep
......@@ -104,6 +104,7 @@ ul > li p, ol > li p {
ul {
list-style-type: none;
padding-left: 3em;
}
ul > li {
......@@ -112,7 +113,7 @@ ul > li {
ul > li::before {
position: absolute;
left: -5mm;
left: -1em;
content: "\2013";
}
......
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