congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
uk.gov.dstl.baleen.consumers.utils
Code IndexAdd Tabnine to your IDE (free)

How to use uk.gov.dstl.baleen.consumers.utils

Best Java code snippets using uk.gov.dstl.baleen.consumers.utils (Showing top 20 results out of 315)

origin: dstl/baleen

@Override
protected void doProcess(JCas jCas) throws AnalysisEngineProcessException {
 Map<String, Object> json =
   SingleDocumentConsumerFormat.formatCas(
     jCas, fields, contentHashAsId, getMonitor(), getSupport());
 String id = (String) json.getOrDefault("externalId", "");
 // Persist to ElasticSearch
 addDocument(id, json);
}
origin: dstl/baleen

/** Add history to the map */
public Map<String, Object> convert() {
 Map<String, Object> map = new IgnoreEmptyKeyMapDecorator<>(new LinkedHashMap<>());
 List<Object> list = createEventsList();
 map.put(fields.getHistory(), list);
 return map;
}
origin: dstl/baleen

 private void convertHistory(Map<String, Object> map, Base entity) {
  HistoryConverter historyConverter =
    new HistoryConverter(entity, fields, documentHistory, monitor);
  map.putAll(historyConverter.convert());
 }
}
origin: dstl/baleen

/**
 * Convert from a relation to a map.
 *
 * @param relation the relation to convert
 * @return a map containing the relation's fields (and history is required)
 */
public Map<String, Object> convertRelation(Relation relation) {
 Map<String, Object> map = new IgnoreEmptyKeyMapDecorator<>(Maps.newHashMap());
 convertFeatures(map, relation);
 if (outputHistory && documentHistory != null) {
  convertHistory(map, relation);
 }
 map.put(fields.getExternalId(), relation.getExternalId());
 return map;
}
origin: dstl/baleen

 /**
  * Gets the unique id for a document (if contentHashAsId is true then as hash of the content is
  * used, otherwise a hash of the source URI is used).
  *
  * @param jCas the JCas
  * @return the unique id
  */
 private String getUniqueId(JCas jCas) {
  return ConsumerUtils.getExternalId(getDocumentAnnotation(jCas), contentHashAsId);
 }
}
origin: dstl/baleen

private void createERC() {
 final IEntityConverterFields fields = new DefaultFields();
 final HashSet<String> stopFeatures = new HashSet<>();
 stopFeatures.add("uima.cas.AnnotationBase:sofa");
 stopFeatures.add("uk.gov.dstl.baleen.types.BaleenAnnotation:internalId");
 erc = new EntityRelationConverter(monitor, stopFeatures, fields, false);
}
origin: dstl/baleen

@Override
public void doInitialize(UimaContext aContext) throws ResourceInitializationException {
 boolean indexCreated = createIndex();
 if (indexCreated) {
  try {
   addMapping(createMappingObject());
  } catch (IOException ioe) {
   getMonitor()
     .error(
       "Unable to create mapping, you may get unexpected results in your Elasticsearch index",
       ioe);
  }
 }
}
origin: dstl/baleen

 protected static String normalizeFeatureName(final Feature f) {
  return ConsumerUtils.toCamelCase(f.getShortName());
 }
}
origin: dstl/baleen

private void convertFeatures(Map<String, Object> map, Base base) {
 for (Feature f : base.getType().getFeatures()) {
  processFeature(map, base, f);
 }
 map.put(fields.getType(), base.getType().getShortName());
 if (map.get(FIELD_VALUE) == null || Strings.isNullOrEmpty(map.get(FIELD_VALUE).toString())) {
  map.put(FIELD_VALUE, base.getCoveredText());
 }
}
origin: dstl/baleen

private void putGeoJson(Map<String, Object> map, String geojson) {
 try {
  if (!Strings.isNullOrEmpty(geojson)) {
   map.put(fields.getGeoJSON(), mapper.readValue(geojson, mapLikeType));
  }
 } catch (IOException e) {
  getMonitor().warn("Unable to persist geoJson", e);
 }
}
origin: uk.gov.dstl.baleen/baleen-graph

@Override
protected void doProcess(JCas jCas) throws AnalysisEngineProcessException {
 String documentSourceName = SourceUtils.getDocumentSourceBaseName(jCas);
 Graph entityGraph = factory.create(jCas);
 processGraph(documentSourceName, entityGraph);
}
origin: dstl/baleen

private void createEventsList(List<Object> list, Collection<HistoryEvent> mergedHistoryEvents) {
 for (HistoryEvent mergedHistoryEvent : mergedHistoryEvents) {
  Map<String, Object> map = createEventMap(mergedHistoryEvent);
  list.add(map);
 }
}
origin: dstl/baleen

@Override
public void doInitialize(UimaContext aContext) throws ResourceInitializationException {
 super.doInitialize(aContext);
 structuralClasses = StructureUtil.getStructureClasses(typeNames);
}
origin: dstl/baleen

/**
 * Convert from an entity to a map.
 *
 * @param entity the entity to convert
 * @return a map containing the entity's fields (and history is required)
 */
public Map<String, Object> convertEntity(Entity entity) {
 Map<String, Object> map = new IgnoreEmptyKeyMapDecorator<>(Maps.newHashMap());
 convertFeatures(map, entity);
 if (outputHistory && documentHistory != null) {
  convertHistory(map, entity);
 }
 map.put(fields.getExternalId(), entity.getExternalId());
 return map;
}
origin: dstl/baleen

 /**
  * Gets the unique id for a document (if contentHashAsId is true then as hash of the content is
  * used, otherwise a hash of the source URI is used).
  *
  * @param jCas the JCas
  * @return the unique id
  */
 private String getUniqueId(JCas jCas) {
  return ConsumerUtils.getExternalId(getDocumentAnnotation(jCas), contentHashAsId);
 }
}
origin: dstl/baleen

/**
 * Convert from an event to a map.
 *
 * @param event the relation to convert
 * @return a map containing the relation's fields (and history is required)
 */
public Map<String, Object> convertEvent(Event event) {
 Map<String, Object> map = new IgnoreEmptyKeyMapDecorator<>(Maps.newHashMap());
 convertFeatures(map, event);
 if (outputHistory && documentHistory != null) {
  convertHistory(map, event);
 }
 map.put(fields.getExternalId(), event.getExternalId());
 return map;
}
origin: dstl/baleen

protected String getUniqueId(JCas jCas) {
 return ConsumerUtils.getExternalId(getDocumentAnnotation(jCas), contentHashAsId);
}
origin: dstl/baleen

protected String getUniqueId(JCas jCas) {
 return ConsumerUtils.getExternalId(getDocumentAnnotation(jCas), contentHashAsId);
}
origin: dstl/baleen

private String getUniqueId(JCas jCas) {
 return ConsumerUtils.getExternalId(getDocumentAnnotation(jCas), contentHashAsId);
}
origin: dstl/baleen

private String getDocumentId(JCas jCas) {
 return ConsumerUtils.getExternalId(
   UimaSupport.getDocumentAnnotation(jCas), options.isContentHashAsId());
}
uk.gov.dstl.baleen.consumers.utils

Most used classes

  • ConsumerUtils
  • DefaultFields
  • EntityRelationConverter
  • IEntityConverterFields
  • SingleDocumentConsumerFormat
  • HistoryConverter,
  • IgnoreEmptyKeyMapDecorator,
  • AbstractBaleenFileConsumer,
  • AbstractElasticsearchConsumer,
  • AbstractHtmlConsumer
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now