About Grammar License
 
Commercial & freeware products Try our software for free before purchase Buy now Company news channel Company informations
  Home Products TemlCode Metadata  

19.08.2011
SnapDraw is FREE

15.07.2011
101+ Analog Clocks for Android

29.03.2011
101+ Vector Clocks Available

24.02.2011
Announcing Vector Clock Pro

01.01.2011
New beautiful set of Free Vector Clocks

 

TemlCode Metadata

Metadata (data about data) is structured information that describes, explains, locates, or otherwise makes it easier to retrieve, use, or manage an information resource. In TemlCode, Metadata Markup Tag is placeholder for declarations, but it can also contain data definitions. Metadata Tags can be also used for purposes of data structuring and embedding.

Syntax of Metadata Tag
1. ~{ ( VarDecl | TypeDecl | RecDecl )
+ [ ";" + ( VarDecl | TypeDecl | RecDecl ) ]* }
2. ~{ ( Id & [Label] | Var ) + [Properties] }

Metadata Markup Tags should appear to the rest of the Plain Text data as transparent or when used with Structure Tags, it should form a complementary structuring elements. If used as transparent, processing application should manipulate with other Markup Tags and Plain Text data as if the Metadata Markup Tags weren't there. If used inside structures, Metadata Tags should be used to separate logical parts of internal data structure.

Variable Declaration

Syntax of VarDecl
Var & [ "(" & Id & ")" ] + [ ":" + Type ] + [ "=" + Entry ]

This form of Metadata Tag syntax is the place, where #variables are created and initialized with some value. Var, Type and Entry elements are identical to what was described in Properties Chapter.

Alias

A new concept is used with the "( Id )" element, where Id in parenthesis (right after Var or Id declaration) is an alias. Alias is a sencondary alternative name (if declared) having the same scope of validity as it's parent name of variable and lives also in the same namespace. It's purpose is to allow to define a shortcut name for easier (maybe frequent) use of a given variable or type.
 
 
TemlCode Example of Variable Declaration
~{#file_main = "index.html" }
~{
#background_color(bc) = [0xFF,0x00,0x7F] }

This text ~<#background_color>has background color~>.

And this text
~<#bc>it has too.~>


 
Type Declaration

Syntax of TypeDecl
"&" & Id & [ "(" & Id & ")" ] + "=" + Type

Syntax for creating a new types based on existing ones. Most basic types in TemlCode are CrossTypes. Syntax of Id, Type and CrossTypes is described in Properties Chapter. Id in parenthesis is an alias name, described in VarDecl section above.
 
 
TemlCode Example of Type Declaration
~{&weight = double;
  &color_channel_8bit(cc8) 
= int8u; }

 
Record Declaration

Syntax of VarDecl
"&" & Id & [ "(" & Id & ")" ] + "=" + Parameters
Parameters
"("
+ Parameter [ ";" Parameter ";" ... ";" Parameter [";"] ]
+ ")"

Record declaration allows creation of custom structured types of any nesting and complexity. Initial types are CrossTypes from which other types are being declared. Each data field of record must have defined at least name. Type and initial value (Entry) are optional. Syntax for Parameters definition is the same as in Properties Chapter and also inferring rules when Type or Entry is not defined, are the same. Id in parenthesis is an alias name, described in VarDecl section above.

If record declaration items consist of a pure list of Id's, the enumerated type is being created.
 
 
TemlCode Example of Record Declaration

Enumerations:
~{&position(pos) = (WingerCentre;
                    
DefenceGoaltender);
  &shootings(sh) 
= (LeftRight) }

Record type:
~{&player = (name : CharString;
             
age : int8u;
             
height : single;
             
position : &position;
             
shoot_catch : &sh;
             
nationality 
= Slovakia )}

Array of records:
~{&hockey_team = &player[6 ] }

Array Variable:
~{#NHL_famous : &hockey_team =
  [(
name="Jozef Stumpel"age=36height=1.91,
    
position=Centreshoot_catch=Right),
   (
"Marian Hossa"291.87WingerLeft),
   (
"Miroslav Satan"331.91WingerLeft),
   (
"Zdeno Chara"312.06DefenceLeft),
   (
"Lubomir Visnovsky"311.80DefenceLeft),
   (
"Peter Budaj"251.85GoaltenderLeft) ] }


 
Data structuring with Metadata Named form of Exit Tag

Syntax of Metadata Start & Exit Tag
Start Tag: ~{ Id & [Label] + [Properties] }
 Exit Tag: ~{~ Id & [Label] }
Label
"@" & ( Name | StringFF )
& [ "." & ( Name | StringFF ) ]*
& [ ":" & ( Name | StringFF ) ]
Properties
< Parameter [ ";" Parameter ";" ... ";" Parameter [";"] ]>

Similarly to TemlCode Structure Tags, Metadata Start and Exit Tags can be used to form some internal data into the higher level logical units. The main difference is that Metadata structures can cross over the borders of it's Section, while Structure Tags cannot. It is also usable, if there is a need to visually discern nested structures by their explicit syntax. Metadata Exit Tag is properly paired to it's counterpart Starting Tag only when labeled with appropriate Id[@Label] name. Short forms of Metadata Exit Tag are not allowed.
 
 
TemlCode Example of Record Declaration

~{group@fruit_articles <layout = web>}

~\
text@"About Apple"\

 The apple is the pomaceous fruit of ...

~{jpeg@apple.jpg <format=JPEG;width=50;height=45;encoding=base64>}
ajyGfvsksKhsqj6s?654bjJbvVJhjbMnbmajhcghj2ndmn3u8ewbwufIHhbqwi9bw32
rnNBvdhdkdsk897dcyJHGJhjjhedjhk789cbnjkkj986!!xcjhj9c7hjnmsnn977bbv
vghg76gJKjhhjc??dewJKkjh90jkh908jkhmnHJKjbhkjhdfklch8j8t5fo08hnj987
Hy8877yh**
~{~jpeg@apple.jpg}

~\
text@"About Pear"\

 The pear is classified within Maloideae, a subfamily within ...

~\\

~{~
group@fruit_articles}


 
Data embedding with Delimiter Exit Tag

Syntax of data embedding Metadata Delimiter Tag
~{ ( Id & [Label] | Var )
+ < delimiter = seq | int [ ";" + Properties] > }
Var
"#" & Id
Label
"@" & ( Name | StringFF )
& [ "." & ( Name | StringFF ) ]*
& [ ":" & ( Name | StringFF ) ]
Properties
Parameter [ ";" ... ";" Parameter [";"] ]

Use of this form of Metadata Tag allows for embedding of any data as a coherent part of TemlCode data stream. The trick is in defining the terminating condition called "delimiter" in place. If TemlCode parser detects on this kind of Metadata Tag a parameter with the name "delimiter", it switches parsing logic into the special mode, where all consequent data will form an embedded block until delimiting condition occurs. Delimiting condition (delimiter) can be either a custom defined sequence of Code Points or amount of data in bytes.

Named Metadata Delimiter

Any valid sequence definition of any length can form a string of code points which delimits the end of embedded block of data. TemlCode parser will consider all data after Named Metadata Delimiter Tag as embedded, until the first occurence of code point sequence defined as delimiter. The embedded data can be a raw data, but to avoid underlying encoding logic breakage it is reasonable to convert data in such a way, it could be safely stored as a part of used encoding stream.
 
 
TemlCode Example of Named Metadata Delimiter
An embedded block of data follows:

~{jpeg@apple.jpg <format=JPEG;encoding=base64;delimiter="$$$$">}
ajyGfvsksKhsqj6s?654bjJbvVJhjbMnbmajhcghj2ndmn3u8ewbwufIHhbqwi9bw32
rnNBvdhdkdsk897dcyJHGJhjjhedjhk789cbnjkkj986!!xcjhj9c7hjnmsnn977bbv
vghg76gJKjhhjc??dewJKkjh90jkh908jkhmnHJKjbhkjhdfklch8j8t5fo08hnj987
Hy8877yh**
$$$$ <- this is delimiter "$$$$" defined above

Insert image here:
~(image <ref=jpeg@apple.jpg>)


 
It may seem this way of embedding doesn't differs from the example above, where the same block of data was enclosed in Metadata Structure defined by pair of ~{jpeg@apple.jpg} .. ~{~jpeg@apple.jpg} tags. But the difference is significant, because in former case TemlCode parser continued in detecting TemlCode markups also in the included block of data, while when delimited, internal content is not examined for TemlCode syntax and only important is the delimiter sequence itself.

Take a look at following example. We embed here a block of TemlCode data itself and as you can see, the TemlCode syntax is skipped in this embedded part. It is up to the processing application how it deals with the blocks of data provided by parser as embedded.
 
 
TemlCode Example of embedded data with delimiter
Here is a list of colors structure example:

~[list <description="Basic Composition Colors">]
  ~{entry}Red     ~}~(&rgb(0xFF0000))
  ~{entry}Green   ~}~(&rgb(0x00FF00))
  ~{entry}Blue    ~}~(&rgb(0x0000FF))
~]

Same structure example embedded
as a block of data:

~{TemlCode <delimiter="$$$$">}
~[list <description="Basic Composition Colors">]
  ~{entry}Red     ~}~(&rgb(0xFF0000))
  ~{entry}Green   ~}~(&rgb(0x00FF00))
  ~{entry}Blue    ~}~(&rgb(0x0000FF))
~]
$$$$ <- this is delimiter "$$$$" defined above


 
Counted Metadata Delimiter

Any data can be embedded into the TemlCode data stream also by directly specifying the size of upcoming block of data in bytes. This approach is most feasible for streams encoded in SBCS, because then the number of bytes equals to the number of code points and embedding this way is a quite straightforward. It is possible to embed by a count also in MBCS streams, but the parser must be able to retrieve embedded block in byte units, align defined data block size to the size of encoding units, and after that continue in parsing in code point units.
 
 
TemlCode Example of embedding data by a count
Embedding 5 bytes of data:

~{embed <delimiter=5>}12345678910

Note: Sequence "678910" is not
a part of embeddded block.

 
Metadata Break Tag

Syntax of Metadata Break Tag
~}

The Break Tag is used in conjuction with higher level structures for separation of individual data units. For example inside table structure it can be used to separate an individual cells of a table.
 


Tell Us What You Think

Your Name
Your Email
Your Message
We accept anonymous messages. However, if you wish to receive a response, please include your email and name.

Next Chapter

TemlCode Insertables

  Generated from TemlCode based document. Graphics on this page is rendered with CrossGL SDK. Last page update: 19.8.2011