本文整理了Java中org.vertexium.Graph.getStreamingPropertyValueInputStreams()
方法的一些代码示例,展示了Graph.getStreamingPropertyValueInputStreams()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.getStreamingPropertyValueInputStreams()
方法的具体详情如下:
包路径:org.vertexium.Graph
类名称:Graph
方法名:getStreamingPropertyValueInputStreams
[英]Opens multiple StreamingPropertyValue input streams at once. This can have performance benefits by reducing the number of queries to the underlying data source.
[中]一次打开多个StreamingPropertyValue输入流。这可以减少对底层数据源的查询数量,从而提高性能。
代码示例来源:origin: org.vertexium/vertexium-elasticsearch-singledocument
private void addStreamingPropertyValuesToFieldMap(Graph graph, List<Property> properties, Map<String, Object> propertiesMap) {
List<StreamingPropertyValue> streamingPropertyValues = properties.stream()
.map((property) -> {
if (!(property.getValue() instanceof StreamingPropertyValue)) {
throw new VertexiumException("property with a value that is not a StreamingPropertyValue passed to addStreamingPropertyValuesToFieldMap");
}
return (StreamingPropertyValue) property.getValue();
})
.collect(Collectors.toList());
List<InputStream> inputStreams = graph.getStreamingPropertyValueInputStreams(streamingPropertyValues);
for (int i = 0; i < properties.size(); i++) {
try {
String propertyValue = IOUtils.toString(inputStreams.get(i));
addPropertyToFieldMap(graph, properties.get(i), new StreamingPropertyString(propertyValue), propertiesMap);
} catch (IOException ex) {
throw new VertexiumException("could not convert streaming property to string", ex);
}
}
}
代码示例来源:origin: org.vertexium/vertexium-elasticsearch5
private void addStreamingExtendedDataColumnsValuesToMap(Graph graph, List<ExtendedDataMutation> columns, Map<String, Object> fieldsMap) {
List<StreamingPropertyValue> streamingPropertyValues = columns.stream()
.map((column) -> {
if (!(column.getValue() instanceof StreamingPropertyValue)) {
throw new VertexiumException("column with a value that is not a StreamingPropertyValue passed to addStreamingPropertyValuesToFieldMap");
}
return (StreamingPropertyValue) column.getValue();
})
.collect(Collectors.toList());
List<InputStream> inputStreams = graph.getStreamingPropertyValueInputStreams(streamingPropertyValues);
for (int i = 0; i < columns.size(); i++) {
try {
String propertyValue = IOUtils.toString(inputStreams.get(i));
addExtendedDataColumnToFieldMap(graph, columns.get(i), new StreamingPropertyString(propertyValue), fieldsMap);
} catch (IOException ex) {
throw new VertexiumException("could not convert streaming property to string", ex);
}
}
}
代码示例来源:origin: org.vertexium/vertexium-elasticsearch2
private void addStreamingExtendedDataColumnsValuesToMap(Graph graph, List<ExtendedDataMutation> columns, Map<String, Object> fieldsMap) {
List<StreamingPropertyValue> streamingPropertyValues = columns.stream()
.map((column) -> {
if (!(column.getValue() instanceof StreamingPropertyValue)) {
throw new VertexiumException("column with a value that is not a StreamingPropertyValue passed to addStreamingPropertyValuesToFieldMap");
}
return (StreamingPropertyValue) column.getValue();
})
.collect(Collectors.toList());
List<InputStream> inputStreams = graph.getStreamingPropertyValueInputStreams(streamingPropertyValues);
for (int i = 0; i < columns.size(); i++) {
try {
String propertyValue = IOUtils.toString(inputStreams.get(i));
addExtendedDataColumnToFieldMap(graph, columns.get(i), new StreamingPropertyString(propertyValue), fieldsMap);
} catch (IOException ex) {
throw new VertexiumException("could not convert streaming property to string", ex);
}
}
}
代码示例来源:origin: org.vertexium/vertexium-elasticsearch-singledocument
private void addStreamingExtendedDataColumnsValuesToMap(Graph graph, List<ExtendedDataMutation> columns, Map<String, Object> fieldsMap) {
List<StreamingPropertyValue> streamingPropertyValues = columns.stream()
.map((column) -> {
if (!(column.getValue() instanceof StreamingPropertyValue)) {
throw new VertexiumException("column with a value that is not a StreamingPropertyValue passed to addStreamingPropertyValuesToFieldMap");
}
return (StreamingPropertyValue) column.getValue();
})
.collect(Collectors.toList());
List<InputStream> inputStreams = graph.getStreamingPropertyValueInputStreams(streamingPropertyValues);
for (int i = 0; i < columns.size(); i++) {
try {
String propertyValue = IOUtils.toString(inputStreams.get(i));
addExtendedDataColumnToFieldMap(graph, columns.get(i), new StreamingPropertyString(propertyValue), fieldsMap);
} catch (IOException ex) {
throw new VertexiumException("could not convert streaming property to string", ex);
}
}
}
代码示例来源:origin: org.vertexium/vertexium-elasticsearch2
private void addStreamingPropertyValuesToFieldMap(Graph graph, List<Property> properties, Map<String, Object> propertiesMap) {
List<StreamingPropertyValue> streamingPropertyValues = properties.stream()
.map((property) -> {
if (!(property.getValue() instanceof StreamingPropertyValue)) {
throw new VertexiumException("property with a value that is not a StreamingPropertyValue passed to addStreamingPropertyValuesToFieldMap");
}
return (StreamingPropertyValue) property.getValue();
})
.collect(Collectors.toList());
List<InputStream> inputStreams = graph.getStreamingPropertyValueInputStreams(streamingPropertyValues);
for (int i = 0; i < properties.size(); i++) {
try {
String propertyValue = IOUtils.toString(inputStreams.get(i));
addPropertyToFieldMap(graph, properties.get(i), new StreamingPropertyString(propertyValue), propertiesMap);
} catch (IOException ex) {
throw new VertexiumException("could not convert streaming property to string", ex);
}
}
}
代码示例来源:origin: visallo/vertexium
private void addStreamingExtendedDataColumnsValuesToMap(Graph graph, List<ExtendedDataMutation> columns, Map<String, Object> fieldsMap) {
List<StreamingPropertyValue> streamingPropertyValues = columns.stream()
.map((column) -> {
if (!(column.getValue() instanceof StreamingPropertyValue)) {
throw new VertexiumException("column with a value that is not a StreamingPropertyValue passed to addStreamingPropertyValuesToFieldMap");
}
return (StreamingPropertyValue) column.getValue();
})
.collect(Collectors.toList());
List<InputStream> inputStreams = graph.getStreamingPropertyValueInputStreams(streamingPropertyValues);
for (int i = 0; i < columns.size(); i++) {
try {
String propertyValue = IOUtils.toString(inputStreams.get(i));
addExtendedDataColumnToFieldMap(graph, columns.get(i), new StreamingPropertyString(propertyValue), fieldsMap);
} catch (IOException ex) {
throw new VertexiumException("could not convert streaming property to string", ex);
}
}
}
代码示例来源:origin: org.vertexium/vertexium-elasticsearch5
private void addStreamingPropertyValuesToFieldMap(Graph graph, List<Property> properties, Map<String, Object> propertiesMap) {
List<StreamingPropertyValue> streamingPropertyValues = properties.stream()
.map((property) -> {
if (!(property.getValue() instanceof StreamingPropertyValue)) {
throw new VertexiumException("property with a value that is not a StreamingPropertyValue passed to addStreamingPropertyValuesToFieldMap");
}
return (StreamingPropertyValue) property.getValue();
})
.collect(Collectors.toList());
if (streamingPropertyValues.size() > 0 && graph instanceof GraphWithSearchIndex) {
((GraphWithSearchIndex) graph).flushGraph();
}
List<InputStream> inputStreams = graph.getStreamingPropertyValueInputStreams(streamingPropertyValues);
for (int i = 0; i < properties.size(); i++) {
try {
String propertyValue = IOUtils.toString(inputStreams.get(i));
addPropertyToFieldMap(graph, properties.get(i), new StreamingPropertyString(propertyValue), propertiesMap);
} catch (IOException ex) {
throw new VertexiumException("could not convert streaming property to string", ex);
}
}
}
代码示例来源:origin: visallo/vertexium
private void addStreamingPropertyValuesToFieldMap(Graph graph, List<Property> properties, Map<String, Object> propertiesMap) {
List<StreamingPropertyValue> streamingPropertyValues = properties.stream()
.map((property) -> {
if (!(property.getValue() instanceof StreamingPropertyValue)) {
throw new VertexiumException("property with a value that is not a StreamingPropertyValue passed to addStreamingPropertyValuesToFieldMap");
}
return (StreamingPropertyValue) property.getValue();
})
.collect(Collectors.toList());
if (streamingPropertyValues.size() > 0 && graph instanceof GraphWithSearchIndex) {
((GraphWithSearchIndex) graph).flushGraph();
}
List<InputStream> inputStreams = graph.getStreamingPropertyValueInputStreams(streamingPropertyValues);
for (int i = 0; i < properties.size(); i++) {
try {
String propertyValue = IOUtils.toString(inputStreams.get(i));
addPropertyToFieldMap(graph, properties.get(i), new StreamingPropertyString(propertyValue), propertiesMap);
} catch (IOException ex) {
throw new VertexiumException("could not convert streaming property to string", ex);
}
}
}
代码示例来源:origin: org.vertexium/vertexium-test
@Test
public void testGetStreamingPropertyValueInputStreams() throws Exception {
graph.defineProperty("a").dataType(String.class).textIndexHint(TextIndexHint.FULL_TEXT).define();
graph.defineProperty("b").dataType(String.class).textIndexHint(TextIndexHint.FULL_TEXT).define();
graph.defineProperty("c").dataType(String.class).textIndexHint(TextIndexHint.FULL_TEXT).define();
graph.prepareVertex("v1", VISIBILITY_A)
.setProperty("a", StreamingPropertyValue.create("Test Value A"), VISIBILITY_A)
.setProperty("b", StreamingPropertyValue.create("Test Value B"), VISIBILITY_A)
.setProperty("c", StreamingPropertyValue.create("Test Value C"), VISIBILITY_A)
.save(AUTHORIZATIONS_A_AND_B);
graph.flush();
Vertex v1 = graph.getVertex("v1", AUTHORIZATIONS_A_AND_B);
StreamingPropertyValue spvA = (StreamingPropertyValue) v1.getPropertyValue("a");
assertEquals(12L, (long) spvA.getLength());
StreamingPropertyValue spvB = (StreamingPropertyValue) v1.getPropertyValue("b");
assertEquals(12L, (long) spvA.getLength());
StreamingPropertyValue spvC = (StreamingPropertyValue) v1.getPropertyValue("c");
assertEquals(12L, (long) spvA.getLength());
ArrayList<StreamingPropertyValue> spvs = Lists.newArrayList(spvA, spvB, spvC);
List<InputStream> streams = graph.getStreamingPropertyValueInputStreams(spvs);
assertEquals("Test Value A", IOUtils.toString(streams.get(0)));
assertEquals("Test Value B", IOUtils.toString(streams.get(1)));
assertEquals("Test Value C", IOUtils.toString(streams.get(2)));
}
代码示例来源:origin: visallo/vertexium
@Test
public void testGetStreamingPropertyValueInputStreams() throws Exception {
graph.defineProperty("a").dataType(String.class).textIndexHint(TextIndexHint.FULL_TEXT).define();
graph.defineProperty("b").dataType(String.class).textIndexHint(TextIndexHint.FULL_TEXT).define();
graph.defineProperty("c").dataType(String.class).textIndexHint(TextIndexHint.FULL_TEXT).define();
graph.prepareVertex("v1", VISIBILITY_A)
.setProperty("a", StreamingPropertyValue.create("Test Value A"), VISIBILITY_A)
.setProperty("b", StreamingPropertyValue.create("Test Value B"), VISIBILITY_A)
.setProperty("c", StreamingPropertyValue.create("Test Value C"), VISIBILITY_A)
.save(AUTHORIZATIONS_A_AND_B);
graph.flush();
Vertex v1 = graph.getVertex("v1", AUTHORIZATIONS_A_AND_B);
StreamingPropertyValue spvA = (StreamingPropertyValue) v1.getPropertyValue("a");
assertEquals(12L, (long) spvA.getLength());
StreamingPropertyValue spvB = (StreamingPropertyValue) v1.getPropertyValue("b");
assertEquals(12L, (long) spvA.getLength());
StreamingPropertyValue spvC = (StreamingPropertyValue) v1.getPropertyValue("c");
assertEquals(12L, (long) spvA.getLength());
ArrayList<StreamingPropertyValue> spvs = Lists.newArrayList(spvA, spvB, spvC);
List<InputStream> streams = graph.getStreamingPropertyValueInputStreams(spvs);
assertEquals("Test Value A", IOUtils.toString(streams.get(0)));
assertEquals("Test Value B", IOUtils.toString(streams.get(1)));
assertEquals("Test Value C", IOUtils.toString(streams.get(2)));
}
内容来源于网络,如有侵权,请联系作者删除!