@Test public void testKnownEntity() { Collection<Entity> entities = recognizer.getEntities("foo", config); assertThat(entities, contains(new Entity(concept.getLabels(), "X:1"))); }
public Collection<Entity> getEntities(String token, EntityFormatConfiguration config) { Query query = new Vocabulary.Query.Builder(token).build(); List<Concept> terms = vocabulary.getConceptsFromTerm(query); Set<Entity> entities = newHashSet(); for (Concept term : terms) { if (shouldAnnotate(term, config)) { Optional<String> id = curieUtil.getCurie(term.getIri()); entities.add(new Entity(term.getLabels(), id.orElse(term.getIri()), term.getCategories())); } } return entities; }
EntityRecognizer { public Collection<Entity> getEntities(String token, EntityFormatConfiguration config) { Query query = new Vocabulary.Query.Builder(token).build(); List<Concept> terms = vocabulary.getConceptsFromTerm(query); Set<Entity> entities = newHashSet(); for (Concept term : terms) { if (shouldAnnotate(term, config)) { Optional<String> id = curieUtil.getCurie(term.getIri()); entities.add(new Entity(term.getLabels(), id.orElse(term.getIri()), term.getCategories())); } } return entities; } }
EntityRecognizer { public Collection<Entity> getEntities(String token, EntityFormatConfiguration config) { Query query = new Vocabulary.Query.Builder(token).build(); List<Concept> terms = vocabulary.getConceptsFromTerm(query); Set<Entity> entities = newHashSet(); for (Concept term : terms) { if (shouldAnnotate(term, config)) { Optional<String> id = curieUtil.getCurie(term.getIri()); entities.add(new Entity(term.getLabels(), id.orElse(term.getIri()), term.getCategories())); } } return entities; } @Inject  EntityRecognizer(Vocabulary vocabulary, CurieUtil curieUtil); }
EntityRecognizer { public Collection<Entity> getEntities(String token, EntityFormatConfiguration config) { Query query = new Vocabulary.Query.Builder(token).build(); List<Concept> terms = vocabulary.getConceptsFromTerm(query); Set<Entity> entities = newHashSet(); for (Concept term : terms) { if (shouldAnnotate(term, config)) { Optional<String> id = curieUtil.getCurie(term.getIri()); entities.add(new Entity(term.getLabels(), id.orElse(term.getIri()), term.getCategories())); } } return entities; } @Inject  EntityRecognizer(Vocabulary vocabulary, CurieUtil curieUtil); String getCssClass(); Collection<Entity> getEntities(String token, EntityFormatConfiguration config); }
EntityRecognizer { public Collection<Entity> getEntities(String token, EntityFormatConfiguration config) { Query query = new Vocabulary.Query.Builder(token).build(); List<Concept> terms = vocabulary.getConceptsFromTerm(query); Set<Entity> entities = newHashSet(); for (Concept term : terms) { if (shouldAnnotate(term, config)) { Optional<String> id = curieUtil.getCurie(term.getIri()); entities.add(new Entity(term.getLabels(), id.orElse(term.getIri()), term.getCategories())); } } return entities; } @Inject  EntityRecognizer(Vocabulary vocabulary, CurieUtil curieUtil); String getCssClass(); Collection<Entity> getEntities(String token, EntityFormatConfiguration config);  }