@Test public void textExtract() throws Exception { InputStream in = getClass().getResourceAsStream("bffls.txt"); VertexBuilder vertexBuilder = graph.prepareVertex("v1", visibility); StreamingPropertyValue textPropertyValue = new StreamingPropertyValue(in, String.class); LumifyProperties.TEXT.setProperty(vertexBuilder, textPropertyValue, visibility); Vertex vertex = vertexBuilder.save(authorizations); in = getClass().getResourceAsStream("bffls.txt"); Property property = vertex.getProperty(LumifyProperties.TEXT.getPropertyName()); GraphPropertyWorkData workData = new GraphPropertyWorkData(visibilityTranslator, vertex, property, null, null); extractor.execute(in, workData); List<Vertex> termMentions = toList(vertex.getVertices(Direction.OUT, LumifyProperties.TERM_MENTION_LABEL_HAS_TERM_MENTION, termMentionAuthorizations)); assertEquals(3, termMentions.size()); for (Vertex termMention : termMentions) { assertTrue(LumifyProperties.TERM_MENTION_RESOLVED_EDGE_ID.getPropertyValue(termMention) != null); assertEquals("http: assertEquals("Joe Ferner", LumifyProperties.TERM_MENTION_TITLE.getPropertyValue(termMention)); } }
@Override public void execute(InputStream in, GraphPropertyWorkData data) throws Exception { String text = IOUtils.toString(in, "UTF-8"); Iterator<SearchResult<Match>> searchResults = tree.search(text.toCharArray()); Vertex sourceVertex = (Vertex) data.getElement(); List<Vertex> termMentions = new ArrayList<>(); while (searchResults.hasNext()) { SearchResult searchResult = searchResults.next(); VisibilityJson visibilityJson = data.getVisibilitySourceJson(); List<Vertex> newTermMentions = outputResultToTermMention(sourceVertex, searchResult, data.getProperty().getKey(), visibilityJson, data.getVisibility()); termMentions.addAll(newTermMentions); getGraph().flush(); } applyTermMentionFilters(sourceVertex, termMentions); pushTextUpdated(data); }
KnownEntityExtractorGraphPropertyWorker extends GraphPropertyWorker { @Override public void execute(InputStream in, GraphPropertyWorkData data) throws Exception { String text = IOUtils.toString(in, "UTF-8"); Iterator<SearchResult<Match>> searchResults = tree.search(text.toCharArray()); Vertex sourceVertex = (Vertex) data.getElement(); List<Vertex> termMentions = new ArrayList<>(); while (searchResults.hasNext()) { SearchResult searchResult = searchResults.next(); VisibilityJson visibilityJson = data.getVisibilitySourceJson(); List<Vertex> newTermMentions = outputResultToTermMention(sourceVertex, searchResult, data.getProperty().getKey(), visibilityJson, data.getVisibility()); termMentions.addAll(newTermMentions); getGraph().flush(); } applyTermMentionFilters(sourceVertex, termMentions); pushTextUpdated(data); } }
KnownEntityExtractorGraphPropertyWorker extends GraphPropertyWorker { @Override public void execute(InputStream in, GraphPropertyWorkData data) throws Exception { String text = IOUtils.toString(in, "UTF-8"); Iterator<SearchResult<Match>> searchResults = tree.search(text.toCharArray()); Vertex sourceVertex = (Vertex) data.getElement(); List<Vertex> termMentions = new ArrayList<>(); while (searchResults.hasNext()) { SearchResult searchResult = searchResults.next(); VisibilityJson visibilityJson = data.getVisibilitySourceJson(); List<Vertex> newTermMentions = outputResultToTermMention(sourceVertex, searchResult, data.getProperty().getKey(), visibilityJson, data.getVisibility()); termMentions.addAll(newTermMentions); getGraph().flush(); } applyTermMentionFilters(sourceVertex, termMentions); pushTextUpdated(data); }  }
KnownEntityExtractorGraphPropertyWorker extends GraphPropertyWorker { @Override public void execute(InputStream in, GraphPropertyWorkData data) throws Exception { String text = IOUtils.toString(in, "UTF-8"); Iterator<SearchResult<Match>> searchResults = tree.search(text.toCharArray()); Vertex sourceVertex = (Vertex) data.getElement(); List<Vertex> termMentions = new ArrayList<>(); while (searchResults.hasNext()) { SearchResult searchResult = searchResults.next(); VisibilityJson visibilityJson = data.getVisibilitySourceJson(); List<Vertex> newTermMentions = outputResultToTermMention(sourceVertex, searchResult, data.getProperty().getKey(), visibilityJson, data.getVisibility()); termMentions.addAll(newTermMentions); getGraph().flush(); } applyTermMentionFilters(sourceVertex, termMentions); pushTextUpdated(data); }  @Override void prepare(GraphPropertyWorkerPrepareData workerPrepareData); @Override void execute(InputStream in, GraphPropertyWorkData data); @Override boolean isHandled(Element element, Property property); }
KnownEntityExtractorGraphPropertyWorker extends GraphPropertyWorker { @Override public void execute(InputStream in, GraphPropertyWorkData data) throws Exception { String text = IOUtils.toString(in, "UTF-8"); Iterator<SearchResult<Match>> searchResults = tree.search(text.toCharArray()); Vertex sourceVertex = (Vertex) data.getElement(); List<Vertex> termMentions = new ArrayList<>(); while (searchResults.hasNext()) { SearchResult searchResult = searchResults.next(); VisibilityJson visibilityJson = data.getVisibilitySourceJson(); List<Vertex> newTermMentions = outputResultToTermMention(sourceVertex, searchResult, data.getProperty().getKey(), visibilityJson, data.getVisibility()); termMentions.addAll(newTermMentions); getGraph().flush(); } applyTermMentionFilters(sourceVertex, termMentions); pushTextUpdated(data); }  @Override void prepare(GraphPropertyWorkerPrepareData workerPrepareData); @Override void execute(InputStream in, GraphPropertyWorkData data); @Override boolean isHandled(Element element, Property property); static final String PATH_PREFIX_CONFIG; static final String DEFAULT_PATH_PREFIX; }