20.08.2013 Views

Apache UIMA Ruta Guide and Reference - Apache UIMA - The ...

Apache UIMA Ruta Guide and Reference - Apache UIMA - The ...

Apache UIMA Ruta Guide and Reference - Apache UIMA - The ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 2. <strong>Apache</strong> <strong>UIMA</strong> <strong>Ruta</strong> Language<br />

This chapter provides a complete description of the <strong>Apache</strong> <strong>UIMA</strong> <strong>Ruta</strong> language.<br />

2.1. Syntax<br />

<strong>UIMA</strong> <strong>Ruta</strong> defines its own language for writing rules <strong>and</strong> rule scripts. This section gives a formal<br />

overview of its syntax.<br />

Structure: <strong>The</strong> overall structure of a <strong>UIMA</strong> <strong>Ruta</strong> script is defined by the following syntax.<br />

Script -> PackageDeclaration GlobalStatements Statements<br />

PackageDeclaration -> "PACKAGE" DottedIdentifier ";"<br />

GlobalStatments -> GlobalStatement*<br />

GlobalStatment -> ("TYPESYSTEM" | "SCRIPT" | "ENGINE")<br />

DottedIdentifier2 ";"<br />

Statements -> Statement*<br />

Statement -> Declaration | VariableDeclaration<br />

| BlockDeclaration | SimpleStatement ";"<br />

Comments are excluded from the syntax definition. Comments start with "//" <strong>and</strong> always go to the<br />

end of the line.<br />

Example beginning of a <strong>UIMA</strong> <strong>Ruta</strong> file:<br />

PACKAGE uima.ruta.example;<br />

// import the types of this type system<br />

// (located in the descriptor folder -> types folder)<br />

TYPESYSTEM types.BibtexTypeSystem;<br />

SCRIPT uima.ruta.example.Author;<br />

SCRIPT uima.ruta.example.Title;<br />

SCRIPT uima.ruta.example.Year;<br />

Syntax of declarations:<br />

Declaration -> "DECLARE" (AnnotationType)? Identifier ("," Identifier )*<br />

| "DECLARE" AnnotationType Identifier ( "("<br />

FeatureDeclaration ")" )?<br />

FeatureDeclaration -> ( (AnnotationType | "STRING" | "INT" | "FLOAT"<br />

"DOUBLE" | "BOOLEAN") Identifier) )+<br />

VariableDeclaration -> (("TYPE" Identifier ("," Identifier)*<br />

("=" AnnotationType)?)<br />

| ("STRING" Identifier ("," Identifier)*<br />

("=" StringExpression)?)<br />

| (("INT" | "DOUBLE" | "FLOAT") Identifier<br />

("," Identifier)* ("=" NumberExpression)?)<br />

| ("BOOLEAN" Identifier ("," Identifier)*<br />

("=" BooleanExpression)?)<br />

| ("WORDLIST" Identifier ("=" WordListExpression)?)<br />

| ("WORDTABLE" Identifier ("=" WordTableExpression)?)<br />

| ("TYPELIST" Identifier ("=" TypeListExpression)?)<br />

| ("STRINGLIST" Identifier<br />

("=" StringListExpression)?)<br />

| (("INTLIST" | "DOUBLELIST" | "FLOATLIST")<br />

Identifier ("=" NumberListExpression)?)<br />

<strong>Apache</strong> <strong>UIMA</strong> <strong>Ruta</strong> Language 19

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!