/** * 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); } }
protected static String normalizeFeatureName(final Feature f) { return ConsumerUtils.toCamelCase(f.getShortName()); } }
/** * Get a usable unique uid for the collection of entity annotations. * * @param entities the collection of entities * @return hash * @throws BaleenException */ public static String getExternalId(Collection<Entity> entities) { String[] ids = entities.stream().map(Entity::getExternalId).toArray(String[]::new); try { return IdentityUtils.hashStrings(ids); } catch (BaleenException e) { return fallbackToUUID(e); } }
UimaMonitor monitor, UimaSupport support) { Set<String> stopFeatures = ConsumerUtils.getDefaultStopFeatures(); output.putAll(createDocumentAnnotationMap(da)); String id = ConsumerUtils.getExternalId(da, contentHashAsId); output.put("externalId", id);
/** * 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); } }
@Test public void testCamelCase() { assertEquals("helloWorld", ConsumerUtils.toCamelCase("HelloWorld")); }
/** * Get a usable unique uid * * @param da document annotation * @param contentHashAsId true if should use the hash, false will use the source url * @return hash, source or if all else fails a UUID */ public static String getExternalId(DocumentAnnotation da, boolean contentHashAsId) { if (contentHashAsId) { return da.getHash(); } else { try { return IdentityUtils.hashStrings(da.getSourceUri()); } catch (BaleenException e) { return fallbackToUUID(e); } } }
protected String getUniqueId(JCas jCas) { return ConsumerUtils.getExternalId(getDocumentAnnotation(jCas), contentHashAsId); }
} else { getMonitor().trace("Converting primitive feature to an object"); map.put(ConsumerUtils.toCamelCase(f.getShortName()), FeatureUtils.featureToObject(f, base)); && f.getRange().getComponentType().isPrimitive()) { getMonitor().trace("Converting primitive feature to an array"); map.put(ConsumerUtils.toCamelCase(f.getShortName()), FeatureUtils.featureToList(f, base)); } else { getMonitor() FSArray fArr = (FSArray) base.getFeatureValue(f); if (fArr != null) { map.put(ConsumerUtils.toCamelCase(f.getShortName()), getEntityIds(fArr)); map.put(ConsumerUtils.toCamelCase(f.getShortName()), ((Entity) ent).getExternalId()); } else { getMonitor().trace("Unable to persist feature {}", f.getShortName());
/** * Get a usable unique uid for the relation based on the properties, source and target. * * @param relation the relation to identify * @return hash * @throws BaleenException */ public static String getExternalId(Relation relation) { String[] ids = { relation.getExternalId(), relation.getSource().getExternalId(), relation.getTarget().getExternalId() }; try { return IdentityUtils.hashStrings(ids); } catch (BaleenException e) { return fallbackToUUID(e); } }
protected String getUniqueId(JCas jCas) { return ConsumerUtils.getExternalId(getDocumentAnnotation(jCas), contentHashAsId); }
private String getUniqueId(JCas jCas) { return ConsumerUtils.getExternalId(getDocumentAnnotation(jCas), contentHashAsId); }
private String getDocumentId(JCas jCas) { return ConsumerUtils.getExternalId( UimaSupport.getDocumentAnnotation(jCas), options.isContentHashAsId()); }
private String getDocumentId(JCas jCas) { return ConsumerUtils.getExternalId( UimaSupport.getDocumentAnnotation(jCas), options.isContentHashAsId()); }
final String id = ConsumerUtils.getExternalId(da, contentHashAsId); f = new File(outputFolder, id + FILE_EXTENSION); } else { e); final String id = ConsumerUtils.getExternalId(da, contentHashAsId); f = new File(outputFolder, id + FILE_EXTENSION);
return new Document() .append(FIELD_DOCUMENT_ID, documentId) .append(fields.getExternalId(), ConsumerUtils.getExternalId(e.getValue())) .append(FIELD_LINKING, referenceTarget.getLinking()) .append(
@Override protected void doProcess(JCas jCas) throws AnalysisEngineProcessException { DocumentAnnotation da = UimaSupport.getDocumentAnnotation(jCas); String docId = ConsumerUtils.getExternalId(da, contentHashAsId);
@Override protected void doProcess(JCas jCas) throws AnalysisEngineProcessException { DocumentAnnotation da = UimaSupport.getDocumentAnnotation(jCas); String docId = ConsumerUtils.getExternalId(da, contentHashAsId);
private Integer executeDocInsert(JCas jCas) throws SQLException, BaleenException { DocumentAnnotation da = getDocumentAnnotation(jCas); String documentId = ConsumerUtils.getExternalId(da, contentHashAsId); insertDocStatement.clearParameters(); insertDocStatement.setString(1, documentId); insertDocStatement.setString(2, da.getDocType()); insertDocStatement.setString(3, da.getSourceUri()); insertDocStatement.setString(4, jCas.getDocumentText()); insertDocStatement.setString(5, jCas.getDocumentLanguage()); insertDocStatement.setTimestamp(6, new Timestamp(da.getTimestamp())); insertDocStatement.setString(7, da.getDocumentClassification()); insertDocStatement.setArray( 8, createVarcharArray(postgresResource.getConnection(), da.getDocumentCaveats())); insertDocStatement.setArray( 9, createVarcharArray(postgresResource.getConnection(), da.getDocumentReleasability())); insertDocStatement.executeUpdate(); Integer docKey = getKey(insertDocStatement); if (docKey == null) { throw new BaleenException("No document key returned"); } return docKey; }
final String baleenEntityId = ConsumerUtils.getExternalId(c); final String entityId = idGenerator.generateForExternalId(baleenEntityId);