You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by pk...@apache.org on 2015/04/18 22:21:01 UTC

svn commit: r1674579 - in /uima/ruta/trunk: example-projects/ruta-maven-example/ example-projects/ruta-maven-example/src/test/java/ example-projects/ruta-maven-example/src/test/java/org/ example-projects/ruta-maven-example/src/test/java/org/apache/ exa...

Author: pkluegl
Date: Sat Apr 18 20:21:00 2015
New Revision: 1674579

URL: http://svn.apache.org/r1674579
Log:
UIMA-4320
- started to add twl/mtwl maven build in example

Added:
    uima/ruta/trunk/example-projects/ruta-maven-example/src/test/java/
    uima/ruta/trunk/example-projects/ruta-maven-example/src/test/java/org/
    uima/ruta/trunk/example-projects/ruta-maven-example/src/test/java/org/apache/
    uima/ruta/trunk/example-projects/ruta-maven-example/src/test/java/org/apache/uima/
    uima/ruta/trunk/example-projects/ruta-maven-example/src/test/java/org/apache/uima/ruta/
    uima/ruta/trunk/example-projects/ruta-maven-example/src/test/java/org/apache/uima/ruta/example/
    uima/ruta/trunk/example-projects/ruta-maven-example/src/test/java/org/apache/uima/ruta/example/ExampleTest.java
Modified:
    uima/ruta/trunk/example-projects/ruta-maven-example/pom.xml
    uima/ruta/trunk/ruta-maven-plugin/src/main/java/org/apache/uima/ruta/maven/RutaGenerateMTWLMojo.java
    uima/ruta/trunk/ruta-maven-plugin/src/main/java/org/apache/uima/ruta/maven/RutaGenerateTWLMojo.java

Modified: uima/ruta/trunk/example-projects/ruta-maven-example/pom.xml
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/example-projects/ruta-maven-example/pom.xml?rev=1674579&r1=1674578&r2=1674579&view=diff
==============================================================================
--- uima/ruta/trunk/example-projects/ruta-maven-example/pom.xml (original)
+++ uima/ruta/trunk/example-projects/ruta-maven-example/pom.xml Sat Apr 18 20:21:00 2015
@@ -1,141 +1,238 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-	<groupId>org.apache.uima</groupId>
-	<artifactId>ruta-maven-example</artifactId>
-	<version>2.3.0-SNAPSHOT</version>
-
-	<dependencies>
-		<dependency>
-			<groupId>org.apache.uima</groupId>
-			<artifactId>ruta-core-ext</artifactId>
-			<version>${project.version}</version>
-			<scope>compile</scope>
-		</dependency>
-	</dependencies>
-
-
-	<build>
-		<resources>
-			<resource>
-				<directory>src/main/ruta</directory>
-			</resource>
-			<resource>
-				<directory>src/main/resources</directory>
-			</resource>
-			<resource>
-				<directory>${project.build.directory}/generated-sources/ruta/descriptor</directory>
-			</resource>
-		</resources>
-
-		<plugins>
-			<plugin>
-				<groupId>org.apache.uima</groupId>
-				<artifactId>ruta-maven-plugin</artifactId>
-				<version>${project.version}</version>
-				<configuration>
-
-					<!-- This is a exemplary configuration, which explicitly specifies the 
-						default configuration values if not mentioned otherwise. -->
-
-					<!-- The directory where the generated type system descriptors will 
-						be written stored. -->
-					<typeSystemOutputDirectory>${project.build.directory}/generated-sources/ruta/descriptor</typeSystemOutputDirectory>
-
-					<!-- The directory where the generated analysis engine descriptors will 
-						be stored. -->
-					<analysisEngineOutputDirectory>${project.build.directory}/generated-sources/ruta/descriptor</analysisEngineOutputDirectory>
-
-					<!-- The template descriptor for the generated type system. -->
-					<!-- not used in this example <typeSystemTemplate>...</typeSystemTemplate> -->
-
-					<!-- The template descriptor for the generated analysis engine. -->
-					<!-- not used in this example <analysisEngineTemplate>...</analysisEngineTemplate> -->
-
-					<!-- Script paths of the generated analysis engine descriptor. No default values given.-->
-					<scriptPaths></scriptPaths>
-
-					<!-- Descriptor paths of the generated analysis engine descriptor. No default values given. -->
-					<descriptorPaths></descriptorPaths>
-
-					<!-- Resource paths of the generated analysis engine descriptor. No default values given. -->
-					<resourcePaths></resourcePaths>
-
-					<!-- Suffix used for the generated type system descriptors. -->
-					<typeSystemSuffix>TypeSystem</typeSystemSuffix>
-
-					<!-- Suffix used for the generated analysis engine descriptors. -->
-					<typeSystemSuffix>Engine</typeSystemSuffix>
-
-					<!-- Source file encoding. Default value: ${project.build.sourceEncoding} -->
-					<encoding>UTF-8</encoding>
-
-					<!-- Type of type system imports. default false = import by location. -->
-					<importByName>false</importByName>
-
-					<!-- Option to resolve imports while building. -->
-					<resolveImports>false</resolveImports>
-
-					<!-- Amount of retries for building dependent descriptors. Default value 
-						-1: three retires for each script. -->
-					<maxBuildRetries>-1</maxBuildRetries>
-
-					<!-- List of packages with language extensions -->
-					<extensionPackages>
-						<extensionPackage>org.apache.uima.ruta</extensionPackage>
-					</extensionPackages>
-
-					<!-- Add UIMA Ruta nature to .project -->
-					<addRutaNature>false</addRutaNature>
-
-				</configuration>
-				<executions>
-					<execution>
-						<id>default</id>
-						<phase>process-classes</phase>
-						<goals>
-							<goal>generate</goal>
-						</goals>
-					</execution>
-				</executions>
-			</plugin>
-		</plugins>
-		<pluginManagement>
-			<plugins>
-				<!--This plugin's configuration is used to store Eclipse m2e settings 
-					only. It has no influence on the Maven build itself. -->
-				<plugin>
-					<groupId>org.eclipse.m2e</groupId>
-					<artifactId>lifecycle-mapping</artifactId>
-					<version>1.0.0</version>
-					<configuration>
-						<lifecycleMappingMetadata>
-							<pluginExecutions>
-								<pluginExecution>
-									<pluginExecutionFilter>
-										<groupId>
-											org.apache.uima
-										</groupId>
-										<artifactId>
-											ruta-maven-plugin
-										</artifactId>
-										<versionRange>
-											[2.1.0,)
-										</versionRange>
-										<goals>
-											<goal>generate</goal>
-										</goals>
-									</pluginExecutionFilter>
-									<action>
-										<ignore></ignore>
-									</action>
-								</pluginExecution>
-							</pluginExecutions>
-						</lifecycleMappingMetadata>
-					</configuration>
-				</plugin>
-			</plugins>
-		</pluginManagement>
-	</build>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.uima</groupId>
+ <artifactId>ruta-maven-example</artifactId>
+ <version>2.3.0-SNAPSHOT</version>
+
+ <dependencies>
+ <dependency>
+   <groupId>org.apache.uima</groupId>
+   <artifactId>ruta-core</artifactId>
+   <version>${project.version}</version>
+   <scope>compile</scope>
+  </dependency>
+  <dependency>
+   <groupId>org.apache.uima</groupId>
+   <artifactId>ruta-core-ext</artifactId>
+   <version>${project.version}</version>
+   <scope>compile</scope>
+  </dependency>
+  <dependency>
+   <groupId>junit</groupId>
+   <artifactId>junit</artifactId>
+   <version>4.5</version>
+   <scope>test</scope>
+  </dependency>
+ </dependencies>
+
+
+ <build>
+  <resources>
+   <resource>
+    <directory>src/main/ruta</directory>
+   </resource>
+   <resource>
+    <directory>src/main/resources</directory>
+   </resource>
+   <resource>
+    <directory>${project.build.directory}/generated-sources/ruta/descriptor</directory>
+   </resource>
+   <resource>
+    <directory>${project.build.directory}/generated-sources/ruta/resources</directory>
+   </resource>
+  </resources>
+
+  <plugins>
+   <plugin>
+    <groupId>org.apache.uima</groupId>
+    <artifactId>ruta-maven-plugin</artifactId>
+    <version>${project.version}</version>
+    <configuration>
+
+     <!-- This is a exemplary configuration, which explicitly specifies the 
+      default configuration values if not mentioned otherwise. -->
+
+     <!-- The directory where the generated type system descriptors will 
+      be written stored. -->
+     <typeSystemOutputDirectory>${project.build.directory}/generated-sources/ruta/descriptor</typeSystemOutputDirectory>
+
+     <!-- The directory where the generated analysis engine descriptors will 
+      be stored. -->
+     <analysisEngineOutputDirectory>${project.build.directory}/generated-sources/ruta/descriptor</analysisEngineOutputDirectory>
+
+     <!-- The template descriptor for the generated type system. -->
+     <!-- not used in this example <typeSystemTemplate>...</typeSystemTemplate> -->
+
+     <!-- The template descriptor for the generated analysis engine. -->
+     <!-- not used in this example <analysisEngineTemplate>...</analysisEngineTemplate> -->
+
+     <!-- Script paths of the generated analysis engine descriptor. No default 
+      values given. -->
+     <scriptPaths></scriptPaths>
+
+     <!-- Descriptor paths of the generated analysis engine descriptor. No 
+      default values given. -->
+     <descriptorPaths></descriptorPaths>
+
+     <!-- Resource paths of the generated analysis engine descriptor. No 
+      default values given. -->
+     <resourcePaths></resourcePaths>
+
+     <!-- Suffix used for the generated type system descriptors. -->
+     <typeSystemSuffix>Engine</typeSystemSuffix>
+
+     <!-- Suffix used for the generated analysis engine descriptors. -->
+     <typeSystemSuffix>TypeSystem</typeSystemSuffix>
+
+     <!-- Source file encoding. Default value: ${project.build.sourceEncoding} -->
+     <encoding>UTF-8</encoding>
+
+     <!-- Type of type system imports. default false = import by location. -->
+     <importByName>false</importByName>
+
+     <!-- Option to resolve imports while building. -->
+     <resolveImports>false</resolveImports>
+
+     <!-- Amount of retries for building dependent descriptors. Default value 
+      -1: three retires for each script. -->
+     <maxBuildRetries>-1</maxBuildRetries>
+
+     <!-- List of packages with language extensions -->
+     <extensionPackages>
+      <extensionPackage>org.apache.uima.ruta</extensionPackage>
+     </extensionPackages>
+
+     <!-- Add UIMA Ruta nature to .project -->
+     <addRutaNature>false</addRutaNature>
+
+    </configuration>
+    <executions>
+     <execution>
+      <id>default</id>
+      <phase>process-classes</phase>
+      <goals>
+       <goal>generate</goal>
+      </goals>
+     </execution>
+    </executions>
+   </plugin>
+
+   <plugin>
+    <groupId>org.apache.uima</groupId>
+    <artifactId>ruta-maven-plugin</artifactId>
+    <version>2.3.0-SNAPSHOT</version>
+    <configuration></configuration>
+    <executions>
+     <execution>
+      <id>default</id>
+      <phase>process-classes</phase>
+      <goals>
+       <goal>twl</goal>
+      </goals>
+      <configuration>
+       <!-- This is a exemplary configuration, which explicitly specifies 
+        the default configuration values if not mentioned otherwise. -->
+
+       <!-- Compress resulting tree word list. -->
+       <compress>true</compress>
+
+       <!-- The source files for the tree word list. -->
+       <inputFiles>
+        <directory>${basedir}/src/main/resources</directory>
+        <includes>
+         <include>*.txt</include>
+        </includes>
+       </inputFiles>
+
+       <!-- The directory where the generated tree word lists will be written 
+        to. -->
+       <outputDirectory>${project.build.directory}/generated-sources/ruta/resources/</outputDirectory>
+
+       <!-- Source file encoding. Default value: ${project.build.sourceEncoding} -->
+       <encoding>UTF-8</encoding>
+
+      </configuration>
+     </execution>
+    </executions>
+   </plugin>
+
+   <plugin>
+    <groupId>org.apache.uima</groupId>
+    <artifactId>ruta-maven-plugin</artifactId>
+    <version>2.3.0-SNAPSHOT</version>
+    <configuration></configuration>
+    <executions>
+     <execution>
+      <id>default</id>
+      <phase>process-classes</phase>
+      <goals>
+       <goal>mtwl</goal>
+      </goals>
+      <configuration>
+       <!-- This is a exemplary configuration, which explicitly specifies 
+        the default configuration values if not mentioned otherwise. -->
+
+       <!-- Compress resulting tree word list. -->
+       <compress>true</compress>
+
+       <!-- The source files for the multi tree word list. -->
+       <inputFiles>
+        <directory>${basedir}/src/main/resources</directory>
+        <includes>
+         <include>*.txt</include>
+        </includes>
+       </inputFiles>
+
+       <!-- The directory where the generated tree word lists will be written 
+        to. -->
+       <outputFile>${project.build.directory}/generated-sources/ruta/resources/generated.mtwl</outputFile>
+
+       <!-- Source file encoding. Default value: ${project.build.sourceEncoding} -->
+       <encoding>UTF-8</encoding>
+      </configuration>
+     </execution>
+    </executions>
+   </plugin>
+  </plugins>
+  <pluginManagement>
+   <plugins>
+    <!--This plugin's configuration is used to store Eclipse m2e settings 
+     only. It has no influence on the Maven build itself. -->
+    <plugin>
+     <groupId>org.eclipse.m2e</groupId>
+     <artifactId>lifecycle-mapping</artifactId>
+     <version>1.0.0</version>
+     <configuration>
+      <lifecycleMappingMetadata>
+       <pluginExecutions>
+        <pluginExecution>
+         <pluginExecutionFilter>
+          <groupId>
+           org.apache.uima
+          </groupId>
+          <artifactId>
+           ruta-maven-plugin
+          </artifactId>
+          <versionRange>
+           [2.1.0,)
+          </versionRange>
+          <goals>
+           <goal>generate</goal>
+           <goal>twl</goal>
+           <goal>mtwl</goal>
+          </goals>
+         </pluginExecutionFilter>
+         <action>
+          <ignore></ignore>
+         </action>
+        </pluginExecution>
+       </pluginExecutions>
+      </lifecycleMappingMetadata>
+     </configuration>
+    </plugin>
+   </plugins>
+  </pluginManagement>
+ </build>
 
 </project>
\ No newline at end of file

Added: uima/ruta/trunk/example-projects/ruta-maven-example/src/test/java/org/apache/uima/ruta/example/ExampleTest.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/example-projects/ruta-maven-example/src/test/java/org/apache/uima/ruta/example/ExampleTest.java?rev=1674579&view=auto
==============================================================================
--- uima/ruta/trunk/example-projects/ruta-maven-example/src/test/java/org/apache/uima/ruta/example/ExampleTest.java (added)
+++ uima/ruta/trunk/example-projects/ruta-maven-example/src/test/java/org/apache/uima/ruta/example/ExampleTest.java Sat Apr 18 20:21:00 2015
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.example;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+import org.apache.uima.UIMAFramework;
+import org.apache.uima.analysis_engine.AnalysisEngine;
+import org.apache.uima.analysis_engine.AnalysisEngineDescription;
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.FSIterator;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.cas.text.AnnotationIndex;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.util.InvalidXMLException;
+import org.apache.uima.util.XMLInputSource;
+import org.junit.Test;
+
+public class ExampleTest {
+
+  @Test
+  public void testMain() throws InvalidXMLException, IOException, ResourceInitializationException,
+          AnalysisEngineProcessException {
+//    File aeFile = new File("target/classes/uima/ruta/example/MainEngine.xml");
+//
+//    AnalysisEngineDescription aed = UIMAFramework.getXMLParser().parseAnalysisEngineDescription(
+//            new XMLInputSource(aeFile));
+//    AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(aed);
+//    CAS cas = ae.newCAS();
+//    cas.setDocumentText("Ogren, P.V., Wetzler, P.G., Bethard, S.: ClearTK: A UIMA Toolkit for Statistical Natural Language Processing. In: UIMA for NLP workshop at LREC 08. (2008)");
+//    ae.process(cas);
+//
+//    Type type = cas.getTypeSystem().getType("uima.ruta.example.Bibtex");
+//    AnnotationIndex<AnnotationFS> ai = cas.getAnnotationIndex(type);
+//    FSIterator<AnnotationFS> iterator = ai.iterator();
+//    assertEquals(1, ai.size());
+//    AnnotationFS a = iterator.next();
+//    assertEquals(
+//            "Ogren, P.V., Wetzler, P.G., Bethard, S.: ClearTK: A UIMA Toolkit for Statistical Natural Language Processing. In: UIMA for NLP workshop at LREC 08. (2008)",
+//            a.getCoveredText());
+  }
+
+}

Modified: uima/ruta/trunk/ruta-maven-plugin/src/main/java/org/apache/uima/ruta/maven/RutaGenerateMTWLMojo.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-maven-plugin/src/main/java/org/apache/uima/ruta/maven/RutaGenerateMTWLMojo.java?rev=1674579&r1=1674578&r2=1674579&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-maven-plugin/src/main/java/org/apache/uima/ruta/maven/RutaGenerateMTWLMojo.java (original)
+++ uima/ruta/trunk/ruta-maven-plugin/src/main/java/org/apache/uima/ruta/maven/RutaGenerateMTWLMojo.java Sat Apr 18 20:21:00 2015
@@ -48,7 +48,7 @@ public class RutaGenerateMTWLMojo extend
   private BuildContext buildContext;
 
   /**
-   * The file where the generated multi tree word list will be written.
+   * The file where the generated multi tree word list will be written to.
    */
   @Parameter(defaultValue = "${project.build.directory}/generated-sources/ruta/resources/generated.mtwl", required = true)
   private File outputFile;

Modified: uima/ruta/trunk/ruta-maven-plugin/src/main/java/org/apache/uima/ruta/maven/RutaGenerateTWLMojo.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-maven-plugin/src/main/java/org/apache/uima/ruta/maven/RutaGenerateTWLMojo.java?rev=1674579&r1=1674578&r2=1674579&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-maven-plugin/src/main/java/org/apache/uima/ruta/maven/RutaGenerateTWLMojo.java (original)
+++ uima/ruta/trunk/ruta-maven-plugin/src/main/java/org/apache/uima/ruta/maven/RutaGenerateTWLMojo.java Sat Apr 18 20:21:00 2015
@@ -48,7 +48,7 @@ public class RutaGenerateTWLMojo extends
   private BuildContext buildContext;
 
   /**
-   * The directory where the generated tree word lists will be written.
+   * The directory where the generated tree word lists will be written to.
    */
   @Parameter(defaultValue = "${project.build.directory}/generated-sources/ruta/resources/", required = true)
   private File outputDirectory;