• No results found

In this section we present the plain and concrete syntax of the MathLang DRa aspect. The plain syntax is closely related to the one that was described and presented through a number of examples for the MathLang CGa, see Section 2.3. Furthermore, we use the MathLang plain syntax as well as the concrete syntax (XML) and the TEXmacs preview across the whole thesis for presentation pur- poses. We use a number of toy examples to present the usage of both, plain and concrete syntaxes.

It is important to remind the reader that the annotation process of the DRa aspect could be independent from the annotation of other MathLang aspects. How- ever, for clarity purposes we annotate DRa on top of the already computerised version of the document with the CGa aspect. Reason for that is, that we explain the plain syntax which is highly correlated with the CGa’s plain syntax, and both looks in a way that the “human” can approach to read them.

Furthermore, the MathLang user should note that the plain syntax is not in- tended, at any point, to be read and used by the user to annotate the DRa aspect. However, it is used in this thesis for annotation presentation purposes as well as for providing a clear view of the examples. Furthermore, the MathLang checker10,

checks a document written in the plain syntax and at the same time transforms it to the XML format which is stored in the file. Similarly to the plain syntax, the MathLang document can be annotated using the XML schema, however it is very tedious and labour intensive. Therefore the user/mathematician who wants to annotate the document with the MathLang framework uses the TEXmacs plu- gin. We will present in more details the annotation of the DRa aspect using the MathLang plugin in Section 6.2.

4.4.1

Plain syntax

For the plain syntax we use similar notations to the one that were discussed and presented through examples for the MathLang CGa aspect annotation. We also use the typewriter font for printing DRa examples.

10The MathLang checker has been originally implemented in OCaml by M. Maarek and pre-

sented in M. Maarek PhD thesis. Another implementation of the MathLang checker has been developed by C. Zengler using modern JAVA programming language.

There exist two constructions for the DRa aspect annotation in the plain syntax. First it is used for wrapping boxes around chunks of text and to uniquely name them. The second one is used for assigning roles for previously annotated boxes as well as for stating relations between them.

The following representation of the DRa annotation is expressed in the abstract syntax format. This format is taken from the M. Maarek’s PhD thesis [Maa07]. As described above, the DRa annotation is performed either on the CGa step or on the level of the MathLang document.

mathlang-document ::= step Mathlang document

step ::= phrase Basic step

| step  step Local scoping

| {−−→step} Block

| dra-annotation DRa annotation

dra-annotation ::=

[node did@node-id step ] DRa annotated step

| [about did@node-id hasMRR@role] Mathematical role

| [about did@node-id hasSRR@role] Structural role

| [about did@node-id hasOMRR@role] Other Mathematical

role

| [about did@node-id hasOSRR@role] Other Structural role

| [did@relid src@node-id type@reltype anc@node- id]

DRa relation

4.4.1.1 Boxes annotation

The boxes presentation describes the way to annotate the CGa steps with a DRa box on top of the CGa step.

[node did@node-id step ]

The following format consists of the indication of the DRa node (i.e., node), the unique id of the node (i.e., did) and finally a CGa step.

The example shown in the Listing below presents a possible annotation of the box around the “Corollary” from Figure 4.6.

[ node did@C not ( in ( sqrt (2) , Q ) );];

Listing 4.5: The plain syntax annotation for the Corollary from Figure 4.6 Similarly, the “Lemma” from the same example and Figure 4.6 could be anno- tated with the DRa on top of the CGa, as follows:

[ node did@A

forall ( m :N , forall ( n :N ,

implies ( =( sq ( m ) ,*(2 , sq ( n ))) , and (=( m , n ) , =( n ,0)) ))); ]; Listing 4.6: The plain syntax annotation for the Lemma from Figure 4.6

4.4.1.2 Boxes description and Relationships annotation

For each annotated DRa node, as described above, we assign an attribute with its mathematical or/and structural role. To do so we follow the RDF approach with the plain syntax as presented in Figure 4.9.

1. [about@node-id hasMRR@node-mathematical-role]; 2. [about@node-id hasSRR@node-structural-role];

3. [about@node-id hasOMRR@node-other-mathematical-role]; 4. [about@node-id hasOSRR@node-other-structural-role];

5. [did@relation-id src@source-node type@relation-type anc@anchor-node];

Figure 4.9: The plain syntax annotation rules for the DRa nodes description and relationships.

The first four annotation rules (1–4, presented on Figure 4.9) are used to an- notate the narrative role which the node-id plays in the original document. For instance, the DRa node annotated on Listing 4.5 and originally presented on Fig- ure 4.6 could have been assigned the mathematical role “corollary” and could have been annotated as follows.

[ about@A h a s M R R @ c o r o l l a r y ];

Listing 4.7: The DRa “corollary” node attribute assignment using plain syntax. Similarly, the “lemma” DRa node from Listing 4.6 could be annotated as fol- lows.

[ about@A h a s M R R @ l e m m a ];

Listing 4.8: The DRa “lemma” node attribute assignment using plain syntax. In Listing 4.7 (resp. Listing 4.8) the node-id C (resp. A) plays the role of subject, hasMRR plays the role of predicate and corollary (resp. lemma) plays the role of object. So it can be presented in the format of a triple (subject, predicate, object) in exactly the same way as it is shown in the left column of Table 4.1.

Finally, for the relations annotation we use rule number 5 from Figure 4.9. First we specify a new unique (within the document) relation-id, then we provide a source, i.e., src and an anchor anc and finally the relation-type. This annotation could be presented in the same manner as it is shown in the right column of Table 4.1. For instance, the relation between two DRa nodes: A, C, as shown on Figure 4.8 in the form of a visible arrow, could be annotated within the plain syntax as follows:

[ did@rel1 src@C t y p e @ u s e s anc@A ];

Listing 4.9: The DRa relationship statement using plain syntax.

It is important to note that the box annotation rule (Section 4.4.1.1) is used for wrapping the chunk of text, in particular the CGa steps, if the document is already annotated with the CGa aspect. This means that the node can be only place on top of the CGa annotated step. Moreover, it is later on transformed to the XML format where the DRa node is a parent node for the CGa node.

In contrast, the description of the DRa node box as well as the annotation of the relationships could be located at any place in the document presented in the plain syntax. The choice of location of the DRa node description as well as the relation annotation is left to the author. They could be stated in the preamble of the document as well as could be stored in another document and imported to the one that they relate to.

The usage of the RDF techniques allows us to relate the attribute of the DRa node (i.e., structural or mathematical rhetorical role) to the actual node by the keyword: about, as presented in the examples above.

4.4.2

Concrete syntax

Documents computerised with the MathLang framework follow the XML Recom- mendation as a concrete syntax. Hence, the DRa annotation also uses the XML

format as the concrete syntax. The user could annotate the document using the XML schema that the MathLang framework provides. However, it is not intended to do so for various reasons, mainly because it is tedious and time consuming. Moreover, the XML representation was formulated for machines not for humans. The author can annotate the document using the plain syntax, which again is not intended to do so. The MathLang framework automatically transforms the computerised document from the MathLang plain syntax into the XML format – concrete syntax.

4.4.2.1 Boxes annotation

The MathLang automatic transformation from the plain to the concrete syntax is performed on every line of the plain syntax file. Hence it is also performed on any DRa annotation made in the document.

For example the DRa node from Listing 4.6 would be automatically transformed into the XML structure presented in Listing 4.10.

< dra : node xml : id ="51 _C " > < cga : step xml : id ="50" > ...

</ cga : step > </ dra : node >

Listing 4.10: The concrete syntax presentation of the version of the DRa node annotation in plain syntax taken from Listing 4.5

In the above Listing, the XML nodes starting with the dra:... string belong to the DRa aspect namespace 11, whereas the XML nodes cga:... belong to the

CGa aspect namespace. In this thesis we mainly concentrate on the transformation of the DRa aspect annotated on the plain syntax. Therefore, for brevity, we replace the transformation of the CGa annotation with string: ’...’. More information about the transformation of the CGa aspect into XML format could be found in M. Maarek’s PhD thesis [Maa07].

Each DRa node provides a unique name, which is annotated as the value of the attribute did using the plain syntax, as presented on Listing 4.6. This DRa node-id is transformed to a unique name id in the XML format. The did is con- verted and stored as the well-known attribute xml:id. The value of the did is transformed to the value of the xml:id attribute. This attribute value has to be

unique within the whole document which is restricted by the W3C Recommenda- tion 12. During the standard XML document validation with existing XML tools,

we can capture information if the DRa nodes have been uniquely named within the whole document. We can also capture this on the DRa validation processing.

4.4.2.2 Boxes description and Relationships annotation

Similarly to the above transformation of the DRa nodes from the plain syntax to the concrete syntax, the MathLang framework transforms the boxes description and relationships.

For example, the role assignment from the Listing 4.8 to the DRa node is transformed and presented in the XML format as follows:

< dra : d e s c r i p t i o n about =" C "

h a s M a t h e m a t i c a l R h e t o r i c a l R o l e =" c o r o l l a r y" / > Listing 4.11: The concrete syntax presentation of the version of the rhetorical roles assignment to the DRa node in plain syntax taken from Listing 4.7

This DRa node attribute assignment, i.e., mathematical or structural rhetorical role attribute, is placed in the XML file at the same location as it was added in the plain syntax. Although this can be changed by relocating the description of the node to another location in the plain syntax file, e.g., at the preamble of the document.

Similarly, the relationships can be transformed into the XML format as follows: < dra : relation xml : id =" rel " src =" C " type =" uses " anc =" A "/ > Listing 4.12: The DRa relation taken from Listing 4.9 and transformed into the XML format