@Override public Float getEntityRanking() { return EnhancementEngineHelper.get(data, uri, entityRanking, Float.class, lf); } /**
private static String getOrigin(Graph graph, IRI entityAnnotation) { IRI uOrigin = EnhancementEngineHelper.getReference(graph, entityAnnotation, ENHANCER_ORIGIN); if (uOrigin != null) { return uOrigin.getUnicodeString(); } else { String sOrigin = EnhancementEngineHelper.getString(graph, entityAnnotation, ENHANCER_ORIGIN); if (sOrigin != null) { return sOrigin; } else { Literal lOrigin = EnhancementEngineHelper.get(graph, entityAnnotation, ENHANCER_ORIGIN, Literal.class, lf); if (lOrigin != null) { return lOrigin.getLexicalForm(); } else { return null; } } } }
public void registerTextAnnotation(IRI textAnnotation, Graph metadata){ String selectedText = EnhancementEngineHelper.getString(metadata, textAnnotation, ENHANCER_SELECTED_TEXT); if(selectedText != null){ //NOTE: Typically it is not possible to find co-mentions for Entities with a // single Token, so can ignore those. // The only exception would be to use proper-nouns for initial linking and // Nouns for the co-mention resolution. In such cases this might result // in additional extractions. String[] tokens = tokenizer.tokenize(selectedText, language); if(tokens != null && tokens.length > 1){ //TODO make configurable Double confidence = EnhancementEngineHelper.get(metadata,textAnnotation,ENHANCER_CONFIDENCE,Double.class,lf); if(confidence == null || confidence > 0.85){ //TODO make configurable Integer start = EnhancementEngineHelper.get(metadata,textAnnotation,ENHANCER_START,Integer.class,lf); Integer end = EnhancementEngineHelper.get(metadata,textAnnotation,ENHANCER_END,Integer.class,lf); registerMention(new EntityMention(textAnnotation,metadata, ENHANCER_SELECTED_TEXT, DC_TYPE, start != null && end != null ? new Integer[]{start,end} : null)); } // else confidence to low } else if(tokens == null){ log.warn("Unable to tokenize \"{}\"@{} via tokenizer {} (class: {})!", new Object []{ selectedText,language,tokenizer, tokenizer.getClass().getName()}); } //else ignore Tokens with a single token } // else no selected text }
eaData.put(EAProps.entity, getReference(graph, entityAnnotation, ENHANCER_ENTITY_REFERENCE)); eaData.put(EAProps.label, getString(graph, entityAnnotation, ENHANCER_ENTITY_LABEL)); eaData.put(EAProps.confidence, EnhancementEngineHelper.get( graph, entityAnnotation, ENHANCER_CONFIDENCE, Double.class, lf)); entitySuggestionMap.put(entityAnnotation, eaData); Integer start = EnhancementEngineHelper.get(graph,textAnnotation, ENHANCER_START,Integer.class,lf); Integer end = EnhancementEngineHelper.get(graph,textAnnotation, ENHANCER_END,Integer.class,lf); Double confidence = EnhancementEngineHelper.get(graph, textAnnotation, ENHANCER_CONFIDENCE, Double.class, lf); Iterator<IRI> types = getReferences(graph, textAnnotation, DC_TYPE);
start = EnhancementEngineHelper.get(metadata, ta, ENHANCER_START, Integer.class, lf); if(start == null){ log.debug("unable to add fise:selection-prefix to TextAnnotation {} " end = EnhancementEngineHelper.get(metadata, ta, ENHANCER_END, Integer.class, lf); if(end == null){ log.debug("unable to add fise:selection-suffix to TextAnnotation {} "
while(it.hasNext()){ Triple t = it.next(); Integer end = EnhancementEngineHelper.get(metadata, t.getSubject(), ENHANCER_END, Integer.class, literalFactory); if(end != null && textAnnotations.contains(t.getSubject())){ while(it.hasNext()){ Triple t = it.next(); Integer start = EnhancementEngineHelper.get(metadata, t.getSubject(), ENHANCER_START, Integer.class, literalFactory); if(start != null && textAnnotations.contains(t.getSubject())){ Double confidnece = EnhancementEngineHelper.get(metadata, initialMention, ENHANCER_CONFIDENCE, Double.class, literalFactory); if(confidnece != null){ RDFTerm suggestedEntity = EnhancementEngineHelper.getReference(metadata, suggestion, ENHANCER_ENTITY_REFERENCE); if(suggestedEntity != null){ //it has a suggestion Double confidence = EnhancementEngineHelper.get( metadata, suggestion, ENHANCER_CONFIDENCE, Double.class, literalFactory); if(maxConfidence == null){ Double existingConfidence = EnhancementEngineHelper.get(metadata, existingSuggestion, ENHANCER_CONFIDENCE, Double.class, literalFactory);
EnhancementEngineHelper.get(graph, entityAnnotation, ENHANCER_CONFIDENCE, Double.class, lf); if (suggestion.originalConfidnece == null) { log.warn("EntityAnnotation {} does not define a value for "
eaData.put(EAProps.entity, getReference(graph, entityAnnotation, ENHANCER_ENTITY_REFERENCE)); eaData.put(EAProps.label, getString(graph, entityAnnotation, ENHANCER_ENTITY_LABEL)); eaData.put(EAProps.confidence, EnhancementEngineHelper.get( graph, entityAnnotation, ENHANCER_CONFIDENCE, Double.class, lf)); entitySuggestionMap.put(entityAnnotation, eaData); Integer start = EnhancementEngineHelper.get(graph,textAnnotation, ENHANCER_START,Integer.class,lf); Integer end = EnhancementEngineHelper.get(graph,textAnnotation, ENHANCER_END,Integer.class,lf); Double confidence = EnhancementEngineHelper.get(graph, textAnnotation, ENHANCER_CONFIDENCE, Double.class, lf); Iterator<IRI> types = getReferences(graph, textAnnotation, DC_TYPE);
Double confidence = null; try { confidence = get(graph, textAnnotation, ENHANCER_CONFIDENCE, Double.class, lf); } catch (InvalidLiteralTypeException e){ // STANBOL-1417: not a double value try { //try with float Float fconf = get(graph,textAnnotation,ENHANCER_CONFIDENCE,Float.class,lf); if(fconf != null){ confidence = Double.valueOf(fconf.doubleValue());
/** * Getter for the started dateTime of an 'em:Execution' * @param graph the graph * @param execution the execution instance * @return the time or <code>null</code> if not present */ public static Date getStarted(Graph graph, BlankNodeOrIRI execution){ return get(graph, execution, ExecutionMetadata.STARTED, Date.class, lf); } /**
Double confidence = null; try { confidence = get(graph, textAnnotation, ENHANCER_CONFIDENCE, Double.class, lf); } catch (InvalidLiteralTypeException e){ // STANBOL-1417: not a double value try { //try with float Float fconf = get(graph,textAnnotation,ENHANCER_CONFIDENCE,Float.class,lf); if(fconf != null){ confidence = Double.valueOf(fconf.doubleValue());
/** * Getter for the started dateTime of an 'em:Execution' * @param graph the graph * @param execution the execution instance * @return the time or <code>null</code> if not present */ public static Date getStarted(Graph graph, BlankNodeOrIRI execution){ return get(graph, execution, ExecutionMetadata.STARTED, Date.class, lf); } /**
+ ciUri +"' does not define a link to an valid ExecutionPlan"); isDefaultChain = get(em, chainExecutionNode, IS_DEFAULT_CHAIN, Boolean.class, lf); String extractedChainName = EnhancementEngineHelper.getString(ep, executionPlanNode, CHAIN); if(extractedChainName == null){
/** * Getter for the completed dateTime of an 'em:Execution' * @param graph the graph * @param execution the execution instance * @return the time or <code>null</code> if not present */ public static Date getCompleted(Graph graph, BlankNodeOrIRI execution){ return get(graph, execution, ExecutionMetadata.COMPLETED, Date.class, lf); } }
+ ciUri +"' does not define a link to an valid ExecutionPlan"); isDefaultChain = get(em, chainExecutionNode, IS_DEFAULT_CHAIN, Boolean.class, lf); String extractedChainName = EnhancementEngineHelper.getString(ep, executionPlanNode, CHAIN); if(extractedChainName == null){
/** * Getter for the completed dateTime of an 'em:Execution' * @param graph the graph * @param execution the execution instance * @return the time or <code>null</code> if not present */ public static Date getCompleted(Graph graph, BlankNodeOrIRI execution){ return get(graph, execution, ExecutionMetadata.COMPLETED, Date.class, lf); } }
public static boolean isOptional(Graph executionPlan, BlankNodeOrIRI executionNode) { Boolean optional = get(executionPlan,executionNode,OPTIONAL,Boolean.class,lf); return optional == null ? false : optional.booleanValue(); } public static String getEngine(Graph executionPlan, BlankNodeOrIRI executionNode) {
public static boolean isOptional(Graph executionPlan, BlankNodeOrIRI executionNode) { Boolean optional = get(executionPlan,executionNode,OPTIONAL,Boolean.class,lf); return optional == null ? false : optional.booleanValue(); } public static String getEngine(Graph executionPlan, BlankNodeOrIRI executionNode) {
Integer start = EnhancementEngineHelper.get(enhancements, subject, ENHANCER_START, Integer.class, literalFactory); if (start != null) { Collection<BlankNodeOrIRI> textAnnotationList = existingTextAnnotationsMap.get(start);