Hi,
the head rule in the block (Dependency{Dependency.Governor.ct ==
governor}) restrict only the window in which the contained rule are
allowed to match. If there are two NSUBJ dependencies, both with be
matched indepedntly of there features. The second Dependency resolves
anew, which will lead to a false postive match. If you have multiple
annotation at the same offsets, you mostly cannot use type expression
for automatically resolving to annotation. The first one will be selected.
If you want some restiction on the actual annotation, you could use for
example the FOREACH block:
FOREACH(dep) d:Dependency{d.Governor.ct == governor} {
Document{-> LOG("Dep-Type: " + dep.DependencyType)};
dep{IS(NSUBJ)->LOG("NSUBJ-Text: " + dep.ct)};
}
(not tested, but the idea should be clear)
BLOCK is like a conditioned restiction of the document, FOREACH is
rather like an actual loop over annotations as it does not restrict the
matching window but remembers the matched annotation in the head rule.
Best,
Peter
Am 20.06.2017 um 16:36 schrieb Reza Hay:
Hi Peter,
I have the following Ruta (2.6.0) code:
(DEP_ROOT & VERB) {->MARK(BioObject), governor = DEP_ROOT.Governor.ct};
BLOCK(ForEach) Dependency{Dependency.Governor.ct == governor} {
Document{-> LOG("Dep-Type: " + Dependency.DependencyType)};
NSUBJ{->LOG("NSUBJ-Text: " + NSUBJ.ct)};
}
The input ("The fusion protein either directly activates or represses
EWS-FLI1-bound distal regulatory
elements.") is:
<dependency:DET xmi:id="903" sofa="12" begin="0" end="3" Governor="48" Dependent="24"
DependencyType="det" flavor="basic"/>
<dependency:NN xmi:id="911" sofa="12" begin="4" end="10" Governor="48" Dependent="36"
DependencyType="nn" flavor="basic"/>
<dependency:NSUBJ xmi:id="919" sofa="12" begin="11" end="18" Governor="84" Dependent="48"
DependencyType="nsubj" flavor="basic"/>
<dependency:NSUBJ xmi:id="927" sofa="12" begin="11" end="18" Governor="108" Dependent="48"
DependencyType="nsubj" flavor="basic"/>
<dependency:DEP xmi:id="935" sofa="12" begin="19" end="25" Governor="72" Dependent="60"
DependencyType="dep" flavor="basic"/>
<dependency:ADVMOD xmi:id="943" sofa="12" begin="26" end="34" Governor="84" Dependent="72"
DependencyType="advmod" flavor="basic"/>
<dependency:ROOT xmi:id="951" sofa="12" begin="35" end="44" Governor="84" Dependent="84"
DependencyType="root" flavor="basic"/>
<dependency:CONJ xmi:id="959" sofa="12" begin="48" end="57" Governor="84" Dependent="108"
DependencyType="conj_or" flavor="basic"/>
<dependency:AMOD xmi:id="967" sofa="12" begin="58" end="72" Governor="132" Dependent="120"
DependencyType="amod" flavor="basic"/>
<dependency:AMOD xmi:id="975" sofa="12" begin="73" end="79" Governor="156" Dependent="132"
DependencyType="amod" flavor="basic"/>
<dependency:AMOD xmi:id="983" sofa="12" begin="80" end="90" Governor="156" Dependent="144"
DependencyType="amod" flavor="basic"/>
<dependency:DOBJ xmi:id="991" sofa="12" begin="91" end="99" Governor="84" Dependent="156"
DependencyType="dobj" flavor="basic"/>
and the output of the Ruta code:
Dep-Type: nsubj
NSUBJ-Text: protein
NSUBJ-Text: protein
Dep-Type: advmod
Dep-Type: root
Dep-Type: conj_or
Dep-Type: dob
My expectation was (without any match with the second NSUBJ):
Dep-Type: nsubj
NSUBJ-Text: protein
Dep-Type: advmod
Dep-Type: root
Dep-Type: conj_or
Dep-Type: dob
I know there are two NSUBJ annotations but the Governor ("represses ") of the second
NSUBJ is different than the Block condition ("activates "). My interpretation was that
the Block condition (Dependency.Governor.ct == governor) doesn't allow for matching with the second
NSUBJ. Why am I surprised?
Best Regards,
Reza