uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Klügl <peter.klu...@averbis.com>
Subject Re: Error after updating to UIMA Ruta 2.5
Date Tue, 15 Nov 2016 08:17:16 GMT
Hi,


sorry for the delayed response, I was travelling for the last few days.


I made too many assumptions in my last mail. I have hardly any
experience with sbt and no experience at all with Java Play applications.


 I will take a close look today and will get back to you with more
information.


Best,


Peter


Am 11.11.2016 um 13:11 schrieb Ingo Glaser:
> Actually the last email did not formate properly, hence I  just wanted to rewrite the
part about the directory structure:
>
> _APP_TypeSystem.xml is stored in the following path relative to the project root /app/informationExtraction/appTypes/
>
> Hey again me,
>
> Furthermore I do have a directory /app/rutaComponents with the following content
>
> — ./descritor (Fixed descriptors)
> — ./generatedComponents (Dynamic components) with following content
> —— ./descriptor
> — — ./resources
> — — ./script
> — ./resources
> — ./script (Fixed scripts)
> — ./scriptImporter (Importer for dynamic and new scripts)
>
> With the script importer, I can import scripts from /app/rutaComponents/generatedComponents/script
in order to create a descriptor in ./generatedComponents/descriptor
>
>
> Again sorry for the inappropriate formation!
>
> Best,
> Ingo
>
>
>> On 11 Nov 2016, at 13:04, Ingo Glaser <fr33g@web.de> wrote:
>>
>> Hi Peter,
>>
>> I figured that even when using version 2.5.0, importByLocation is default for me.
I did debug it as well as the import tags in the created .xml files do have an attribute location.

>>
>> When I was previously talking about the error, this happened during executing one
of my pipelines. Therefore I’ve used some previously created descriptors, they did work
in version 2.3.0 though. These descriptors are based on ruta scripts, which do not change
anymore. However, I’ve also the option to create (or update) a ruta script manually and
then using the application in order to create the proper descriptor in xml. The weird thing
I’ve just noticed is, when creating the .xml descriptor from my ruta script, the (or an)
error already occurred when using version 2.3.0, however, the process of creating the .xml
descriptor did not abort. When using version 2.5.0 the creation process does abort though.
Either way, the pipeline with version 2.5.0 does not work. When running my pipeline, either
with the newly created descriptors (where the error occurs during creation) or with the existing
ones, the process is aborted with the error from my first message.
>>
>> The error I show you below, actually occurs when running my importer. Hence I also
add the importer. The previous error, as already mentioned actually occurred when running
my pipeline and thus using the fixed created descriptor. So for now I think it makes more
sense, to first solve the problem with creating the descriptor from my ruta scripts. I think
afterwards I can solve the other issue as well, since they somehow relate to each other.
>>
>> Below I’d like to give you some more information, also according to your request:
>>
>> The _APP_TypeSystem.xml is stored in the following path relative to the project root
/app/informationExtraction/appTypes/
>> Furthermore I do have a directory /app/rutaComponents with the following content
>> ./descriptor (Fixed descriptors)
>> ./generatedComponents (Dynamic components)
>> ./descriptor
>> ./resources
>> ./script
>> ./resources
>> ./script (Fixed scripts)
>> ./scriptImporter (Importer for dynamic and new scripts)
>> With the script importer, I can import scripts from ./generatedComponents/script
in order to create a descriptor in ./generatedComponents/descriptor
>>
>> - Complete error:
>>
>> org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException:
org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException:
java.lang.RuntimeException: Cannot resolve imports in _APP_TypeSystem
>> 	at org.apache.uima.ruta.parser.RutaParser.emitErrorMessage(RutaParser.java:397)
>> 	at org.apache.uima.ruta.parser.RutaParser.file_input(RutaParser.java:733)
>> 	at org.apache.uima.ruta.descriptor.RutaDescriptorFactory.parseDescriptorInformation(RutaDescriptorFactory.java:146)
>> 	at rutaComponents.scriptImporter.RutaComponentGenerator.generate(RutaComponentGenerator.java:79)
>> 	at controllers.RutaController.saveRutaFile(RutaController.java:91)
>> 	at Routes$$anonfun$routes$1$$anonfun$applyOrElse$82$$anonfun$apply$82.apply(routes_routing.scala:1494)
>> 	at Routes$$anonfun$routes$1$$anonfun$applyOrElse$82$$anonfun$apply$82.apply(routes_routing.scala:1494)
>> 	at play.core.Router$HandlerInvokerFactory$$anon$4.resultCall(Router.scala:264)
>> 	at play.core.Router$HandlerInvokerFactory$JavaActionInvokerFactory$$anon$15$$anon$1.invocation(Router.scala:255)
>> 	at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:55)
>> 	at play.GlobalSettings$1.call(GlobalSettings.java:67)
>> 	at play.core.j.JavaAction$$anonfun$11.apply(JavaAction.scala:82)
>> 	at play.core.j.JavaAction$$anonfun$11.apply(JavaAction.scala:82)
>> 	at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
>> 	at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
>> 	at play.core.j.HttpExecutionContext$$anon$2.run(HttpExecutionContext.scala:40)
>> 	at play.api.libs.iteratee.Execution$trampoline$.execute(Execution.scala:46)
>> 	at play.core.j.HttpExecutionContext.execute(HttpExecutionContext.scala:32)
>> 	at scala.concurrent.impl.Future$.apply(Future.scala:31)
>> 	at scala.concurrent.Future$.apply(Future.scala:485)
>> 	at play.core.j.JavaAction$class.apply(JavaAction.scala:82)
>> 	at play.core.Router$HandlerInvokerFactory$JavaActionInvokerFactory$$anon$15$$anon$1.apply(Router.scala:252)
>> 	at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:130)
>> 	at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:130)
>> 	at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
>> 	at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:129)
>> 	at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:128)
>> 	at scala.Option.map(Option.scala:145)
>> 	at play.api.mvc.Action$$anonfun$apply$1.apply(Action.scala:128)
>> 	at play.api.mvc.Action$$anonfun$apply$1.apply(Action.scala:121)
>> 	at play.api.libs.iteratee.Iteratee$$anonfun$mapM$1.apply(Iteratee.scala:483)
>> 	at play.api.libs.iteratee.Iteratee$$anonfun$mapM$1.apply(Iteratee.scala:483)
>> 	at play.api.libs.iteratee.Iteratee$$anonfun$flatMapM$1.apply(Iteratee.scala:519)
>> 	at play.api.libs.iteratee.Iteratee$$anonfun$flatMapM$1.apply(Iteratee.scala:519)
>> 	at play.api.libs.iteratee.Iteratee$$anonfun$flatMap$1$$anonfun$apply$14.apply(Iteratee.scala:496)
>> 	at play.api.libs.iteratee.Iteratee$$anonfun$flatMap$1$$anonfun$apply$14.apply(Iteratee.scala:496)
>> 	at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
>> 	at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
>> 	at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
>> 	at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)
>> 	at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
>> 	at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
>> 	at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
>> 	at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
>> Caused by: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException:
org.apache.uima.ruta.extensions.RutaParseRuntimeException: java.lang.RuntimeException: Cannot
resolve imports in _APP_TypeSystem
>> 	at org.apache.uima.ruta.parser.RutaParser.emitErrorMessage(RutaParser.java:397)
>> 	at org.apache.uima.ruta.parser.RutaParser.globalStatements(RutaParser.java:891)
>> 	at org.apache.uima.ruta.parser.RutaParser.file_input(RutaParser.java:714)
>> 	... 42 more
>> Caused by: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException:
java.lang.RuntimeException: Cannot resolve imports in _APP_TypeSystem
>> 	at org.apache.uima.ruta.parser.RutaParser.emitErrorMessage(RutaParser.java:397)
>> 	at org.apache.uima.ruta.parser.RutaParser.globalStatement(RutaParser.java:929)
>> 	at org.apache.uima.ruta.parser.RutaParser.globalStatements(RutaParser.java:870)
>> 	... 43 more
>> Caused by: org.apache.uima.ruta.extensions.RutaParseRuntimeException: java.lang.RuntimeException:
Cannot resolve imports in _APP_TypeSystem
>> 	at org.apache.uima.ruta.parser.RutaParser.emitErrorMessage(RutaParser.java:397)
>> 	at org.apache.uima.ruta.parser.RutaParser.importStatement(RutaParser.java:2609)
>> 	at org.apache.uima.ruta.parser.RutaParser.globalStatement(RutaParser.java:916)
>> 	... 44 more
>> Caused by: java.lang.RuntimeException: Cannot resolve imports in _APP_TypeSystem
>> 	at org.apache.uima.ruta.RutaEnvironment.importPackageFromTypeSystem(RutaEnvironment.java:594)
>> 	at org.apache.uima.ruta.parser.RutaParser.importPackage(RutaParser.java:548)
>> 	at org.apache.uima.ruta.parser.RutaParser.importStatement(RutaParser.java:2565)
>> 	... 45 more
>> Caused by: org.apache.uima.util.InvalidXMLException: An import could not be resolved.
 No file with name "_APP_TypeSystem.xml" was found in the class path or data path. (Descriptor:
<unknown>)
>> 	at org.apache.uima.resource.metadata.impl.Import_impl.findAbsoluteUrl(Import_impl.java:122)
>> 	at org.apache.uima.resource.metadata.impl.TypeSystemDescription_impl.resolveImports(TypeSystemDescription_impl.java:230)
>> 	at org.apache.uima.resource.metadata.impl.TypeSystemDescription_impl.resolveImports(TypeSystemDescription_impl.java:210)
>> 	at org.apache.uima.ruta.RutaEnvironment.importPackageFromTypeSystem(RutaEnvironment.java:592)
>> 	... 47 more
>>
>> - This is the relevant code of the importer:
>>
>> public class RutaComponentGenerator {
>>
>>    public static String GENERATED_COMPONENTS_PATH = "app" + File.separator + "rutaComponents"
+ File.separator + "generatedComponents" + File.separator;
>>
>>    /**
>>     * The path where the script will be written
>>     **/
>>    public static String SCRIPT_OUTPUT_PATH = GENERATED_COMPONENTS_PATH + "script"
+ File.separator;
>>
>>    /**
>>     * The path where the generated *TypeSystem.xml will be written
>>     **/
>>    private File typeSystemOutputDirectory = new File(GENERATED_COMPONENTS_PATH +
"descriptor");
>>
>>    /**
>>     * The path where the generated *Engine.xml will be written
>>     **/
>>    private File analysisEngineOutputDirectory = new File(GENERATED_COMPONENTS_PATH
+ "descriptor");
>>
>>    // The paths where other relevant scripts descriptors, and resources are
>>    private String[] scriptPaths = new String[]{"app" + File.separator + "rutaComponents"
+ File.separator + "script", GENERATED_COMPONENTS_PATH + "script"};
>>    private String[] descriptorPaths = new String[]{"app" + File.separator + "rutaComponents"
+ File.separator + "descriptor", GENERATED_COMPONENTS_PATH + "descriptor", "app" + File.separator
+ "informationExtraction" + File.separator + "lexiaTypes"};
>>    private String[] resourcePaths = new String[]{"app" + File.separator + "rutaComponents"
+ File.separator + "resources", GENERATED_COMPONENTS_PATH + "resources"};
>>
>>    /**
>>     * Prepares Generates the XML files needed for the AnalysisEngine and the TypeSystem
of the new RUTA component
>>     *
>>     * @param scriptName The file name of the script for which the RUTA-component
shall be generated
>>     */
>>    public void generate(String scriptName) {
>>
>>        if (!typeSystemOutputDirectory.exists()) {
>>            typeSystemOutputDirectory.mkdirs();
>>        }
>>        if (!analysisEngineOutputDirectory.exists()) {
>>            analysisEngineOutputDirectory.mkdirs();
>>        }
>>
>>        RutaDescriptorFactory factory = null;
>>        try {
>>            factory = new RutaDescriptorFactory("app" + File.separator + "rutaComponents"
+ File.separator + "descriptor" + File.separator + "BasicTypeSystem.xml", "app" + File.separator
+ "rutaComponents" + File.separator + "descriptor" + File.separator + "BasicEngine.xml");
>>        } catch (MalformedURLException e) {
>>            e.printStackTrace();
>>        }
>>
>>        RutaBuildOptions options = new RutaBuildOptions();
>>        options.setEncoding("UTF-8");
>>        options.setResolveImports(true);
>>
>>        // ToDo: Ensure that Mercurial-controlled scripts can't be rebuilt with this
mechanism (for security reasons)
>>        // ToDo: Ensure that the filename is unique for all scripts
>>        File scriptToBuild = new File(SCRIPT_OUTPUT_PATH + scriptName + ".ruta");
>>
>>        try {
>>            RutaDescriptorInformation descriptorInformation = factory.parseDescriptorInformation(scriptToBuild,
options);
>>            String packageString = "";
>>
>>            String engineOutput = new File(analysisEngineOutputDirectory, packageString
+ descriptorInformation.getScriptName() + options.getAnalysisEngineSuffix() + ".xml").getAbsolutePath();
>>
>>            String typeSystemOutput = new File(typeSystemOutputDirectory, packageString
+ descriptorInformation.getScriptName() + options.getTypeSystemSuffix() + ".xml").getAbsolutePath();
>>
>>            Pair<AnalysisEngineDescription, TypeSystemDescription> descriptions
= factory.createDescriptions(engineOutput, typeSystemOutput, descriptorInformation, options,
scriptPaths, descriptorPaths, resourcePaths);
>>
>>            write(descriptions.getKey(), engineOutput);
>>            write(descriptions.getValue(), typeSystemOutput);
>>        } catch (RecognitionException re) {
>>            System.err.println("Failed to parse UIMA Ruta script file: " + scriptToBuild.getAbsolutePath());
>>            re.printStackTrace();
>>        } catch (IOException ioe) {
>>            System.err.println("Failed to load UIMA Ruta script file: " + scriptToBuild.getAbsolutePath());
>>            ioe.printStackTrace();
>>        } catch (Exception e) {
>>            e.printStackTrace();
>>        }
>>    }
>>
>>    private void write(XMLizable desc, String aFilename) throws SAXException, IOException
{
>>        OutputStream os = null;
>>        try {
>>            File out = new File(aFilename);
>>            out.getParentFile().mkdirs();
>>            os = new FileOutputStream(out);
>>            Logger.info("Debug info: Writing descriptor to: " + out);
>>            desc.toXML(os);
>>        } finally {
>>            IOUtils.closeQuietly(os);
>>        }
>>    }
>> }
>> - Again some sample imports I’m using:
>>
>> // Import types
>> IMPORT PACKAGE de.tudarmstadt.ukp.dkpro.core.api.lexmorph.type.pos FROM _LEXIA_TypeSystem
AS pos;
>>
>> I’d really appreciate any help and thanks so much in advance!
>>
>> Best,
>> Ingo
>>> On 10 Nov 2016, at 16:33, Peter Klügl <peter.kluegl@averbis.com> wrote:
>>>
>>> Hi,
>>>
>>> this should work just like in 2.3.0. However, there are some changes
>>> (and a bug concerning the datapath).
>>>
>>> I assume that you use the ruta-maven-plugin to create the descriptors?
>>> Did you use import-by-location before? I think the default changed to
>>> import-by-name.
>>>
>>> <importByName>true</importByName>
>>>
>>> You can switch the import back to import-by-location in the plugin
>>> configuration (set it to false), but I rather recommend to use
>>> import-by-name in maven built projects.
>>> In order to do this, you best place the type system descriptor in the
>>> classpath. If you do not want to refer to the type system with package,
>>> place it directly in the classpath root, e.g., in src/main/resources.
>>>
>>> In case of a DKPro Core type system, add the artifact as a dependency if
>>> not done yet and change your import to:
>>>
>>> IMPORT PACKAGE de.tudarmstadt.ukp.dkpro.core.api.lexmorph.type.pos FROM
>>> desc.type.POS AS pos;
>>>
>>> Then, you do not need to copy anything since the typesystem is directly
>>> loaded from the dependency (the jar in the m2 repo).
>>>
>>> btw, there is an up-to-date example project for the integration of DKPro
>>> Core in Ruta scripts:
>>> https://github.com/pkluegl/ruta/tree/master/ruta-german-novel-with-dkpro
>>>
>>> In case this did not solve your problem: How did you import the
>>> typesystem before?
>>> - Is the type system located in the root of the classpath?
>>> - Did you specify descriptorPaths in the configuration parameters?
>>> - Have you set the datapath?
>>>
>>> Best,
>>>
>>> Peter
>>>
>>>
>>> Am 10.11.2016 um 15:57 schrieb Ingo Glaser:
>>>> Hey guys,
>>>>
>>>> I recently updated from Apache UIMA Ruta version 2.3.0 to 2.5.0. However,
after the upgrade, my application does not run anymore, due to some error in the ruta scripts.
I get the following error:
>>>>
>>>> Caused by: org.apache.uima.util.InvalidXMLException: An import could not
be resolved.  No file with name "_APP_TypeSystem.xml" was found in the class path or data
path. (Descriptor: <unknown>)
>>>> at org.apache.uima.resource.metadata.impl.Import_impl.findAbsoluteUrl(Import_impl.java:115)
>>>> at org.apache.uima.resource.metadata.impl.TypeSystemDescription_impl.resolveImports(TypeSystemDescription_impl.java:228)
>>>> at org.apache.uima.resource.metadata.impl.TypeSystemDescription_impl.resolveImports(TypeSystemDescription_impl.java:208)
>>>> at org.apache.uima.ruta.RutaEnvironment.importPackageFromTypeSystem(RutaEnvironment.java:592)
>>>> ... 67 more
>>>> I assume that's because of the import within my ruta script. Do you have
any idea, if and how the way we import something in a script has changed from version 2.3
to 2.5?
>>>>
>>>> I do import like this:
>>>>
>>>> IMPORT PACKAGE de.tudarmstadt.ukp.dkpro.core.api.lexmorph.type.pos FROM _APP_TypeSystem
AS pos;
>>>>
>>>> Thanks already in advance for your help!
>>>>
>>>>
>>>>
>>>>


Mime
View raw message