[maven-release-plugin] copy for tag ruta-2.5.0
git-svn-id: https://svn.apache.org/repos/asf/uima/ruta/tags/ruta-2.5.0@1758740 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/RELEASE_NOTES.html b/RELEASE_NOTES.html
index a0dfc3b..de2303e 100644
--- a/RELEASE_NOTES.html
+++ b/RELEASE_NOTES.html
@@ -74,7 +74,9 @@
<li>Bug fixes</li>
</ul>
<p>
- This release requires an update of script projects and its descriptors in the UIMA Ruta Workbench, e.g, by deleting all descriptors and updating the script project. Right-click on a project and select "UIMA Ruta -> Convert to UIMA Ruta project.
+ This release requires an update of script projects and its descriptors in the UIMA Ruta Workbench.
+ There are several ways to achieve this. The recommended way is to right-click on the UIMA Ruta project and select "UIMA Ruta -> Convert to UIMA Ruta project", which will update all provided descriptors.
+ Then, select the project and press "Project -> Clean..." in the menu, which will regenerate all descriptors of your scripts based on the new templates.
</p>
</p>
diff --git a/ruta-core/src/main/java/org/apache/uima/ruta/expression/feature/LazyFeature.java b/ruta-core/src/main/java/org/apache/uima/ruta/expression/feature/LazyFeature.java
index fc1858b..00411d8 100644
--- a/ruta-core/src/main/java/org/apache/uima/ruta/expression/feature/LazyFeature.java
+++ b/ruta-core/src/main/java/org/apache/uima/ruta/expression/feature/LazyFeature.java
@@ -53,31 +53,37 @@
@Override
public int compareTo(Feature o) {
+ checkDelegate();
return delegate.compareTo(o);
}
@Override
public Type getDomain() {
+ checkDelegate();
return delegate.getDomain();
}
@Override
public Type getRange() {
+ checkDelegate();
return delegate.getRange();
}
@Override
public String getName() {
+ checkDelegate();
return delegate.getName();
}
@Override
public String getShortName() {
+ checkDelegate();
return delegate.getShortName();
}
@Override
public boolean isMultipleReferencesAllowed() {
+ checkDelegate();
return delegate.isMultipleReferencesAllowed();
}
@@ -85,5 +91,11 @@
return featureName;
}
+ private void checkDelegate() {
+ if(delegate == null) {
+ throw new RuntimeException("Feature with name '"+ featureName +"' has not yet been resolved. Most likely, it is not defined for the given type.");
+ }
+
+ }
}
diff --git a/ruta-core/src/test/java/org/apache/uima/ruta/expression/IndexedListExpressionTest.java b/ruta-core/src/test/java/org/apache/uima/ruta/expression/IndexedListExpressionTest.java
index d7cf655..608ef7d 100644
--- a/ruta-core/src/test/java/org/apache/uima/ruta/expression/IndexedListExpressionTest.java
+++ b/ruta-core/src/test/java/org/apache/uima/ruta/expression/IndexedListExpressionTest.java
@@ -22,31 +22,29 @@
import org.apache.uima.cas.CAS;
import org.apache.uima.ruta.engine.Ruta;
import org.apache.uima.ruta.engine.RutaTestUtils;
+import org.junit.Ignore;
import org.junit.Test;
public class IndexedListExpressionTest {
+
@Test
- public void test() {
+ @Ignore
+ public void test() throws Exception{
String document = "Some text.";
String script = "";
- script += "STRINGLIST sl = {\"Some\", \"text\"}";
+ script += "STRINGLIST sl = {\"Some\", \"text\"};";
script += "W.ct == sl[0]{-> T1};";
script += "W.ct == sl[1]{-> T2};";
script += "W{REGEXP(sl[0]) -> T3};";
script += "W{REGEXP(sl[1]) -> T4};";
- CAS cas = null;
- try {
- cas = RutaTestUtils.getCAS(document);
- Ruta.apply(cas, script);
- } catch (Exception e) {
- e.printStackTrace();
- }
+ CAS cas = RutaTestUtils.getCAS(document);
+ Ruta.apply(cas, script);
-// RutaTestUtils.assertAnnotationsEquals(cas, 1, 1, "Some");
-// RutaTestUtils.assertAnnotationsEquals(cas, 2, 1, "text");
-// RutaTestUtils.assertAnnotationsEquals(cas, 3, 1, "Some");
-// RutaTestUtils.assertAnnotationsEquals(cas, 4, 1, "text");
-
+ RutaTestUtils.assertAnnotationsEquals(cas, 1, 1, "Some");
+ RutaTestUtils.assertAnnotationsEquals(cas, 2, 1, "text");
+ RutaTestUtils.assertAnnotationsEquals(cas, 3, 1, "Some");
+ RutaTestUtils.assertAnnotationsEquals(cas, 4, 1, "text");
+
}
}
diff --git a/ruta-docbook/src/docbook/tools.ruta.howtos.xml b/ruta-docbook/src/docbook/tools.ruta.howtos.xml
index 2d6229e..c170ff6 100644
--- a/ruta-docbook/src/docbook/tools.ruta.howtos.xml
+++ b/ruta-docbook/src/docbook/tools.ruta.howtos.xml
@@ -263,7 +263,8 @@
A FileSet specifying the UIMA Ruta script files that should be built.
If this parameter is not specified, then all UIMA Ruta script files
- in the output directory (e.g., target/classes) of the project will be built.
+ in the output directory (e.g., target/classes) of the project will
+ be built.
default value: none
<scriptFiles>
@@ -288,8 +289,8 @@
<analysisEngineOutputDirectory>${project.build.directory}/
generated-sources/ruta/descriptor</analysisEngineOutputDirectory>
- <!-- The template descriptor for the generated type system. By default the
- descriptor of the maven dependency is loaded. -->
+ <!-- The template descriptor for the generated type system.
+ By default the descriptor of the maven dependency is loaded. -->
<!-- default value: none -->
<!-- not used in this example <typeSystemTemplate>...
</typeSystemTemplate> -->
diff --git a/ruta-docbook/src/docbook/tools.ruta.language.syntax.xml b/ruta-docbook/src/docbook/tools.ruta.language.syntax.xml
index b45631e..6b8acad 100644
--- a/ruta-docbook/src/docbook/tools.ruta.language.syntax.xml
+++ b/ruta-docbook/src/docbook/tools.ruta.language.syntax.xml
@@ -83,9 +83,11 @@
("," Identifier)* ("=" NumberExpression)?)
| ("BOOLEAN" Identifier ("," Identifier)*
("=" BooleanExpression)?)
- | ("ANNOTATION" Identifier ("=" AnnotationExpression)?)
- | ("WORDLIST" Identifier ("=" WordListExpression | StringExpression)?)
- | ("WORDTABLE" Identifier ("=" WordTableExpression | StringExpression)?)
+ | ("ANNOTATION" Identifier("="AnnotationExpression)?)
+ | ("WORDLIST" Identifier ("=" WordListExpression
+ | StringExpression)?)
+ | ("WORDTABLE" Identifier ("=" WordTableExpression
+ | StringExpression)?)
| ("TYPELIST" Identifier ("=" TypeListExpression)?)
| ("STRINGLIST" Identifier
("=" StringListExpression)?)
@@ -102,13 +104,13 @@
| 'SENTENCEEND' | 'W' | 'PM' | 'ANY' | 'ALL'
| 'SPACE' | 'BREAK')
BlockDeclaration -> "BLOCK" "(" Identifier ")" RuleElementWithCA
- "{" Statements "}"]]></programlisting>
-actionDeclaration -> "ACTION" Identifier "(" ("VAR"? VarType Identifier)?
- ("," "VAR"? VarType Identifier)*")"
+ "{" Statements "}"
+actionDeclaration -> "ACTION" Identifier "(" ("VAR"? VarType
+ Identifier)? ("," "VAR"? VarType Identifier)*")"
"=" Action ( "," Action)* ";"
-conditionDeclaration-> "CONDITION" Identifier "(" ("VAR"? VarType Identifier)?
- ("," "VAR"? VarType Identifier)*")"
- "=" Condition ( "," Condition)* ";"
+conditionDeclaration-> "CONDITION" Identifier "(" ("VAR"? VarType
+ Identifier)? ("," "VAR"? VarType Identifier)*")"
+ "=" Condition ( "," Condition)* ";"]]></programlisting>
Syntax of statements and rule elements:
<programlisting><![CDATA[SimpleStatement -> SimpleRule | RegExpRule | ConjunctRules
| DocumentActionRule
@@ -155,7 +157,8 @@
<para>
It is also possible to use specific expression as implicit conditions or action additionally to the set of available conditions and actions.
<programlisting><![CDATA[Condition -> BooleanExpression | FeatureMatchExpression
-Action -> TypeExpression | FeatureAssignmentExpression | VariableAssignmentExpression
+Action -> TypeExpression | FeatureAssignmentExpression
+ | VariableAssignmentExpression
]]></programlisting>
diff --git a/ruta-docbook/src/docbook/tools.ruta.language.xml b/ruta-docbook/src/docbook/tools.ruta.language.xml
index 286ff78..63df653 100644
--- a/ruta-docbook/src/docbook/tools.ruta.language.xml
+++ b/ruta-docbook/src/docbook/tools.ruta.language.xml
@@ -850,8 +850,7 @@
construct, and ignore all filtering settings.
</para>
- <programlisting><![CDATA[
-RegExpRule -> StringExpression "->" GroupAssignment
+ <programlisting><![CDATA[RegExpRule -> StringExpression "->" GroupAssignment
("," GroupAssignment)* ";"
GroupAssignment -> TypeExpression FeatureAssignment?
| NumberEpxression "=" TypeExpression
diff --git a/ruta-docbook/src/docbook/tools.ruta.overview.xml b/ruta-docbook/src/docbook/tools.ruta.overview.xml
index 84131d2..7507df7 100644
--- a/ruta-docbook/src/docbook/tools.ruta.overview.xml
+++ b/ruta-docbook/src/docbook/tools.ruta.overview.xml
@@ -391,7 +391,8 @@
<programlisting><![CDATA[DECLARE Annotation EmplRelation
(Employee employeeRef, Employer employerRef);
e1:Employer # EmploymentIndicator # e2:Employee)
- {-> EmplRelation, EmplRelation.employeeRef=e2, EmplRelation.employerRef=e1};]]></programlisting>
+ {-> EmplRelation, EmplRelation.employeeRef=e2,
+ EmplRelation.employerRef=e1};]]></programlisting>
<para>
Global variables for annotations are declared like other variables and are able to store annotations
diff --git a/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/validator/LanguageCheckerVisitor.java b/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/validator/LanguageCheckerVisitor.java
index 0e3fead..d7ee795 100644
--- a/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/validator/LanguageCheckerVisitor.java
+++ b/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/validator/LanguageCheckerVisitor.java
@@ -614,6 +614,12 @@
return false;
}
RutaVariableReference ref = (RutaVariableReference) s;
+ if(ref.getType() == RutaTypeConstants.RUTA_TYPE_WT || ref.getType() == RutaTypeConstants.RUTA_TYPE_WL) {
+ if(StringUtils.isBlank(ref.getName())) {
+ // declaration with a string expression: do not check
+ return false;
+ }
+ }
if ((ref.getType() & RutaTypeConstants.RUTA_TYPE_AT) != 0) {
// types
String name = ref.getName();
diff --git a/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g b/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g
index 3210be7..7f605ee 100644
--- a/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g
+++ b/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g
@@ -486,14 +486,14 @@
stmts.add(StatementFactory.createDeclarationsStatement(type, decls, init));
}
|
- type = WORDLIST id = Identifier (ASSIGN_EQUAL (wl = wordListExpression | wl = stringExpression))? SEMI
+ type = WORDLIST id = Identifier (ASSIGN_EQUAL wl = wordListOrStringExpression )? SEMI
{
addVariable(id.getText(), type.getText());
decls.add(StatementFactory.createListVariable(id,type,wl));
stmts.add(StatementFactory.createDeclarationsStatement(type, decls, wl));
}
|
- type = WORDTABLE id = Identifier (ASSIGN_EQUAL (wt = wordTableExpression | wt = stringExpression))? SEMI
+ type = WORDTABLE id = Identifier (ASSIGN_EQUAL wt = wordTableOrStringExpression)? SEMI
{
addVariable(id.getText(), type.getText());
decls.add(StatementFactory.createTableVariable(id,type,wt));
@@ -2447,6 +2447,15 @@
;
+wordListOrStringExpression returns [Expression expr = null]
+ :
+ (stringExpression)=>id = stringExpression
+ {expr = ExpressionFactory.createListVariableReference(id);}
+ |
+ e = wordListExpression
+ {expr = e;}
+ ;
+
wordTableExpression returns [Expression expr = null]
:
id = Identifier
@@ -2456,6 +2465,15 @@
{expr = ExpressionFactory.createRessourceReference(path);}
;
+wordTableOrStringExpression returns [Expression expr = null]
+ :
+ (stringExpression)=>id = stringExpression
+ {expr = ExpressionFactory.createTableVariableReference(id);}
+ |
+ e = wordTableExpression
+ {expr = e;}
+ ;
+
//seems OK
numberExpression returns [Expression expr = null]
@init {
diff --git a/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ExpressionFactory.java b/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ExpressionFactory.java
index 0b2cac9..70bd847 100644
--- a/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ExpressionFactory.java
+++ b/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ExpressionFactory.java
@@ -281,6 +281,17 @@
public static Expression createTableVariableReference(Token id) {
return newVariableReference(id, RutaTypeConstants.RUTA_TYPE_WT);
}
+
+ public static Expression createListVariableReference(Expression ref) {
+ int bounds[] = getSurroundingBounds(ref);
+ return new RutaVariableReference(bounds[0], bounds[1], "", RutaTypeConstants.RUTA_TYPE_WL);
+ }
+
+ public static Expression createTableVariableReference(Expression ref) {
+ int bounds[] = getSurroundingBounds(ref);
+ return new RutaVariableReference(bounds[0], bounds[1], "", RutaTypeConstants.RUTA_TYPE_WT);
+ }
+
public static Expression createRessourceReference(Token path) {
int bounds[] = getBounds(path);
@@ -428,5 +439,7 @@
return new NullExpression(bounds[0], bounds[1]);
}
+
+
}