AnnotatedText implements Serializable { @SuppressWarnings("unchecked") public ListAttribute<RelationshipMention> getRelationshipMentions() { return (ListAttribute<RelationshipMention>) attributes.get(AttributeKey.RELATIONSHIP_MENTION.key()); } AnnotatedText(CharSequence data,
                  Map<String, BaseAttribute> attributes,
                  Map<String, List<String>> documentMetadata,
                  /*
                   * This version is only here as a workaround for https://github.com/FasterXML/jackson-databind/issues/1118
                   * It would be better if it was only mentioned in the mixins. No data arrives here, it just
                   * allows the mixin to be matched with the existence of a version item in the json.
                   */
                  String version); CharSequence getData(); Map<String, List<String>> getDocumentMetadata(); Map<String, BaseAttribute> getAttributes(); @SuppressWarnings("unchecked") ListAttribute<Token> getTokens(); @SuppressWarnings("unchecked") ListAttribute<TranslatedTokens> getTranslatedTokens(); @SuppressWarnings("unchecked") ListAttribute<TranslatedData> getTranslatedData(); @SuppressWarnings("unchecked") ListAttribute<LanguageDetection> getLanguageDetectionRegions(); LanguageDetection getWholeTextLanguageDetection(); @SuppressWarnings("unchecked") @Deprecated ListAttribute<EntityMention> getEntityMentions(); @SuppressWarnings("unchecked") ListAttribute<Entity> getEntities(); @SuppressWarnings("unchecked") MapAttribute<LanguageCode, ListAttribute<SimilarTerm>> getSimilarTerms(); @SuppressWarnings("unchecked") ListAttribute<SimilarTerm> getSimilarTerms(LanguageCode languageCode); @SuppressWarnings("unchecked") ListAttribute<RelationshipMention> getRelationshipMentions(); @SuppressWarnings("unchecked") @Deprecated ListAttribute<ResolvedEntity> getResolvedEntities(); @SuppressWarnings("unchecked") ListAttribute<ScriptRegion> getScriptRegions(); @SuppressWarnings("unchecked") ListAttribute<Sentence> getSentences(); @SuppressWarnings("unchecked") ListAttribute<LayoutRegion> getLayoutRegions(); @SuppressWarnings("unchecked") ListAttribute<BaseNounPhrase> getBaseNounPhrases(); @SuppressWarnings("unchecked") ListAttribute<CategorizerResult> getCategorizerResults(); @SuppressWarnings("unchecked") ListAttribute<CategorizerResult> getSentimentResults(); @SuppressWarnings("unchecked") ListAttribute<Dependency> getDependencies(); @SuppressWarnings("unchecked") ListAttribute<CategorizerResult> getTopicResults(); Embeddings getEmbeddings(); @SuppressWarnings("unchecked") ListAttribute<Concept> getConcepts(); @SuppressWarnings("unchecked") ListAttribute<Keyphrase> getKeyphrases(); TransliterationResults getTransliteration(); @Override String toString();  }
@Test public void relationMentions() { String argumentId = "/resolved/argument/"; String argPhrase = "some-noun"; String relPhrase = "some-verb"; AnnotatedText.Builder relationMentionBuilder = new AnnotatedText.Builder(); ListAttribute.Builder<RelationshipMention> listBuilder = new ListAttribute.Builder<>(RelationshipMention.class); RelationshipComponent.Builder relationArgumentBuilder1 = new RelationshipComponent.Builder(); RelationshipComponent.Builder relationArgumentBuilder2 = new RelationshipComponent.Builder(); RelationshipComponent.Builder relationArgumentBuilder3 = new RelationshipComponent.Builder(); relationArgumentBuilder1.phrase(argPhrase + "1").identifier(argumentId + "1"); relationArgumentBuilder2.phrase(argPhrase + "2").identifier(argumentId + "2"); relationArgumentBuilder3.phrase(relPhrase); listBuilder.add(new RelationshipMention.Builder(0, 12).predicate(relationArgumentBuilder3.build()) .arg1(relationArgumentBuilder1.build()).arg2(relationArgumentBuilder2.build()).build()); relationMentionBuilder.relationshipMentions(listBuilder.build()); AnnotatedText text = relationMentionBuilder.build(); RelationshipMention relationshipMention = text.getRelationshipMentions().get(0); assertEquals(relPhrase, relationshipMention.getPredicate().getPhrase()); assertEquals(argPhrase + "1", relationshipMention.getArg1().getPhrase()); assertEquals(argPhrase + "2", relationshipMention.getArg2().getPhrase()); }