[Gate-users] Relations with JAPE

Judith Jeyafreeda judithjeyafreeda at gmail.com
Wed Jun 7 13:51:31 CEST 2017


Hi,

   I am new to JAPE. I am trying to draw a relationship between person and
function using the rule below and it does not work. Any help would be
appreciated.

Imports: {
  import gate.relations.RelationSet;
}

Phase:firstpass
Input:  Lookup Personne
Options: control = appelt
Rule: Function
(
({Personne}):person
)
(
{Lookup.majorType==Function, !Personne}
): func
-->
{
AnnotationSet funct = bindings.get("func");
Annotation functAnn = funct.iterator().next();
// Build annotation
FeatureMap features = Factory.newFeatureMap();
features.put("rule", "Function");
System.out.println("1. draw relation");
int functId = outputAS.add(funct.firstNode(), funct.lastNode(), "Function",
features);
System.out.println("2. draw relation " + functId);
// Build relation
AnnotationSet annSet = doc.getAnnotations();
RelationSet relSet = annSet.getRelations();
System.out.println("3. relset : " + relSet);
AnnotationSet persons = bindings.get("person");
System.out.println("4. Person:" +persons);
Annotation personAnn = persons.iterator().next();
System.out.println("5. personAnn : " + personAnn);
relSet.addRelation("function_person",
       new int[] {functId, personAnn.getId()});
System.out.println("6. Done");
System.out.println("---------------------------------------");
}

-- 
Thanks and Regards,
Judith Jeyafreeda
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opengatecollaboration.org/mailman/private/gate-users/attachments/20170607/7213fa83/attachment.html>


More information about the Gate-users mailing list