本文整理汇总了Java中org.neo4j.driver.v1.StatementResult.list方法的典型用法代码示例。如果您正苦于以下问题:Java StatementResult.list方法的具体用法?Java StatementResult.list怎么用?Java StatementResult.list使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.neo4j.driver.v1.StatementResult
的用法示例。
在下文中一共展示了StatementResult.list方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldCreateComplexArray2
import org.neo4j.driver.v1.StatementResult; //导入方法依赖的package包/类
@Test
public void shouldCreateComplexArray2(){
String key = "shouldCreateComplexArray2";
String json = "{\"id\": \"1\", "
+ "\"type\": \"artist\","
+ "\"name\": \"Genesis\","
+ "\"albums\": ["
+ " {"
+ " \"type\": \"album\","
+ " \"id\": \"10\","
+ " \"producer\": \"Jonathan King\","
+ " \"title\": \"From Genesis to Revelation\""
+ " },"
+ " {"
+ " \"type\": \"album\","
+ " \"id\": \"20\","
+ " \"producer\": \"Jonathan King\","
+ " \"title\": \"John Anthony\""
+ " }"
+ "]"
+ "}";
session.run(CALL_UPSERT, Values.parameters( "key", key, "json", json ));
StatementResult result = session.run("MATCH (art {type: 'artist'}) - [r] -> (alb {type: 'album'}) RETURN art.name, alb.title,r");
List<Record> list = result.list();
Assert.assertEquals(2, list.size());
}
示例2: shouldCreateComplexArray2
import org.neo4j.driver.v1.StatementResult; //导入方法依赖的package包/类
@Test
public void shouldCreateComplexArray2(){
String key = "shouldCreateComplexArray2";
String json = "{\"id\": 1, "
+ "\"type\": \"artist\","
+ "\"name\": \"Genesis\","
+ "\"albums\": ["
+ " {"
+ " \"type\": \"album\","
+ " \"id\": 1,"
+ " \"producer\": \"Jonathan King\","
+ " \"title\": \"From Genesis to Revelation\""
+ " },"
+ " {"
+ " \"type\": \"album\","
+ " \"id\": 2,"
+ " \"producer\": \"Jonathan King\","
+ " \"title\": \"John Anthony\""
+ " }"
+ "]"
+ "}";
session.run(CALL_UPSERT, Values.parameters( "key", key, "json", json ));
StatementResult result = session.run("MATCH (art {type: 'artist'}) - [r] -> (alb {type: 'album'}) RETURN art.name, alb.title,r");
List<Record> list = result.list();
Assert.assertEquals(2, list.size());
}
示例3: BoltContentHandler
import org.neo4j.driver.v1.StatementResult; //导入方法依赖的package包/类
public BoltContentHandler(StatementResult statementResult, ResultHandler rh) {
if (statementResult != null)
this.records = statementResult.list(); // don't use streaming mode
else
this.records = new ArrayList<Record>();
this.reloaded = new Reloaded(rh.getDbAccess());
}
示例4: shouldCreateRelationKeys
import org.neo4j.driver.v1.StatementResult; //导入方法依赖的package包/类
@Test
public void shouldCreateRelationKeys(){
String json = "{\"id\": \"1\", "
+ "\"type\": \"artist\","
+ "\"name\": \"Genesis\","
+ "\"albums\": ["
+ " {"
+ " \"type\": \"album\","
+ " \"id\": \"10\","
+ " \"producer\": \"Jonathan King\","
+ " \"title\": \"FIRST From Genesis to Revelation\""
+ " }"
+ "]"
+ "}";
String json2 = "{\"id\": \"2\", "
+ "\"type\": \"artist\","
+ "\"name\": \"King Crimson\","
//same album of Genesis
+ "\"albums\": ["
+ " {"
+ " \"type\": \"album\","
+ " \"id\": \"10\","
+ " \"producer\": \"Jonathan King\","
+ " \"title\": \"From Genesis to Revelation\"" //change title
+ " }"
+ "]"
+ "}";
session.run(CALL_UPSERT, Values.parameters( "key", "genesis", "json", json ));
session.run(CALL_UPSERT, Values.parameters( "key", "kingcrimson", "json", json2 ));
StatementResult result = session.run("MATCH (art {type: 'artist'}) - [r] -> (alb {type: 'album'}) RETURN art.name, alb.title,r");
List<Record> list = result.list();
Assert.assertEquals(2, list.size());
Record genesis = list.get(0);
Assert.assertEquals("Wrong node","Genesis", genesis.get("art.name").asString());
Assert.assertEquals("Wrong inner node","From Genesis to Revelation", genesis.get("alb.title").asString());
Assert.assertEquals("Wrong inner node","genesis", genesis.get("r").asRelationship().type());
Record king = list.get(1);
Assert.assertEquals("Wrong node","King Crimson", king.get("art.name").asString());
Assert.assertEquals("Wrong inner node","From Genesis to Revelation", king.get("alb.title").asString());
Assert.assertEquals("Wrong inner node","kingcrimson", king.get("r").asRelationship().type());
}
示例5: shouldAddRelationKeys
import org.neo4j.driver.v1.StatementResult; //导入方法依赖的package包/类
@Test
public void shouldAddRelationKeys(){
String json = "{\"id\": \"1\", "
+ "\"type\": \"artist\","
+ "\"name\": \"Genesis\","
+ "\"albums\": ["
+ " {"
+ " \"type\": \"album\","
+ " \"id\": \"10\","
+ " \"producer\": \"Jonathan King\","
+ " \"title\": \"From Genesis to Revelation\","
+ " \"tracks\": [{"
+ " \"type\": \"track\","
+ " \"id\": \"100\","
+ " \"title\": \"Where the Sour Turns to Sweet\""
+ " }]"
+ " }"
+ "]"
+ "}";
String json2 = "{\"id\": \"2\", "
+ "\"type\": \"artist\","
+ "\"name\": \"King Crimson\","
//same album of Genesis
+ "\"albums\": ["
+ " {"
+ " \"type\": \"album\","
+ " \"id\": \"10\","
+ " \"producer\": \"Jonathan King\","
+ " \"title\": \"From Genesis to Revelation\","
+ " \"tracks\": [{"
+ " \"type\": \"track\","
+ " \"id\": \"100\","
+ " \"title\": \"Where the Sour Turns to Sweet\""
+ " }]"
+ " }"
+ "]"
+ "}";
session.run(CALL_UPSERT, Values.parameters( "key", "genesis", "json", json ));
session.run(CALL_UPSERT, Values.parameters( "key", "kingcrimson", "json", json2 ));
StatementResult result = session.run("MATCH (alb {type: 'album'}) - [r] -> (tra {type: 'track'}) RETURN alb.title, tra.title,r,type(r)");
List<Record> list = result.list();
Assert.assertEquals(2, list.size());
List<String> results = list.stream().map(n -> n.get("type(r)").asString()).collect(Collectors.toList());
Assert.assertTrue(results.contains("genesis"));
Assert.assertTrue(results.contains("kingcrimson"));
}
示例6: shouldDeleteRelationKey
import org.neo4j.driver.v1.StatementResult; //导入方法依赖的package包/类
@Test
public void shouldDeleteRelationKey(){
String json = "{\"id\": \"1\", "
+ "\"type\": \"artist\","
+ "\"name\": \"Genesis\","
+ "\"albums\": ["
+ " {"
+ " \"type\": \"album\","
+ " \"id\": \"10\","
+ " \"producer\": \"Jonathan King\","
+ " \"title\": \"From Genesis to Revelation\","
+ " \"tracks\": [{"
+ " \"type\": \"track\","
+ " \"id\": \"100\","
+ " \"title\": \"Where the Sour Turns to Sweet\""
+ " }]"
+ " }"
+ "]"
+ "}";
String json2 = "{\"id\": \"2\", "
+ "\"type\": \"artist\","
+ "\"name\": \"King Crimson\","
//same album of Genesis
+ "\"albums\": ["
+ " {"
+ " \"type\": \"album\","
+ " \"id\": \"10\","
+ " \"producer\": \"Jonathan King\","
+ " \"title\": \"From Genesis to Revelation\","
+ " \"tracks\": [{"
+ " \"type\": \"track\","
+ " \"id\": \"100\","
+ " \"title\": \"Where the Sour Turns to Sweet\""
+ " }]"
+ " }"
+ "]"
+ "}";
session.run(CALL_UPSERT, Values.parameters( "key", "genesis", "json", json ));
session.run(CALL_UPSERT, Values.parameters( "key", "kingcrimson", "json", json2 ));
session.run(CALL_DELETE, Values.parameters( "key", "genesis"));
StatementResult result = session.run("MATCH (alb {type: 'album'}) - [r] -> (tra {type: 'track'}) RETURN alb.title, tra.title,type(r)");
List<Record> list = result.list();
Assert.assertEquals(1, list.size());
Record fromGenesis = list.get(0);
Assert.assertEquals("kingcrimson",fromGenesis.get("type(r)").asString());
}
示例7: shouldCreateRelationKeys
import org.neo4j.driver.v1.StatementResult; //导入方法依赖的package包/类
@Test
public void shouldCreateRelationKeys(){
String json = "{\"id\": 1, "
+ "\"type\": \"artist\","
+ "\"name\": \"Genesis\","
+ "\"albums\": ["
+ " {"
+ " \"type\": \"album\","
+ " \"id\": 1,"
+ " \"producer\": \"Jonathan King\","
+ " \"title\": \"FIRST From Genesis to Revelation\""
+ " }"
+ "]"
+ "}";
String json2 = "{\"id\": 2, "
+ "\"type\": \"artist\","
+ "\"name\": \"King Crimson\","
//same album of Genesis
+ "\"albums\": ["
+ " {"
+ " \"type\": \"album\","
+ " \"id\": 1,"
+ " \"producer\": \"Jonathan King\","
+ " \"title\": \"From Genesis to Revelation\"" //change title
+ " }"
+ "]"
+ "}";
session.run(CALL_UPSERT, Values.parameters( "key", "genesis", "json", json ));
session.run(CALL_UPSERT, Values.parameters( "key", "kingcrimson", "json", json2 ));
StatementResult result = session.run("MATCH (art {type: 'artist'}) - [r] -> (alb {type: 'album'}) RETURN art.name, alb.title,r,r.docKeys");
List<Record> list = result.list();
Assert.assertEquals(2, list.size());
Record genesis = list.get(0);
Assert.assertEquals("Wrong node","Genesis", genesis.get("art.name").asString());
Assert.assertEquals("Wrong inner node","From Genesis to Revelation", genesis.get("alb.title").asString());
Assert.assertEquals("Wrong inner node","HAS_ALBUM", genesis.get("r").asRelationship().type());
Assert.assertEquals("docKeys errato",1, genesis.get("r.docKeys").asList().size());
Record king = list.get(1);
Assert.assertEquals("Wrong node","King Crimson", king.get("art.name").asString());
Assert.assertEquals("Wrong inner node","From Genesis to Revelation", king.get("alb.title").asString());
Assert.assertEquals("Wrong inner node","HAS_ALBUM", king.get("r").asRelationship().type());
Assert.assertEquals("docKeys errato",1, king.get("r.docKeys").asList().size());
Assert.assertTrue(genesis.get("r.docKeys").asList().contains("genesis"));
Assert.assertTrue(king.get("r.docKeys").asList().contains("kingcrimson"));
}
示例8: shouldAddRelationKeys
import org.neo4j.driver.v1.StatementResult; //导入方法依赖的package包/类
@Test
public void shouldAddRelationKeys(){
String json = "{\"id\": 1, "
+ "\"type\": \"artist\","
+ "\"name\": \"Genesis\","
+ "\"albums\": ["
+ " {"
+ " \"type\": \"album\","
+ " \"id\": 1,"
+ " \"producer\": \"Jonathan King\","
+ " \"title\": \"From Genesis to Revelation\","
+ " \"tracks\": [{"
+ " \"type\": \"track\","
+ " \"id\": 1,"
+ " \"title\": \"Where the Sour Turns to Sweet\""
+ " }]"
+ " }"
+ "]"
+ "}";
String json2 = "{\"id\": 2, "
+ "\"type\": \"artist\","
+ "\"name\": \"King Crimson\","
//same album of Genesis
+ "\"albums\": ["
+ " {"
+ " \"type\": \"album\","
+ " \"id\": 1,"
+ " \"producer\": \"Jonathan King\","
+ " \"title\": \"From Genesis to Revelation\","
+ " \"tracks\": [{"
+ " \"type\": \"track\","
+ " \"id\": 1,"
+ " \"title\": \"Where the Sour Turns to Sweet\""
+ " }]"
+ " }"
+ "]"
+ "}";
session.run(CALL_UPSERT, Values.parameters( "key", "genesis", "json", json ));
session.run(CALL_UPSERT, Values.parameters( "key", "kingcrimson", "json", json2 ));
StatementResult result = session.run("MATCH (alb {type: 'album'}) - [r] -> (tra {type: 'track'}) RETURN alb.title, tra.title,r,r.docKeys");
List<Record> list = result.list();
Assert.assertEquals(1, list.size());
Record fromGenesis = list.get(0);
Assert.assertTrue(fromGenesis.get("r.docKeys").asList().contains("genesis"));
Assert.assertTrue(fromGenesis.get("r.docKeys").asList().contains("kingcrimson"));
}
示例9: shouldDeleteRelationKey
import org.neo4j.driver.v1.StatementResult; //导入方法依赖的package包/类
@Test
public void shouldDeleteRelationKey(){
String json = "{\"id\": 1, "
+ "\"type\": \"artist\","
+ "\"name\": \"Genesis\","
+ "\"albums\": ["
+ " {"
+ " \"type\": \"album\","
+ " \"id\": 1,"
+ " \"producer\": \"Jonathan King\","
+ " \"title\": \"From Genesis to Revelation\","
+ " \"tracks\": [{"
+ " \"type\": \"track\","
+ " \"id\": 1,"
+ " \"title\": \"Where the Sour Turns to Sweet\""
+ " }]"
+ " }"
+ "]"
+ "}";
String json2 = "{\"id\": 2, "
+ "\"type\": \"artist\","
+ "\"name\": \"King Crimson\","
//same album of Genesis
+ "\"albums\": ["
+ " {"
+ " \"type\": \"album\","
+ " \"id\": 1,"
+ " \"producer\": \"Jonathan King\","
+ " \"title\": \"From Genesis to Revelation\","
+ " \"tracks\": [{"
+ " \"type\": \"track\","
+ " \"id\": 1,"
+ " \"title\": \"Where the Sour Turns to Sweet\""
+ " }]"
+ " }"
+ "]"
+ "}";
session.run(CALL_UPSERT, Values.parameters( "key", "genesis", "json", json ));
session.run(CALL_UPSERT, Values.parameters( "key", "kingcrimson", "json", json2 ));
session.run(CALL_DELETE, Values.parameters( "key", "kingcrimson"));
StatementResult result = session.run("MATCH (alb {type: 'album'}) - [r] -> (tra {type: 'track'}) RETURN alb.title, tra.title,r,r.docKeys");
List<Record> list = result.list();
Assert.assertEquals(1, list.size());
Record fromGenesis = list.get(0);
Assert.assertTrue(fromGenesis.get("r.docKeys").asList().contains("genesis"));
Assert.assertFalse(fromGenesis.get("r.docKeys").asList().contains("kingcrimson"));
}