Hi Peter!
Bonus question: how do I get Engines and Type Systems included through
maven dependencies to resolve correctly in scripts?
For instance:
PACKAGE de.miba;
ENGINE org.apache.uima.ruta.engine.HtmlAnnotator;
ENGINE org.apache.uima.ruta.engine.HtmlConverter;
TYPESYSTEM utils.HtmlTypeSystem;
TYPESYSTEM utils.SourceDocumentInformation;
Document{-> RETAINTYPE(SPACE,BREAK)};
Document{-> EXEC(HtmlAnnotator)};
Document { -> CONFIGURE(HtmlConverter, "inputView" = "_InitialView",
"outputView" = "plain"),
EXEC(HtmlConverter)};
All the ruta dependencies are on the class path, but the script can't
find it ("error: "org.apache.uima.ruta.engine.HtmlAnnotator" not
found.). I assume it's looking relative to current package (de.miba.*)?
Regards,
Michael
Am 14/04/2022 um 14:46 schrieb Peter Klügl:
Hi,
I had a quick look at your ruta-test project.
1. There was problem for the paths config of your annotator
description. If you use a java/maven project, it is easier to just use
the classpath instead of the Ruta paths. So I removed
'descriptor:descriptor' from the pom and moved the descriptor folder
to src/main/resources.
2. I added 'TYPESYSTEM descriptor.typeSystemDescriptor;' to your
TestProjectMain.ruta (after the UIMAFIT import) and deleted the JCas
cover class in 'src/main/java' as it is now generated and located at
'target/...'
3. I added a '.addToIndexes()' in TestAnno so that the annotation is
available and added 'EXEC(TestAnno);' in TestProjectMain.ruta so that
the annotator is executed. The keyword UIMAFIT is just an import of
the analysis engine.
4. I added 'Assert.assertEquals(1, JCasUtil.select(jcas,
SomeType.class).size());' to RutaTest.java in order to check if the
annotation is created.
If you want, I can open a pull request with the changes for your
project or for a fork.
Best
Peter
Am 13.04.2022 um 16:06 schrieb Michael B.:
Hi everyone!
I'm at a loss here. Trying to create a basic RUTA project, but I just
can't get it to work. I'd like to include a custom Engine (Java
code!) that needs a few maven dependencies. I just can't get RUTA
(via ENGINE/TYPESYSTEM) to properly include and initialize Java
annotators.
What I tried so far:
- Create project using archetype
- Add code for custom AE
- Add TS and AE descriptors in ./descriptor folder, run JCASGen
- Add <buildPath>descriptor:descriptor</buildPath> to pom (in the
ruta-maven-plugin section). ./descriptor folder is configured
successfully as part of build path
Issues:
- When using ENGINE aeDescriptor in script, project doesn't run:
Caused by: java.io.FileNotFoundException: class path resource
[aeDescriptor.xml] cannot be resolved to URL because it does not exist
- TYPESYSTEM typeSystemDescriptor <- works in editor, but maven pom /
task throws an error (no details, assuming name/path can't be resolved)
- UIMAFIT de.miba.TestAnno works (and can be executed in ruta
script), but Types/TS missing, so runtime errors.
Any hints or an example project where this works would be highly
appreciated! I've uploaded the skeleton to
https://github.com/mybyte/ruta-test
Cheers,
Michael