K. K.
K. K.

Reputation: 136

Copy one Feature from one Annotation to another

I've got following scenario:

I've created annotations based off from previously executed modules in a pipeline:

NormalizedNamedEntity{REGEXP(NormalizedNamedEntity.concept.identifier,"[A-Z0-9]{7}@XXX") -> CREATE(GLATC, "key" = NormalizedNamedEntity.concept.identifier)};

Which work perfectly fine.

Medication:GLATC xmi:id="35535" sofa="16776" begin="1684" end="1693" key="N06AA05@XXX"

I continue to produce annotations.

Medication:MMedikation xmi:id="40516" sofa="16776" begin="1684" end="1693" MNAME="35339"

Now I want to get the Feature "key" from the GLATC Annotation to be the Feature "ATC" in the MMedikation Annotation. This is what I tried so far:

MMedikation{CONTAINS(GLATC)} -> {MMedikation{ -> SETFEATURE("ATC", temp)} <- {GLATC{ -> GETFEATURE("key", temp)};};};
MMedikation{PARTOF(GLATC)} -> {MMedikation{ -> SETFEATURE("ATC", temp)} <- {GLATC{ -> GETFEATURE("key", temp)};};};

To no avail.
Ruta doesn't have any trouble 'understanding' both rules. I've tried to see, if the first part is working:

MMedikation{CONTAINS(GLATC) -> MARK(MNAME)};

correctly marks MNAME Annotations whenever MMedikation contains GLATC. I've seen that this rule only works when there are no brackets before the first '->', but applying this to the longer rule above:

MMedikation{CONTAINS(GLATC) -> MMedikation{-> SETFEATURE("ATC", temp)} <- {GLATC{ -> GETFEATURE("key", temp)};};

or

MMedikation{CONTAINS(GLATC) -> MMedikation{-> SETFEATURE("ATC", temp)} <- {GLATC{ -> GETFEATURE("key", temp)};};};

just yields this Error:

Error in Ruta3878238602695220973, line 192, "{": expected RCURLY, but found LCURLY

Any help would be greatly appreciated.

Thank you, K

Upvotes: 1

Views: 64

Answers (2)

Peter Kluegl
Peter Kluegl

Reputation: 3113

An addition to the correct answer.

The rule

MMedikation{CONTAINS(GLATC) -> SETFEATURE("ATC", temp)} <- {GLATC{ -> GETFEATURE("key", temp)};};

can be written as

m:MMedikation{-> m.ATC = g.key} <- {g:GLATC;};

Upvotes: 1

K. K.
K. K.

Reputation: 136

Aparently, I had an error in my train of thought.

I build up the rule from the working bit

MMedikation{CONTAINS(GLATC) -> SETFEATURE("ATC", temp)}

and added rules up to this rule:

MMedikation{CONTAINS(GLATC) -> SETFEATURE("ATC", temp)} <- {GLATC{ -> GETFEATURE("key", temp)};};

Which now works. Yay.

Upvotes: 1

Related Questions