Commit 12caf166 authored by Antoine's avatar Antoine

lexique to rdf transformation working for simple terms

parent 6a0f5f44
# Converter lexique_to_opale
In order to use this converter, follow those steps :
1. Copy your Lexique file(s) (.scar or .zip) into the input directory.
2. Execute the run that correspond to your OS.
3. You will find the result into the output directory. The names of the output are linked to the hour it was processed.
libdir=${basedir}/lib
rngdir=${basedir}/rng
xsldir=${basedir}/xsl
srcdir=${basedir}/in
outdir=${basedir}/out
InputPath=${basedir}/input
OutputPath=${basedir}/output
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project name="project" default="clean" basedir=".">
<property file="build.properties"/>
<taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask">
<classpath>
<pathelement location="${libdir}/jing.jar"/>
</classpath>
</taskdef>
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="lib/ant-contrib.jar"/>
</classpath>
</taskdef>
<target name="rmOutputDir">
<if>
<available file="${OutputPath}" type="dir"/>
<then>
<delete dir="${OutputPath}"/>
</then>
</if>
</target>
<target name="init" depends="rmOutputDir">
<mkdir dir="${outdir}"/>
<chmod perm="777" dir="${outdir}"></chmod>
<mkdir dir="${srcdir}"/>
<chmod perm="777" dir="${srcdir}"></chmod>
<mkdir dir="${OutputPath}"/>
<chmod perm="777" dir="${OutputPath}"></chmod>
</target>
<target name="unzipSource" depends="init">
<for param="file">
<path>
<fileset dir="${InputPath}" id="inputsId">
<include name="*.zip"/>
<include name="*.scar"/>
</fileset>
</path>
<sequential>
<local name="TODAY_MY"/>
<tstamp>
<format property="TODAY_MY" pattern="yyyyMMdd-HHmmss" locale="en,UK" />
</tstamp>
<var name="name" unset="true"/>
<basename file="@{file}" property="name" />
<unzip src="${InputPath}/${name}" dest="${srcdir}/${TODAY_MY}"></unzip>
<sleep seconds="1"> </sleep>
</sequential>
</for>
</target>
<target name="buildOutput" depends="unzipSource">
<xslt classpath="${libdir}/saxon9he.jar" style="${xsldir}/termToRef.xsl" basedir="${srcdir}" destdir="${OutputPath}" followsymlinks="false" extension=".ref">
<include name="**/*.term"/>
</xslt>
<copy file="opale.wspmeta" tofile="${OutputPath}/.wspmeta"></copy>
<!--<jing rngfile="${rngdir}/op_glos.rng">
<fileset dir="${outdir}">
<include name="**/*.ref"/>
</fileset>
</jing>-->
</target>
<target name="clean" depends="buildOutput">
<delete dir="${srcdir}" />
<delete dir="${outdir}" />
</target>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<wspType defaultCode="Opale" title="Opale 3.5 (fr-FR)" description="" uri="Opale3-5_fr-FR_010" key="Opale3-5" lang="fr-FR" version="3.5.010"><wspUpdate localAutoUpdate="minor"><res key="Opale3-5.wsp"/></wspUpdate><systemSpace space="~param/Opale3-5/ss"><res key="Opale3-5.ss"/></systemSpace><systemSpace space="~param/Opale3-5/bs" optional="true"><res key="Opale3-5.bs"/></systemSpace><systemSpace space="~param/Opale3-5/gen/web"><res key="Opale3-5.gen.web"/></systemSpace><systemSpace space="~param/Opale3-5/gen/scormMono"><res key="Opale3-5.gen.scormMono"/></systemSpace><systemSpace space="~param/Opale3-5/gen/scormMulti"><res key="Opale3-5.gen.scormMulti"/></systemSpace><systemSpace space="~param/Opale3-5/gen/paper"><res key="Opale3-5.gen.paper"/></systemSpace><systemSpace space="~param/Opale3-5/gen/pres"><res key="Opale3-5.gen.pres"/></systemSpace><systemSpace space="~param/Opale3-5/gen/previewPresShort"><res key="Opale3-5.gen.previewPresShort"/></systemSpace><systemSpace space="~param/Opale3-5/gen/previewPresStandard"><res key="Opale3-5.gen.previewPresStandard"/></systemSpace><systemSpace space="~param/Opale3-5/gen/previewWebStandard"><res key="Opale3-5.gen.previewWebStandard"/></systemSpace><systemSpace space="~param/Opale3-5/gen/previewWebShort"><res key="Opale3-5.gen.previewWebShort"/></systemSpace><systemSpace space="~param/Opale3-5/gen/previewWebStandardComments"><res key="Opale3-5.gen.previewWebStandardComments"/></systemSpace><systemSpace space="~param/Opale3-5/gen/previewWebShortComments"><res key="Opale3-5.gen.previewWebShortComments"/></systemSpace><systemSpace space="~param/Opale3-5/gen/packScorm12"><res key="Opale3-5.gen.packScorm12"/></systemSpace><systemSpace space="~param/Opale3-5/gen/packScorm2k4"><res key="Opale3-5.gen.packScorm2k4"/></systemSpace><editionSheet pack="Opale3-5_fr-FR_010" brickSelector="{Opale3-5.moz;3.5.010;fr-FR}"/></wspType>
\ No newline at end of file
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<sng:grammar xmlns:of="scpf.org:office" xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive" xmlns:sc="http://www.utc.fr/ics/scenari/v3/core" xmlns:sng="http://relaxng.org/ns/structure/1.0" xmlns:snga="http://relaxng.org/ns/compatibility/annotations/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<sng:start>
<sng:element name="sc:item">
<sng:ref name="of_def"/>
</sng:element>
</sng:start>
<sng:define xmlns:sng="http://relaxng.org/ns/structure/1.0" name="of_def">
<sng:element name="of:def" snga:title="Définition">
<snga:documentation>Est un item de référence qui permet d'expliciter un terme ou une notion.</snga:documentation>
<sng:ref name="of_defM"/>
<sng:element name="sp:def" snga:title="Définition">
<sng:ref xmlns:sng="http://relaxng.org/ns/structure/1.0" name="of_sTxt"/>
</sng:element>
</sng:element>
</sng:define>
<sng:define xmlns:sng="http://relaxng.org/ns/structure/1.0" name="of_sTxt">
<sng:element name="of:sTxt" snga:title="Texte">
<snga:documentation> Texte riche</snga:documentation>
<sng:ref name="of_sTxt_blocs"/>
</sng:element>
</sng:define>
<sng:define xmlns:sng="http://relaxng.org/ns/structure/1.0" name="of_sTxt_blocs">
<sng:oneOrMore>
<sng:choice>
<sng:element name="sc:para" snga:title="Paragraphe">
<sng:ref name="of_sTxt_id"/>
<sng:optional>
<sng:attribute name="xml:space">
<sng:value>preserve</sng:value>
</sng:attribute>
</sng:optional>
<sng:ref name="of_sTxt_inline"/>
</sng:element>
<sng:element name="sc:itemizedList" snga:title="Liste à puce">
<sng:optional>
<sng:attribute name="role">
<sng:value/>
</sng:attribute>
</sng:optional>
<sng:ref name="of_sTxt_id"/>
<sng:zeroOrMore>
<sng:element name="sc:listItem">
<sng:ref name="of_sTxt_id"/>
<sng:ref name="of_sTxt_blocs"/>
</sng:element>
</sng:zeroOrMore>
</sng:element>
<sng:element name="sc:orderedList" snga:title="Liste ordonnée">
<sng:optional>
<sng:attribute name="role">
<sng:value/>
</sng:attribute>
</sng:optional>
<sng:ref name="of_sTxt_id"/>
<sng:zeroOrMore>
<sng:element name="sc:listItem">
<sng:ref name="of_sTxt_id"/>
<sng:ref name="of_sTxt_blocs"/>
</sng:element>
</sng:zeroOrMore>
</sng:element>
</sng:choice>
</sng:oneOrMore>
</sng:define>
<sng:define xmlns:sng="http://relaxng.org/ns/structure/1.0" name="of_sTxt_inline">
<sng:zeroOrMore>
<sng:choice>
<sng:text/>
<sng:element name="sc:uLink" snga:title="Adresse web, email">
<sng:attribute name="role">
<sng:value>url</sng:value>
</sng:attribute>
<sng:ref name="of_sTxt_id"/>
<sng:optional>
<sng:attribute name="url">
<sng:data type="string">
<sng:param name="minLength">1</sng:param>
</sng:data>
</sng:attribute>
</sng:optional>
<sng:optional>
<sng:attribute name="sc:refUri">
<sng:data type="string">
<sng:param name="minLength">1</sng:param>
</sng:data>
</sng:attribute>
</sng:optional>
<sng:ref name="of_sTxt_inline"/>
</sng:element>
<sng:element name="sc:phrase" snga:title="Citation">
<sng:attribute name="role">
<sng:value>quote</sng:value>
</sng:attribute>
<sng:ref name="of_sTxt_id"/>
<sng:optional>
<sng:attribute name="xml:lang">
<sng:data type="string"/>
</sng:attribute>
</sng:optional>
<sng:ref name="of_sTxt_inline"/>
</sng:element>
<sng:element name="sc:phrase" snga:title="Terme spécifique">
<sng:attribute name="role">
<sng:value>special</sng:value>
</sng:attribute>
<sng:ref name="of_sTxt_id"/>
<sng:optional>
<sng:attribute name="xml:lang">
<sng:data type="string"/>
</sng:attribute>
</sng:optional>
<sng:ref name="of_sTxt_inline"/>
</sng:element>
<sng:element name="sc:inlineStyle" snga:title="Mise en relief">
<sng:attribute name="role">
<sng:value>emphasis</sng:value>
</sng:attribute>
<sng:ref name="of_sTxt_id"/>
<sng:ref name="of_sTxt_inline"/>
</sng:element>
<sng:element name="sc:inlineImg" snga:title="Imagette">
<sng:attribute name="role">
<sng:value>ico</sng:value>
</sng:attribute>
<sng:ref name="of_sTxt_id"/>
<sng:attribute name="sc:refUri">
<sng:data type="string">
<sng:param name="minLength">1</sng:param>
</sng:data>
</sng:attribute>
<sng:text/>
</sng:element>
</sng:choice>
</sng:zeroOrMore>
</sng:define>
<sng:define xmlns:sng="http://relaxng.org/ns/structure/1.0" name="of_sTxt_id">
<sng:optional>
<sng:attribute name="sc:id">
<sng:data type="ID"/>
</sng:attribute>
</sng:optional>
</sng:define>
<sng:define xmlns:sng="http://relaxng.org/ns/structure/1.0" name="of_defM">
<sng:element name="of:defM" snga:title="Définition">
<snga:documentation>Bloc de texte permettant de saisir la définition.</snga:documentation>
<sng:element name="sp:term" snga:title="Terme">
<snga:documentation>Permet de saisir le mot ou la notion à définir.</snga:documentation>
<sng:data type="string">
<sng:param name="minLength">1</sng:param>
</sng:data>
</sng:element>
</sng:element>
</sng:define>
</sng:grammar>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<sng:grammar xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive" xmlns:op="utc.fr:ics/opale3" xmlns:sc="http://www.utc.fr/ics/scenari/v3/core" xmlns:sng="http://relaxng.org/ns/structure/1.0" xmlns:snga="http://relaxng.org/ns/compatibility/annotations/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<sng:start>
<sng:element name="sc:item">
<sng:ref name="op_glos"/>
</sng:element>
</sng:start>
<sng:define xmlns:sng="http://relaxng.org/ns/structure/1.0" name="op_glos">
<sng:element name="op:glos" snga:title="Glossaire">
<snga:documentation>Renseigner une entrée de type glossaire</snga:documentation>
<sng:ref name="op_glosM"/>
</sng:element>
</sng:define>
<sng:define xmlns:sng="http://relaxng.org/ns/structure/1.0" name="op_glosM">
<sng:element name="op:glosM" snga:title="Entrée de glossaire">
<sng:element name="sp:term" snga:title="Terme">
<snga:documentation>Renseigner le terme</snga:documentation>
<sng:data type="string">
<sng:param name="minLength">1</sng:param>
</sng:data>
</sng:element>
<sng:element name="sp:def" snga:title="Définition">
<snga:documentation>Renseigner la définition</snga:documentation>
<sng:ref name="op_sTxt"/>
</sng:element>
</sng:element>
</sng:define>
<sng:define xmlns:sng="http://relaxng.org/ns/structure/1.0" name="op_sTxt">
<sng:element name="op:sTxt" snga:title="Texte Simple">
<sng:ref name="op_sTxt_blocs"/>
</sng:element>
</sng:define>
<sng:define xmlns:sng="http://relaxng.org/ns/structure/1.0" name="op_sTxt_blocs">
<sng:oneOrMore>
<sng:choice>
<sng:element name="sc:para" snga:title="Paragraphe">
<sng:ref name="op_sTxt_id"/>
<sng:optional>
<sng:attribute name="xml:space">
<sng:value>preserve</sng:value>
</sng:attribute>
</sng:optional>
<sng:ref name="op_sTxt_inline"/>
</sng:element>
<sng:element name="sc:itemizedList" snga:title="Liste à puce">
<sng:optional>
<sng:attribute name="role">
<sng:value/>
</sng:attribute>
</sng:optional>
<sng:ref name="op_sTxt_id"/>
<sng:zeroOrMore>
<sng:element name="sc:listItem">
<sng:ref name="op_sTxt_id"/>
<sng:ref name="op_sTxt_blocs"/>
</sng:element>
</sng:zeroOrMore>
</sng:element>
<sng:element name="sc:orderedList" snga:title="Liste ordonnée">
<sng:optional>
<sng:attribute name="role">
<sng:value/>
</sng:attribute>
</sng:optional>
<sng:ref name="op_sTxt_id"/>
<sng:zeroOrMore>
<sng:element name="sc:listItem">
<sng:ref name="op_sTxt_id"/>
<sng:ref name="op_sTxt_blocs"/>
</sng:element>
</sng:zeroOrMore>
</sng:element>
</sng:choice>
</sng:oneOrMore>
</sng:define>
<sng:define xmlns:sng="http://relaxng.org/ns/structure/1.0" name="op_sTxt_inline">
<sng:zeroOrMore>
<sng:choice>
<sng:text/>
<sng:element name="sc:phrase" snga:title="Adresse web, email, lien vers un document externe">
<sng:attribute name="role">
<sng:value>url</sng:value>
</sng:attribute>
<sng:ref name="op_sTxt_id"/>
<sng:optional>
<sng:attribute name="xml:lang">
<sng:data type="string"/>
</sng:attribute>
</sng:optional>
<sng:ref name="op_urlM"/>
<sng:ref name="op_sTxt_inline"/>
</sng:element>
<sng:element name="sc:inlineStyle" snga:title="Important">
<sng:attribute name="role">
<sng:value>emp</sng:value>
</sng:attribute>
<sng:ref name="op_sTxt_id"/>
<sng:ref name="op_sTxt_inline"/>
</sng:element>
<sng:element name="sc:inlineStyle" snga:title="Terme étranger">
<sng:attribute name="role">
<sng:value>spec</sng:value>
</sng:attribute>
<sng:ref name="op_sTxt_id"/>
<sng:optional>
<sng:ref name="op_txtM"/>
</sng:optional>
<sng:ref name="op_sTxt_inline"/>
</sng:element>
</sng:choice>
</sng:zeroOrMore>
</sng:define>
<sng:define xmlns:sng="http://relaxng.org/ns/structure/1.0" name="op_sTxt_id">
<sng:optional>
<sng:attribute name="sc:id">
<sng:data type="ID"/>
</sng:attribute>
</sng:optional>
</sng:define>
<sng:define xmlns:sng="http://relaxng.org/ns/structure/1.0" name="op_urlM">
<sng:element name="op:urlM" snga:title="Url">
<sng:element name="sp:url" snga:title="Url, adresse web">
<snga:documentation>Permet de saisir l'adresse de la source sur internet.</snga:documentation>
<sng:data type="string">
<sng:param name="minLength">1</sng:param>
</sng:data>
</sng:element>
<sng:optional>
<sng:element name="sp:title" snga:title="Titre">
<snga:documentation>Permet de saisir un libellé du site web, définissant son contenu.</snga:documentation>
<sng:data type="string">
<sng:param name="minLength">1</sng:param>
</sng:data>
</sng:element>
</sng:optional>
<sng:optional>
<sng:element name="sp:doc" snga:title="Compléments pour un document lié">
<snga:documentation>Permet de saisir des précisions si l'url conduit à un document bureautique.</snga:documentation>
<sng:optional>
<sng:element name="sp:type" snga:title="Format du document (PDF...)">
<snga:documentation>Permet de définir le format du document (PDF, RTF...).</snga:documentation>
<sng:data type="string">
<sng:param name="minLength">1</sng:param>
</sng:data>
</sng:element>
</sng:optional>
<sng:optional>
<sng:element name="sp:weight" snga:title="Poids">
<snga:documentation>Permet de saisir le poids (en kO) du document, afin d'anticiper le temps de téléchargement.</snga:documentation>
<sng:data type="string">
<sng:param name="minLength">1</sng:param>
</sng:data>
</sng:element>
</sng:optional>
<sng:optional>
<sng:element name="sp:lang" snga:title="Langue">
<snga:documentation>Permet de préciser le code de la langue du fichier, notamment pour les lecteurs d'écran. Une liste de suggestions apparaît au fur et à mesure de la saisie. </snga:documentation>
<sng:choice>
<sng:ref name="op_langM"/>
</sng:choice>
</sng:element>
</sng:optional>
</sng:element>
</sng:optional>
</sng:element>
</sng:define>
<sng:define xmlns:sng="http://relaxng.org/ns/structure/1.0" name="op_langM">
<sng:element name="op:langM" snga:title="Propriété de langue">
<sng:optional>
<sng:element name="sp:code" snga:title="Code">
<sng:data type="string">
<sng:param name="minLength">1</sng:param>
</sng:data>
</sng:element>
</sng:optional>
</sng:element>
</sng:define>
<sng:define xmlns:sng="http://relaxng.org/ns/structure/1.0" name="op_txtM">
<sng:element name="op:txtM" snga:title="Propriétés de texte">
<sng:element name="sp:lang" snga:title="Langue">
<sng:choice>
<sng:ref name="op_langM"/>
</sng:choice>
</sng:element>
</sng:element>
</sng:define>
</sng:grammar>
\ No newline at end of file
@echo off
set lib=lib
set ant=lexique_to_rdf.ant
set antparam=-Dprogram.param=%1
set scJarList=%lib%\*
java.exe -classpath "%scJarList%" -Xmx150m org.apache.tools.ant.Main -buildfile %ant% %antparam%
pause
REM start /MIN java.exe -classpath "%scJarList%" -Xmx150m org.apache.tools.ant.Main -buildfile %ant% %antparam%
#!/bin/sh
lib="lib"
ant="lexique_to_rdf.ant"
antparam="-Dprogram.param=$1"
#Recherche de java et controle que se soit une version SUN
vJavaCmd="java"
xCheckJava () {
vInputVarName=\$"$1"
vInputVarVal=`eval "expr \"$vInputVarName\" "`
if [ -z "$vInputVarVal" ];then
eval "$1=false"
return
fi
vSunJavaFound=`$vInputVarVal -version 2>&1 | grep -Eo -m 1 "(HotSpot)|(OpenJDK)"`
if [ "$vSunJavaFound" != "HotSpot" ] && [ "$vSunJavaFound" != "OpenJDK" ] ; then
eval "$1=false"
return
fi
}
xCheckJava vJavaCmd
if [ "$vJavaCmd" = "false" ]; then
vJavaCmd="$JAVA_HOME/bin/java"
xCheckJava vJavaCmd
if [ "$vJavaCmd" = "false" ]; then
echo "ERREUR: JRE de SUN introuvable. Veuillez déclarer la variable d'environnement JAVA_HOME."
exit 1
fi
fi
#Lancer la commande
scJarList="$lib/*"
$vJavaCmd -classpath "$scJarList:" -Xmx150m org.apache.tools.ant.Main -buildfile $ant $antparam
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ont="nf29ont"
xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive"
xmlns:sc="http://www.utc.fr/ics/scenari/v3/core"
xmlns:lx="scpf.org:lexicon"
xmlns:op="utc.fr:ics/opale3"
exclude-result-prefixes="xs"
version="2.0">
<xsl:output method="xml" indent="yes" />
<xsl:template match="/">
<rdf:Description>
<xsl:attribute name="about">
<xsl:value-of select="sc:item/lx:term/lx:termM/sp:name"></xsl:value-of>
</xsl:attribute>
<ont:def>
<xsl:value-of select="sc:item/lx:term/sp:def/lx:definition/sp:desc/lx:defTxt/sc:para"></xsl:value-of>
</ont:def>
<ont:source>
<xsl:value-of select="sc:item/lx:term/sp:def/lx:definition/sp:source/@sc:refUri"/>
</ont:source>
<ont:tag>
<xsl:value-of select="sc:item/lx:term/sp:index/lx:index/sp:tag/@sc:refUri"></xsl:value-of>
</ont:tag>
</rdf:Description>
</xsl:template>
</xsl:stylesheet>
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