本文整理了Java中org.neo4j.driver.v1.Record.asMap
方法的一些代码示例,展示了Record.asMap
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Record.asMap
方法的具体详情如下:
包路径:org.neo4j.driver.v1.Record
类名称:Record
方法名:asMap
[英]Return this record as a map, where each value has been converted to a default java object using Value#asObject(). This is equivalent to calling #asMap(Function) with Values#ofObject().
[中]将此记录作为映射返回,其中每个值都已使用value#asObject()转换为默认java对象。这相当于使用值#ofObject()调用#asMap(函数)。
代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures
private Stream<RowResult> getRowResultStream(boolean virtual, Session session, Map<String, Object> params, String statement, boolean read) {
Map<Long, Object> nodesCache = new HashMap<>();
return StreamSupport.stream(Spliterators.spliteratorUnknownSize(runStatement(statement, session, params, read), 0), true)
.map(record -> new RowResult(record.asMap(value -> {
Object entity = value.asObject();
if (entity instanceof Node) return toNode(entity, virtual, nodesCache);
if (entity instanceof Relationship) return toRelationship(entity, virtual, nodesCache);
if (entity instanceof Path) return toPath(entity, virtual, nodesCache);
return entity;
})));
}
代码示例来源:origin: org.neo4j.driver/neo4j-java-driver
private static Value parameters( Record record )
{
return record == null ? Values.EmptyMap : parameters( record.asMap() );
}
代码示例来源:origin: neo4j/neo4j-ogm
private Map<String, Object> buildModel() {
Map<String, Object> row = new LinkedHashMap<>();
if (resultProjection.hasNext()) {
row = restModelAdapter.adapt(resultProjection.next().asMap());
}
return row;
}
代码示例来源:origin: org.neo4j/neo4j-ogm-bolt-driver
private Map<String, Object> buildModel() {
Map<String, Object> row = new LinkedHashMap<>();
if (resultProjection.hasNext()) {
row = restModelAdapter.adapt(resultProjection.next().asMap());
}
return row;
}
}
代码示例来源:origin: opencypher/cypher-for-gremlin
@Override
public StatementResult run(String statementTemplate, Record statementParameters) {
return run(statementTemplate, statementParameters.asMap());
}
代码示例来源:origin: neo4j/cypher-shell
@Override
@Nonnull
public String format(@Nonnull final BoltResult result) {
List<Value> data = result.getRecords().stream()
.map(r -> Values.value(r.<Value>asMap(v -> v)))
.collect(Collectors.toList());
return formatValues(data, result.getKeys());
}
代码示例来源:origin: neo4j/neo4j-ogm
@Override
public String[] columns() {
if (result.hasNext()) {
Record record = result.peek();
if (record != null) {
Set<String> columns = result.peek().asMap().keySet();
return columns.toArray(new String[columns.size()]);
}
}
return new String[0];
}
}
代码示例来源:origin: org.neo4j/neo4j-ogm-bolt-driver
@Override
public String[] columns() {
if (result.hasNext()) {
Record record = result.peek();
if (record != null) {
Set<String> columns = result.peek().asMap().keySet();
return columns.toArray(new String[columns.size()]);
}
}
return new String[0];
}
}
代码示例来源:origin: stackoverflow.com
Driver driver = GraphDatabase.driver( "bolt://localhost", AuthTokens.basic( "neo4j", "neo4j" ) );
Session session = driver.session();
StatementResult result = session.run( "MATCH (a:Person) WHERE a.name = 'Arthur' RETURN a.name AS name, a.title AS title" );
while ( result.hasNext() ) {
Record record = result.next();
gson.toJson(record.asMap());
}
session.close();
driver.close();
代码示例来源:origin: neo4j-examples/neo4j-movies-java-bolt
@Override
public Iterator<Map<String, Object>> query(String query, Map<String, Object> params) {
try (Session session = driver.session()) {
List<Map<String, Object>> list = session.run(query, params)
.list( r -> r.asMap(BoltCypherExecutor::convert));
return list.iterator();
}
}
代码示例来源:origin: neo4j/neo4j-ogm
@Override
public RowModel fetchNext() {
if (result.hasNext()) {
return adapter.adapt(result.next().asMap());
}
return null;
}
}
代码示例来源:origin: org.neo4j/neo4j-ogm-bolt-driver
@Override
public GraphModel fetchNext() {
if (result.hasNext()) {
return adapter.adapt(result.next().asMap());
}
return null;
}
}
代码示例来源:origin: org.neo4j/neo4j-ogm-bolt-driver
@Override
public RowModel fetchNext() {
if (result.hasNext()) {
return adapter.adapt(result.next().asMap());
}
return null;
}
}
代码示例来源:origin: neo4j/neo4j-ogm
@Override
public GraphModel fetchNext() {
if (result.hasNext()) {
return adapter.adapt(result.next().asMap());
}
return null;
}
}
代码示例来源:origin: org.opencb.bionetdb/bionetdb-core
StatementResult run = session.run(myQuery.toString());
while (run.hasNext()) {
System.out.println(run.next().asMap());
代码示例来源:origin: org.opencb.bionetdb/bionetdb-core
@Override
public QueryResult getNodes(Query query, QueryOptions queryOptions) throws BioNetDBException {
Session session = this.driver.session();
long startTime = System.currentTimeMillis();
String nodeName = "n";
String myQuery = "MATCH " + Neo4JQueryParser.parse(nodeName, query, queryOptions) + " RETURN " + nodeName;
System.out.println("Query: " + myQuery);
long stopTime = System.currentTimeMillis();
// TODO: Build new Network with the result
StatementResult run = session.run(myQuery);
while (run.hasNext()) {
System.out.println(run.next().asMap());
}
int time = (int) (stopTime - startTime) / 1000;
session.close();
return new QueryResult("get", time, 0, 0, null, null, Arrays.asList(new Network()));
}
代码示例来源:origin: org.neo4j/neo4j-ogm-bolt-driver
@Override
public GraphRowListModel fetchNext() {
if (result.hasNext()) {
DefaultGraphRowListModel model = new DefaultGraphRowListModel();
model.add(adapter.adapt(result.next().asMap()));
while (result.hasNext()) {
model.add(adapter.adapt(result.next().asMap()));
}
return model;
}
return null;
}
}
代码示例来源:origin: neo4j/neo4j-ogm
@Override
public GraphRowListModel fetchNext() {
if (result.hasNext()) {
DefaultGraphRowListModel model = new DefaultGraphRowListModel();
model.add(adapter.adapt(result.next().asMap()));
while (result.hasNext()) {
model.add(adapter.adapt(result.next().asMap()));
}
return model;
}
return null;
}
}
代码示例来源:origin: neo4j/cypher-shell
when(record.get(eq("node"))).thenReturn(nodeVal);
when(record.<Value>asMap(anyObject())).thenReturn(recordMap);
代码示例来源:origin: neueda/jetbrains-plugin-graph-database-support
@Override
public GraphQueryResult execute(String query, Map<String, Object> statementParameters) {
try {
Driver driver = GraphDatabase.driver(url, auth);
try {
try (Session session = driver.session()) {
Neo4jBoltBuffer buffer = new Neo4jBoltBuffer();
long startTime = System.currentTimeMillis();
StatementResult statementResult = session.run(query, statementParameters);
buffer.addColumns(statementResult.keys());
for (Record record : statementResult.list()) {
// Add row
buffer.addRow(record.asMap());
}
buffer.addResultSummary(statementResult.consume());
long endTime = System.currentTimeMillis();
return new Neo4jBoltQueryResult(endTime - startTime, buffer);
}
} finally {
driver.closeAsync();
}
} catch (UnresolvedAddressException e) {
throw new ClientException(e.getMessage());
}
}
内容来源于网络,如有侵权,请联系作者删除!