本文整理了Java中org.neo4j.driver.v1.Record.get
方法的一些代码示例,展示了Record.get
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Record.get
方法的具体详情如下:
包路径:org.neo4j.driver.v1.Record
类名称:Record
方法名:get
[英]Retrieve the value at the given field index
[中]检索给定字段索引处的值
代码示例来源:origin: neo4j/neo4j
@Test
public void calls_simplistic_procedure()
{
try ( Driver driver = GraphDatabase.driver( graphDb.boltURI(), configuration() );
Session session = driver.session() )
{
StatementResult result = session.run( "CALL " + procedureNamespace + ".theAnswer()" );
assertThat( result.single().get( "value" ).asLong() ).isEqualTo( 42L );
}
}
代码示例来源:origin: testcontainers/testcontainers-java
@Test
public void shouldStart() {
boolean actual = neo4jContainer.isRunning();
assertThat(actual).isTrue();
try (Driver driver = GraphDatabase
.driver(neo4jContainer.getBoltUrl(), AuthTokens.basic("neo4j", "password"));
Session session = driver.session()
) {
long one = session.run("RETURN 1", Collections.emptyMap()).next().get(0).asLong();
assertThat(one).isEqualTo(1L);
} catch (Exception e) {
fail(e.getMessage());
}
}
代码示例来源:origin: testcontainers/testcontainers-java
@Test
public void shouldDisableAuthentication() {
try (
Neo4jContainer neo4jContainer = new Neo4jContainer().withAdminPassword(null);
) {
neo4jContainer.start();
try (Driver driver = getDriver(neo4jContainer);
Session session = driver.session()
) {
long one = session.run("RETURN 1", Collections.emptyMap()).next().get(0).asLong();
assertThat(one).isEqualTo(1L);
}
}
}
代码示例来源:origin: testcontainers/testcontainers-java
@Test
public void shouldRunEnterprise() {
assumeThat(Neo4jContainerTest.class.getResource(ACCEPTANCE_FILE_LOCATION)).isNotNull();
try (
Neo4jContainer neo4jContainer = new Neo4jContainer()
.withEnterpriseEdition()
.withAdminPassword("Picard123")
) {
neo4jContainer.start();
try (
Driver driver = getDriver(neo4jContainer);
Session session = driver.session()
) {
String edition = session
.run("CALL dbms.components() YIELD edition RETURN edition", Collections.emptyMap())
.next().get(0).asString();
assertThat(edition).isEqualTo("enterprise");
}
}
}
代码示例来源:origin: org.neo4j.driver/neo4j-java-driver
@Override
public T apply( Record record )
{
return mapFunction.apply( record.get( index ) );
}
};
代码示例来源:origin: org.neo4j.driver/neo4j-java-driver
@Override
public T apply( Record recordAccessor )
{
return mapFunction.apply( recordAccessor.get( key ) );
}
};
代码示例来源:origin: hibernate/hibernate-ogm
@SuppressWarnings("unchecked")
private <T> List<T> asList(Record embeddeds, String alias) {
Value value = embeddeds.get( alias );
if ( value.isNull() ) {
return Collections.emptyList();
}
return (List<T>) value.asList();
}
代码示例来源:origin: hibernate/hibernate-ogm
private Relationship asRelationship(Record record, String alias) {
Value value = record.get( alias );
if ( value.isNull() ) {
return null;
}
return value.asRelationship();
}
代码示例来源:origin: neo4j/cypher-shell
@Override
@Nonnull
public Optional set(@Nonnull String name, @Nonnull String valueString) throws CommandException {
final BoltResult result = setParamsAndValidate(name, valueString);
String parameterName = CypherVariablesFormatter.unescapedCypherVariable(name);
final Object value = result.getRecords().get(0).get(parameterName).asObject();
queryParams.put(parameterName, new ParamValue(valueString, value));
return Optional.ofNullable(value);
}
代码示例来源:origin: hibernate/hibernate-ogm
private Relationship relationship(StatementResult result) {
if ( result.hasNext() ) {
return result.next().get( 0 ).asRelationship();
}
return null;
}
代码示例来源:origin: org.opencb.bionetdb/bionetdb-core
private int getTotalRelationships() {
Session session = this.driver.session();
int count = session.run("MATCH ()-[r]-() RETURN count(r) AS count").peek().get("count").asInt();
session.close();
return count;
// return this.session.run("MATCH ()-[r]-() RETURN count(r) AS count").peek().get("count").asInt();
}
代码示例来源:origin: org.opencb.bionetdb/bionetdb-core
private int getTotalXrefRelationships() {
Session session = this.driver.session();
int count = session.run("MATCH (n:"
+ NodeTypes.PHYSICAL_ENTITY + ")-[r:" + RelTypes.XREF + "]->(m:"
+ NodeTypes.XREF + ") RETURN count(r) AS count").peek().get("count").asInt();
session.close();
return count;
// return this.session.run("MATCH (n:"
// + NodeTypes.PHYSICAL_ENTITY + ")-[r:" + RelTypes.XREF + "]->(m:"
// + NodeTypes.XREF + ") RETURN count(r) AS count").peek().get("count").asInt();
}
代码示例来源:origin: org.opencb.bionetdb/bionetdb-core
private int getTotalCelLocationNodes() {
Session session = this.driver.session();
int count = session.run("MATCH (n:" + NodeTypes.CELLULAR_LOCATION + ") RETURN count(n) AS count")
.peek().get("count").asInt();
session.close();
return count;
// return this.session.run("MATCH (n:" + NodeTypes.CELLULAR_LOCATION + ") RETURN count(n) AS count")
// .peek().get("count").asInt();
}
代码示例来源:origin: org.opencb.bionetdb/bionetdb-core
private int getTotalNodes() {
Session session = this.driver.session();
int count = session.run("MATCH (n) RETURN count(n) AS count").peek().get("count").asInt();
session.close();
return count;
// return this.session.run("MATCH (n) RETURN count(n) AS count").peek().get("count").asInt();
}
代码示例来源:origin: org.opencb.bionetdb/bionetdb-core
private int getTotalOntologyRelationships() {
Session session = this.driver.session();
int count = session.run("MATCH (n)-[r:" + RelTypes.ONTOLOGY + "|" + RelTypes.CELLOC_ONTOLOGY
+ "]->(m:" + NodeTypes.ONTOLOGY + ") RETURN count(r) AS count").peek().get("count").asInt();
session.close();
return count;
// return this.session.run("MATCH (n)-[r:" + RelTypes.ONTOLOGY + "|" + RelTypes.CELLOC_ONTOLOGY
// + "]->(m:" + NodeTypes.ONTOLOGY + ") RETURN count(r) AS count").peek().get("count").asInt();
}
代码示例来源:origin: opencypher/cypher-for-gremlin
@Test
public void single() {
List<Map<String, Object>> results = singletonList(getRow(1));
StatementResult statementResult = new GremlinServerStatementResult(serverInfo, statement, results.iterator(), converter);
assertThat(statementResult.single().get(KEY1).asInt()).isEqualTo(1);
}
代码示例来源:origin: hibernate/hibernate-ogm
public Node findAssociatedEntity(Transaction tx, Object[] keyValues, String associationrole) {
Map<String, Object> params = params( keyValues );
String query = getFindAssociatedEntityQuery( associationrole );
if ( query != null ) {
StatementResult statementResult = tx.run( query, params );
if ( statementResult.hasNext() ) {
return statementResult.single().get( 0 ).asNode();
}
}
return null;
}
代码示例来源:origin: opencypher/cypher-for-gremlin
@Test
public void simple() {
Driver adam = GremlinDatabase.driver("//localhost:" + server.getPort());
try (Session session = adam.session()) {
StatementResult result = session.run("MATCH (n:person) RETURN count(n) as count");
int count = result.single().get("count").asInt();
assertThat(count).isEqualTo(4);
}
}
代码示例来源:origin: h-omer/neo4j-versioner-core
@Test
public void shouldCreateAnRNodeConnectedToTheEntity() throws Throwable {
try (Driver driver = GraphDatabase.driver(neo4j.boltURI(), Config.build().withEncryption().toConfig()); Session session = driver.session()) {
StatementResult result = session.run("CALL graph.versioner.init('Entity')");
StatementResult rPath = session.run("MATCH rPath = (:R)-[:FOR]->(:Entity) RETURN rPath");
Assertions.assertThat(result.single().get("node").asNode().id()).isEqualTo(0L);
Assertions.assertThat(rPath)
.hasSize(1)
.allMatch(path -> path.get("rPath").asPath().length() == 1);
}
}
}
代码示例来源:origin: opencypher/cypher-for-gremlin
@Test
public void translating() {
Config config = Config.build()
.withTranslation(TranslatorFlavor.gremlinServer())
.toConfig();
Driver driver = GremlinDatabase.driver("//localhost:" + server.getPort(), config);
try (Session session = driver.session()) {
StatementResult result = session.run("MATCH (n:person) RETURN count(n) as count");
int count = result.single().get("count").asInt();
assertThat(count).isEqualTo(4);
}
}
内容来源于网络,如有侵权,请联系作者删除!