简体   繁体   中英

Accessing combined UIMA Ruta Annotations in Java

I have a problem accessing combined Ruta Annotations.

My Annotations are based off a prior Module that generates NormalizedNamedEnitites (NNEs) and Marks them according to a ruleset, which works just fine:

NormalizedNamedEntity{REGEXP(NormalizedNamedEntity.concept.identifier,"XXX") -> MARK(XXX)};
NormalizedNamedEntity{REGEXP(NormalizedNamedEntity.concept.identifier,"YYY") -> MARK(YYY)};

Then I proceed to combine those two in a new Annotation:

(XXX){-> CREATE(CCC, "YYY" = YYY, "XXX" = XXX)};

Which also works very fine.

In my IDE (Eclipse), I can access those new Rules in the Ruta Editor View and everything is perfectly working. But after that I want to access the "encasing" Annotation and add all "nested" Annotations to an array, which I just can't find out how. I'm pretty lost in the documentation and am hoping someone out there has this already done and can help me out on this case.

Again: I'm using Java (1.8).

Thanks a lot!

Edit: Further Information

  • Encasing Annotation: Med
  • Nested Annotations: Name , Dose , Scheme

Sample Text:

Paracetamol 40mg daily

Annotations made (with the help of prior Models/Modules, see above):

Paracetamol 40mg daily
Name------- Dose Scheme

Now I want to introduce a encasing Annotation called "Med", which, in case all three nested Annotations are present will encase those.

The Type "Med" has each of the nested Types as a accessible Feature defined.

Now I want to access firstly the Med Annotations (which isn't the problem for me here) and then each nested Annotation (on which I got no idea how to do - yet). I'm still ploughing through the documentation of UIMA to find a hint.

There are many ways to access nested annotations. Currently, I prefer something like the following:

DECLARE Name, Dose, Scheme;

// some mocked annotations
"Paracetamol" -> Name;
"40mg" -> Dose;
"daily" -> Scheme;

DECLARE Med (Name name, Dose dose, Scheme scheme);

(n:Name d:Dose s:Scheme){-> CREATE(Med, "name" = n, "dose" = d, "scheme" = s)};

DECLARE Test1, Test2, Test3;

Med.name{-> Test1}; 

m:Med ->{
    m.name{-> Test1};
    m.dose{-> Test2};
    m.scheme{-> Test3};
    };


FOREACH(med) Med{}{
    med.name{-> Test1};
    med.dose{-> Test2};
    med.scheme{-> Test3};
}

DISCLAIMER: I am a developer of UIMA Ruta

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM