NEW EXAMPLE: Discography and gigs
Data
Transmorpher transformation
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE transmorpher SYSTEM "../../dtd/transmorpher.dtd">
<transmorpher name="Music" version="1.0" xmlns:tm="http://transmorpher.fluxmedia.fr/">
<query name="artist" type="tmq" root="music-collection">
<param name="artist" select="TEST"/>
<select match="music-collection/owner"/>
<select match="music-collection/artist[name=$artist]"/>
</query>
<ruleset name="stripTime">
<remtag match="time" context="track"/>
</ruleset>
<main name="Collection">
<param name="artist">Dire Straits</param>
<param name="filename">Music-collection</param>
<generate id="generateXML" type="readfile" out="o">
<with-param name="file">../samples/music/input/${filename}.xml</with-param>
</generate>
<dispatch id="disp" type="broadcast" in="o" out="o1 o2"/>
<!-- page html
<apply-ruleset ref="stripTime" id="Strip" in="o1" out="o11"/>
<apply-external id="xml2html" in="o11" out="o12" type="xslt">
<with-param name="file">../samples/music/xslt/${filename}.xsl</with-param>
</apply-external>
<serialize id="FormHTML" type="writefile" in="o12">
<with-param name="file">../samples/music/results/${filename}.html</with-param>
<with-param name="indent">yes</with-param>
</serialize>
<!-- page HTML de $artist -->
<apply-query type="tmq" ref="artist" id="query" in="o2" out="o22">
<with-param name="artist">${artist}</with-param>
</apply-query>
<apply-external id="xml2html" in="o22" out="o23" type="xslt">
<with-param name="file">../samples/music/xslt/${filename}.xsl</with-param>
<with-param name="artist">${artist}</with-param>
</apply-external>
<serialize id="FormDireHTML" type="writefile" in="o23">
<with-param name="file">../samples/music/results/${artist}.html</with-param>
<with-param name="indent">yes</with-param>
</serialize>
</main>
</transmorpher>
Results
OLD EXAMPLE: The bibliography example
Data
The sample is quite simple :
we have a DTD which discribe a list of bibligoraphy
references :
A reference is an element which contains differents informations like
: authors, title of article, abstract; ....
The objective of the set of transformation is to present this set of
references in different form. In this exemple, we want to have four presentation.
- A Html presentation ordered by year of publication (see);
- A Html presentation ordered by author ;
- A Html presentation ordered by conference type (see);
- A list of bibtex entry (see).
To do this, we have defined a set of XSL files, and used the transmorpher
to combine the differents XSL file.
This agregation is descibred in the 3 samples :
Sample 1 : this is a simple transformation
(see Sample 1 )
Sample 2 : this is a simple transformation
with a query (see Sample 2 )
Sample 3 : this is a more complex transformation
(see Sample 3 )
Also, in the performance analysis (see performance)
you can find a discussion on improvment issue.
<reference index="bougé2000a" type="inproceedings" language="fr">
<authors>
<p first="Patrick" last="Bougé"/>
<p first="Jérôme" last="Euzenat"/>
<p first="Jean-Paul" last="Barthès"/>
</authors>
<title>Localisation des connaissances dans les systèmes de production</title>
<conference type="journées" name="Gestion de connaissances" sponsor="Prosper">
<location city="Toulouse" country="FR"/>
</conference>
<year>2000</year>
<date>7-8 juin</date>
<pages>31-50</pages>
<links>
<url href="http://www.univ-valenciennes.fr//Prosper-loc-formatted.zip" status="public"/>
<url href="ftp://ftp.inrialpes.fr//bouge2000a.ps.gz" status="public"/>
</links>
<abstract>La gestion des connaissances s'instancie de manière
extrèmement variée au sein des entreprises et elle mobilise
des disciplines tout aussi ariées. Les connaissances considérées
par les différentes approches peuvent être très différentes.
On peut se demander si cet état de fait est dû aux approches
mises en oeuvre ou exigé par la variété des applications
englobées par la gestion de connaissance. On considère un
ensemble de projets pouvant être considérés comme relevant
de la gestion de connaissance restreinte au cadre des systèmes de
productions. .</abstract>
<areas>
<li>Knowledge management/Gestion de connaissance</li>
</areas>
<contracts><li>ardeco</li></contracts>
</reference>
|
Figure 1.0 : A Reference
For example :
this description defines a complex transformation
shown in figure 1.0
<?xml version="1.0" encoding="UTF-8"?>
<transmorpher xmlns:tm="http://www.fluxmedia.fr/0.1">
<!-- WARNING ... this sample doesn't work alone, is
part of the complex sample, it was split to simplify the presentation of
the example -->
<!-- Definition of the rule set.
This rule set remove two kind of elements :
- the first rule remove elements abstract or keywords or areas or .... in
reference element
- the second rule remove reference with an attribute status which as a value
: private
The strip abstract can be done in XML, see here
for a discussion on that points.
-->
<ruleset name="stripAbstract">
<remtag match="abstract|keywords|areas|softwares|contracts" content="reference"/>
<remtag match="*[status='private']" content="reference"/>
</ruleset>
<process name="myFirstprocess" in="R112" out="X3 Y3 Z3">
<!--
This element split the XML flow in Two XML flow, the two flow contains
the same informations */
<dispatch name="Dispatcher1" in="R112" out="D1 D3"/>
<!-- this element remove the hidden element in the biblography -->
<apply-external type="xslt" name="XLST11" file="strip-hidden.xsl" in="D1" out="X1"/>
<!--
This element split the XML flow in Two XML flow, the two flow contains
the same informations */
<dispatch name="Dispatcher2" in="X1" out="X11 X12"/>
<!-- this element sort the biblography by title and year -->
<apply-external type="xslt" name="XLST21" file="sort-ty.xsl" in="X11" out="X2"/>
<!-- this element compute the presentation -->
<apply-external type="xslt" name="XLST31" file="form-harea.xsl" in="X2" out="X3"/>
<!-- this element sort the biblography by content, year and author -->
<apply-external type="xslt" name="XLST22" file="sort-cya.xsl" in="X12" out="Y2"/>
<!-- this element compute the bibtex presentation -->
<apply-external type="xslt" name="XLST32" file="form-bibtex.xsl" in="Y2" out="Y3"/>
<!-- this element remove the abstract and other element in the bibliography
-->
<ruleset type="Internal" name="Rule-Abstract" refOn="stripAbstract" in="D3" out="Z1"/>
<!-- this element sort the biblography by author and year -->
<apply-external type="xslt" name="XLST23" file="sort-ay.xsl" in="Z1" out="Z2"/>
<!-- this element compute the xml presentation -->
<apply-external type="xslt" name="XLST32" file="form-xml.xsl" invv="Z2" out="Z3"/>
</process>
</transmorpher>
|
Figure 1.0 : Complexe XSL process
bibliography sorted by type
|
bibliography sorted bye date
|
bibliography in bibtex
|
Figure 4.0 : The output
For example :
this description define a complexe transformation
show in figure 1.0
<?xml version="1.0" encoding="UTF-8"?>
<transmorpher xmlns:FM="http://www.fluxmedia.org/schema">
<!-- This sample allow to select a set of elementin the bibliography -->
<process name="mySecondprocess" >
<!-- Read the XML input file -->
<generate type="readfile" name="Reader" out="R1" file="./bibexmo.xml"/>
<!-- Select a set of element : only troncy and brunet reference -->
<query type="simpleOne" name="query1" file="query1.xml" in="R1" out="Z1"/>
<!-- Transform the XML to html -->
<apply-externaltype="xslt" name="XLST32" file="form-xml2html.xsl" in="Z1" out="Z2"/>
<!-- Write the HTML -->
<serialize name="SErializer1" in="Z2" file="Answer.html" />
</process>
</transmorpher>
|
/tr>
<-- This query allow to select all reference of Troncy and Brunet
author -->
<query root="bibliography">
<select expr="bibliography/reference[authors/p/@last='Troncy']"/>
<select expr="bibliography/reference[authors/p/@last='Brunet']"/>
</query>
|
Figure 1.0 : Query sample
this description defines the complex transformation shown in figure 1.0
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE transmorpher SYSTEM "../../dtd/transmorpher.dtd">
<transmorpher name="generateBiblio"
xmlns="http://transmorpher.fluxmedia.fr/1.0"
xmlns:regexp="xalan://fr.fluxmedia.transmorpher.regexp.RegularExpression">
<ruleset name="stripAbstract">
<remtag match="abstract" context="reference"/>
<remtag match="keywords" context="reference"/>
<remtag match="areas" context="reference"/>
<remtag match="softwares" context="reference"/>
<remtag match="contracts" context="reference"/>
<remtag match="*[@status='hidden']"/>
<resubst match="conference/@issue" source="([0-9]+)" target="$1e"/>
<rematt match="status"/>
<rematt match="isbn" context="book"/>
</ruleset>
<query name="troncybrunet" type="tmq" root="bibliography">
<select match="bibliography/reference[authors/p/@last='Troncy']"/>
<select match="bibliography/reference[authors/p/@last='Brunet']"/>
</query>
<process name="processGeneral" in="R112" out="X3 Y3 Z3">
<dispatch type="broadcast" id="dispatch 2" in="R112" out="D1 D3"/>
<apply-ruleset ref="stripAbstract" id="StripAbstract" in="D1" out="X1"/>
<dispatch type="broadcast" id="dispatchStripped" in="X1" out="X11 X12"/>
<apply-external type="xslt" id="SortTypeYear" file="biblio/sort-ty.xsl" in="X11" out="X2"/>
<apply-external type="xslt" id="FormatHTML" file="biblio/form-harea.xsl" in="X2" out="X3"/>
<apply-external type="xslt" id="SortCategYear" file="biblio/sort-cya.xsl" in="X12" out="Y2"/>
<apply-external type="xslt" id="FormatBib" file="biblio/form-bibtex.xsl" in="Y2" out="Y3"/>
<apply-external type="xslt" id="FormatXML" file="biblio/xmlverbatimwrapper.xsl" in="D3" out="Z3"/>
</process>
<process name="processByNames" in="R111" out="Z34">
<apply-query type="tmq" ref="troncybrunet" id="FilterTB" in="R111" out="Z34" />
</process>
<main name="ProcessBiblio">
<generate type="readfile" id="bibexmo" out="R1" file="biblio/bibexmo.xml"/>
<generate type="readfile" id="je" out="R2" file="biblio/je.xml"/>
<merge type="concat" id="merge" in="R1 R2" out="R3"/>
<dispatch type="broadcast" id="dispatch1" in="R3" out="X11 X12"/>
<apply-process id="generateFormat" ref="processGeneral" in="X11" out="X31 Y31 Z31" />
<serialize type="writefile" id="writeHTML" in="X31" file="biblio/biblio.html" />
<serialize type="writefile" id="writeBIB" in="Y31" file="biblio/biblio.bib"/>
<serialize type="writefile" id="writeXML" in="Z31" file="biblio/biblio-xml.html"/>
<apply-process id="processTB" ref="processByNames" in="X12" out="W3" />
<serialize type="writefile" id="writeTB" in="W3" file="biblio/biblio_tb.html"/>
</main>
</transmorpher>
|
Figure 1.0 : Complexe XSL process
Figure 2.0 : Complexe XSL process
Figure 3.0 : Complexe XSL process
bibliography sorted by type
|
bibliography sorted bye date
|
bibliography in bibtex
|
Figure 4.0 : The output
See performance.
Next chapter: Computational model
Feel free to comment to
Jérôme Euzenat,
$Id: examples.html,v 1.4 2002/10/16 07:30:32 jerome Exp $