Start with the transmorpher (programer)
The behavior of Transmopher is now (12/12/2001) based on a many step
- 1) Parsing the source and creating a Graph structure
- 2) Generating an Execution structure from the Graph structure
- 3) Binding parameters through the execution structure
- 4) Running corresponds to feeding the Readers of the Execution
structure with their input
Intermediate processes can be made there:
- After (1) it is possible to dump the XML image of the Graph structure
- After (1) it is possible to generate Java code corresponding to
the 1), 2) and 3) steps (compilation)
1) the interpration process
2) The execution process
3) The classes organization
4) The XML port class
5) The ProcessFactory
6) The stack in the
The interpretation process of the process file, is in two step.
- Firstly : each rule set / querry instruction are convert into
a XSL file
- secondly : each component are build; and, when all components in
a groups are defined, we link each component.
The link method is done between XML_Port. An XML_Port is an entity
wich allow to link easily different component. With this class, we can
make abstraction of the component currently linked.
The execution process
During the process, each reader (or generator) are in a thread, and
the provide information according to the ContentHandler interface.
each component (transformation, dispatcher, connector) read these informations
At the end of the process flow, serializer wrote the results files.
The classes organization
The process organisation is quite simple (see Figure
- an interface TProcess define the basic
method that each process must provide
- an class TProcess_impl provide an implementation for this
- two class inherit from this implementation :the TBasicProcess
and the TCompositeProcess
- The basic process class provide functionnalities for elementary
element (currently nothing, exept a common class to call all sub process)
- The composite process provide a way to agregate a set of elementary
element. This class overide the copy methode to copy all the elements inside
- The transmorpher package provide also a set of basic classes
+ Connector : this class allow
to translate a set of xml flow to one xml flow
: this class allow to produce a XML flow
+ Dispatcher : this class allow to translate
one XML flow into several XML Flow
+ Serializer : this class allow
to write XML flow to file
+ Ruleset : This class use the ruleset
define in the process file and apply it to the XML flow
+ External Transformer : This class
apply a transformation defined in a XSL file at a XML flow
+ Loop : This Class provide two functionnality
- a finite loop : for example, a process is apply X times.
- a conditionnal loop : a process is apply until a property is true.
+ Query : This class allow the author
to apply querry on the XML flow (select one element, a set of element )
Implementation notes :
The querry class does not inherite from the TProcessBasic class,
because, as this class is also a parser, it's simply to inheite from XMLReader,
and implements the TProcess interface.
Figure 1.0 : Organisation of Transmorpher Classes
The Transformer package provide a implementation for all this element.
// Create a copy
of this element in the composite given in parameter
Comportment of basic
Basic connector 1..n -> 1:
include all xml flow of the 2..n XML flow inside
the root element of the first XML Flow
Basic Generator 0 -> 1 :
read a XML file and produce an XML data flow
Basic dispatcher 1 -> n
copy the input XML flow to the differents output
Basic Serialiser 1 -> 0
Write the XML flow inside a file currently the file format
support is HTML / XML / PlainText
RuleSet 1 -> 1 :
Apply the rule set to an XML File, so it takes a
XML flow in input and produce an XML flow in output
Xalan Transformer : 1 -> 1
Apply the XSL file to the XML FLow
Saxon Transformer : 1-> 1
Not yet implemented :-)
BasicQuerry 1 -> 1 :
Apply the querry to the XML flow, and ouput the result
of the querry
LoopElement n->n :
Apply a process X times or until a property is true.
Details for some
classes / interface :
A process provide a set of functions, these functions are :
TProcess Copy(TProcessComposite vFather)
// This method is call when
a process is used twice or more, in these case, we must
// copy the process, and
insert it in an other part of the process graph
// The getIn and getOut methods are mainly call by the link method
// Get the In ports
XML_Port getIn(int i)
// Get an In
// Get the Out Ports
XML_Port getOut(int i)
// Get an Out Port
The XML port class
A TGenerator provide a f function :
void execProcess() ;
// this fonction is call after the parsing of the process
file. The call of this function imply the creation of an XML flow,
and the generator provide sax event in this output channel.
The XMLPort class is one of the most important class. Indeed
this class allow to link the different process, and allow to make asbtraction
of the other process during the creation of a process.
The ProcessFactory, is also important :). this class, allow
to make abstraction during the parsing step of the process used.
For exemple, if the user wrote : <Reader type="xml" .....> the processFactory
provide to the parser a process which is able to parse XML file.
This class also, allow to extend/modify the basic set of processes without
modifying the parser.
The stack in
The connector class needs to store informations. Endeed, during
the process execution all inpute send information. The connector, needs
to store informations of some input, until the first input is ended. At
the end of the first input, it must send the information of the second
input to the output, and so on ....
So to do this, we stored the information in stack. An other implementation
choice is too take advantage of the SAX specification :
An input doesn't provide a new event until the previous one was compute
by the listener. But this choice needs to take care of the thread implementation.
Feel free to comment to
$Id: start_programmer.html,v 1.6 2005/10/25 13:34:00 euzenat Exp $