Nachfeld

AlpinoGraph

In AlpinoGraph gebruik ik een hulpattribuut op de relaties:

match ()-[r:rel]->()
where r.rel in ['hd','cmp','mwp','crd','rhd','whd','nucl','dp']
set r._head_rel = true;

match (n1)<-[:rel{_head_rel:true}]-()-[r2:rel{_head_rel:true}]->(n2)
where n1.begin < n2.begin
set r2._head_rel = NULL;

Nachfeld in AlpinoGraph:

select distinct sentid, id
from (

  match (vp)
  where vp.cat in ['inf','ti','ssub','oti','ppart']
  match (n1)<-[:rel{rel:'hd'}]-(vp)-[:rel*0..]->()-[r:rel]->(n)
  where not r.rel in ['hd','svp']
    and ( n.cat is null or not n.cat in ['inf','ppart'] )
  optional match (n)-[:rel{_head_rel:true}]->(n2)
  with n, n1, n2, vp
  where n2 is not null and n1.begin < n2.begin
     or n2 is     null and n1.begin < n.begin
  return n.sentid as sentid, n.id as id, vp.id as vpid

  except

  match (vp)
  where vp.cat in ['inf','ti','ssub','oti','ppart']
  match (vp)-[:rel*1..]->(vp2)-[:rel*1..]->(n)
  where vp2.cat in ['inf','ti','ssub','oti','ppart']
  return n.sentid as sentid, n.id as id, vp.id as vpid

  except

  match (vp)
  where vp.cat in ['inf','ti','ssub','oti','ppart']
  match (n1)<-[:rel{rel:'hd'}]-(vp)-[:rel*0..]->()-[r:rel]->(n)
  where not r.rel in ['hd','svp']
    and ( n.cat is null or not n.cat in ['inf','ppart'] )
  optional match (n)-[:rel{_head_rel:true}]->(n2)
  with n, n1, n2, vp
  where n2 is not null and n1.begin < n2.begin
     or n2 is     null and n1.begin < n.begin
  match (n)-[:rel*1..]->(nn)
  return nn.sentid as sentid, nn.id as id, vp.id as vpid

) as foo

Als je ook wilt zien bij welke VP een nachfeld hoort, verander dan de bovenste regel in het volgende:

select sentid, id, vpid as id

XPath

PQ_nachfeld_t = """
        (
            (@cat or @pt)
            and
            not(@cat=("inf","ppart") or @rel=("hd","svp"))
            and
            (
                (
                    ancestor::node[%PQ_vp%]
                    except
                    ancestor::node[%PQ_vp%]/ancestor::node[%PQ_vp%]
                )/node[@rel="hd"]/%PQ_b% < %PQ_begin_of_head%
                or
                (
                    ancestor::node[%PQ_vp%]
                    except
                    ancestor::node[%PQ_vp%]/ancestor::node[%PQ_vp%]
                )/node[@rel="hd"]/%PQ_b% < %PQ_b% and not(node[%PQ_headrel%])
            )
        ) """

PQ_nachfeld = """
        (
            %PQ_nachfeld_t%
            and
            not(
                   ancestor::node[%PQ_nachfeld_t%]
                   except
                   ancestor::node[%PQ_vp%]/ancestor-or-self::node[%PQ_nachfeld_t%]
            )
        ) """

Verschillen

Verschillen in uitkomst tussen AlpinoGraph en XPATH → zie hier

Nachfeld waarvan?

Voorbeeld 1

Conjunctie in AlpinoGraph

Conjunctie in XPath

Voorbeeld 2

Conjunctie in AlpinoGraph

Conjunctie in XPath

agensgraph alpino nachfeld xpath