RelationArgumentUtil - apache/ctakes GitHub Wiki

@Immutable final public class RelationArgumentUtil

Annotations that are used within text relations are buried 2 levels deep. This class has methods that make getting relation annotations easier, and others that make creating relations easier.

  • Author: SPF , chip-nlp
  • Version: %I%
  • Since: 5/25/2016

static public Collection<IdentifiedAnnotation> getFirstArguments( final Collection<? extends BinaryTextRelation> relations, final IdentifiedAnnotation annotation )

  • Parameters:
    • relations relations of interest
    • annotation identified annotation of interest
  • Returns: all identified annotations in the given relations related to the given annotation as the first argument

static public Collection<IdentifiedAnnotation> getSecondArguments( final Collection<? extends BinaryTextRelation> relations, final IdentifiedAnnotation annotation )

  • Parameters:
    • relations relations of interest
    • annotation identified annotation of interest
  • Returns: all identified annotations in the given relations related to the given annotation as the second argument

static public Collection<IdentifiedAnnotation> getAllRelated( final Collection<? extends BinaryTextRelation> relations, final IdentifiedAnnotation annotation )

  • Parameters:
    • relations relations of interest
    • annotation identified annotation of interest
  • Returns: all identified annotations in the given relations related to the given annotation

static public Map<BinaryTextRelation, IdentifiedAnnotation> getAllRelatedMap( final Collection<BinaryTextRelation> relations, final IdentifiedAnnotation annotation )

  • Parameters:
    • relations relations of interest
    • annotation identified annotation of interest
  • Returns: all identified annotations in the given relations related to the given annotation

static private IdentifiedAnnotation getRelated( final BinaryTextRelation relation, final IdentifiedAnnotation annotation )

  • Parameters:
    • relation relation of interest
    • annotation some annotation that might be in the relation
  • Returns: the other annotation in the relation if the first is present

static private IdentifiedAnnotation getTarget( final BinaryTextRelation relation, final IdentifiedAnnotation annotation )

  • Parameters:
    • relation relation of interest
    • annotation some annotation that might be in the relation
  • Returns: the target annotation in the relation if the first is present

static public Map<BinaryTextRelation, IdentifiedAnnotation> getRelatedTargetsMap( final Collection<BinaryTextRelation> relations, final IdentifiedAnnotation annotation )

  • Parameters:
    • relations relations of interest
    • annotation identified annotation of interest
  • Returns: all identified annotations in the given relations related to the given annotation

static public <T extends BinaryTextRelation> Collection<T> getRelationsAsFirst( final Collection<T> relations, final IdentifiedAnnotation annotation )

  • Parameters:
    • relations relations of interest
    • annotation identified annotation of interest
  • Returns: all relations in the given relations where the first argument is the given annotation

static public <T extends BinaryTextRelation> Collection<T> getRelationsAsSecond( final Collection<T> relations, final IdentifiedAnnotation annotation )

  • Parameters:
    • relations relations of interest
    • annotation identified annotation of interest
  • Returns: all relations in the given relations where the second argument is the given annotation

static public Map<IdentifiedAnnotation, Collection<IdentifiedAnnotation>> createCandidateMap( final JCas jcas, final List<IdentifiedAnnotation> candidates, final List<IdentifiedAnnotation> mainAnnotations )

Candidates for primary annotations of a possible relation are preceding candidates in the same paragraph, or if none then nearest following candidate in the same sentence

  • Parameters:
    • jcas ye olde ...
    • candidates all candidates of a type in a paragraph
    • mainAnnotations all primary annotations of a type that has a relation in a paragraph
  • Returns: a map of candidates and the primary annotations for those candidates

static public BinaryTextRelation createRelation( final JCas jCas, final IdentifiedAnnotation argument, final IdentifiedAnnotation target, final String name )

  • Parameters:
    • jCas ye olde ...
    • argument -
    • target -
    • name name of relation type
  • Returns: created relation or null if there was a problem

static public <T extends BinaryTextRelation> T createRelation( final JCas jCas, T relation, final IdentifiedAnnotation argument, final IdentifiedAnnotation target, final String name )

  • Parameters:
    • jCas ye olde ...
    • relation -
    • argument -
    • target -
    • name name of relation type
  • Returns: created relation or null if there was a problem
⚠️ **GitHub.com Fallback** ⚠️