Jan Elio
Jan Elio

Reputation: 31

How to set Variables in UIMA RUTA

Hi (most probably Peter), I am having troubles to figure out how to make parametrization of my RUTA project.

First of all I have several scripts that make kind of chain:

  1. Project Adjectives.ruta
  2. Project Anatomy.ruta (contains "SCRIPT Adjectives;" and "Document{->CALL(Adjectives)};")
  3. Project Anamnesis.ruta (contains "SCRIPT Anatomy;" and "Document{->CALL(Anatomy)};")

For the result I am calling this:

File specFile = new File("C:/.../.../pipelines/AnamnesisEngine.xml");
String path = new File(specFile.toURI()).getParentFile().getAbsolutePath();     
        
                
    AnalysisEngineDescription desc = null;
        
    String[] VarNames = {"Name1", "Name2"};
    String[] VarValues = {"Value1", "Value2"};
        
    try {
        desc = AnalysisEngineFactory.createEngineDescriptionFromPath(
        specFile.getAbsolutePath(), RutaEngine.PARAM_SCRIPT_PATHS, path+"/script",
        RutaEngine.PARAM_DESCRIPTOR_PATHS, path+"/descriptor", 
        RutaEngine.PARAM_RESOURCE_PATHS,path+"/resources", 
        RutaEngine.PARAM_VAR_NAMES, VarNames, 
        RutaEngine.PARAM_VAR_VALUES, VarValues); ..... End so on (Those parameters (VarNames and VarValues) are filled from query, but that is not so important right now)

Everything works fine and I am getting nice JSON output. But now I am having troubles with those parameters (VarNames, VarValues) and I can't figure this out.

When I make something like this in script Anamnesis.ruta

STRING Name1;
Anamnesis{->SETFEATURE("Lemma",Name1)};  

Everything works perfectly and I can see in my output that lemma for Anamnesis annotation is set to Value1... However I also need to work with those variables in projects Adjectives.ruta and Anatomy.ruta. I suspect that those projects are controlled by their own descriptors (AdjectivesEngine.xml and AnatomyEngine.xml). Is there way to set the parameters for those projects and use them while creating ae from AnamnesisEngine.xml?

When I try to add this to Anatomy.ruta (And again call AnamnesisEngine.xml)

STRING Name1;
Anatomy{->SETFEATURE("Lemma",Name1)};  

There is no Lemma at all in the output. Which kind of makes sense but I was hoping that maybe that whole chain can be controlled by AnamnesisEngine.xml and those first two projects would be able to "find", assign and work with those variables... Well I was wrong...

Please what would be the best way to achieve this?

Upvotes: 1

Views: 68

Answers (1)

Jan Elio
Jan Elio

Reputation: 31

If somebody is ever interested, I managed to achieve this with "Aggregate Engine Type" - which let's you import other descriptors into it and propagates variables into them... Epic!

Upvotes: 1

Related Questions