本文整理汇总了Java中org.neo4j.graphdb.Result类的典型用法代码示例。如果您正苦于以下问题:Java Result类的具体用法?Java Result怎么用?Java Result使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Result类属于org.neo4j.graphdb包,在下文中一共展示了Result类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadTableBD
import org.neo4j.graphdb.Result; //导入依赖的package包/类
public void loadTableBD(int num) {
Result res = db.execute("MATCH (n:`Avion`{numero:"+num+"}) RETURN n.numero, n.type, n.capacite");
DefaultTableModel dtm = new DefaultTableModel(0,0);
String header[] = {"Numero", "Type", "Capacite"};
String test[] = {"n.numero", "n.type", "n.capacite"};
dtm.setColumnIdentifiers(header);
jTable1.setModel(dtm);
while(res.hasNext()) {
Map<String, Object> row = res.next();
Map<String, Object> obj = new LinkedHashMap();
for (String t:test) {
obj.put(t, null);
}
for(Map.Entry<String, Object> col : row.entrySet()) {
obj.put(col.getKey(),col.getValue());
}
dtm.addRow(obj.values().toArray());
}
}
示例2: mergeArtifact
import org.neo4j.graphdb.Result; //导入依赖的package包/类
public void mergeArtifact(org.eclipse.aether.artifact.Artifact artifactModel) {
this.artifactCache.getOrPut(artifactModel, () -> {
String cypherQuery = "MERGE (artifact:ARTIFACT {groupId: {groupId}, artifactId: {artifactId}, version: {version}, extension: {extension}, hash: {hash}%s}) RETURN artifact";
Map<String, Object> parameters = new HashMap<>();
parameters.put("groupId", artifactModel.getGroupId());
parameters.put("artifactId", artifactModel.getArtifactId());
parameters.put("version", artifactModel.getVersion());
parameters.put("extension", artifactModel.getExtension());
if (!artifactModel.getClassifier().isEmpty()) {
cypherQuery = String.format(cypherQuery, ", classifier: {classifier}%s");
parameters.put("classifier", artifactModel.getClassifier());
}
parameters.put("hash", this.hash(parameters.values().toArray(new String[0])));
cypherQuery = String.format(cypherQuery, "");
try (Result result = this.graphDatabaseService.execute(cypherQuery, parameters)) {
return result.<Node>columnAs("artifact").next();
}
});
}
示例3: loadTableBD
import org.neo4j.graphdb.Result; //导入依赖的package包/类
public void loadTableBD() {
Result res = db.execute("MATCH (a:Avion)-[r:Affecter]->(d:Depart)<-[c:Constituer]-(v:Vol) RETURN d.numero, d.date, v.villeDep, v.villeArr, a.type, a.capacite, v.numero, v.heureDep, v.heureArr");
DefaultTableModel dtm = new DefaultTableModel(0,0);
String header[] = {"Numero", "Date","Depart", "Arriveé", "Type", "Capacite", "NumVol", "Heure De Depart", "Heure d'arrive"};
String test[] = {"d.numero", "d.date","v.villeDep", "v.villeArr", "a.type", "a.capacite", "v.numero", "v.heureDep", "v.heureArr"};
dtm.setColumnIdentifiers(header);
jTable1.setModel(dtm);
while(res.hasNext()) {
Map<String, Object> row = res.next();
Map<String, Object> obj = new LinkedHashMap();
for (String t:test) {
obj.put(t, null);
}
for(Map.Entry<String, Object> col : row.entrySet()) {
obj.put(col.getKey(),col.getValue());
}
dtm.addRow(obj.values().toArray());
}
}
示例4: loadTableBD
import org.neo4j.graphdb.Result; //导入依赖的package包/类
public void loadTableBD() {
Result res = db.execute("MATCH (n:`Personnel`) RETURN n.cin, n.numPassport, n.nom, n.adresse, n.telephone, n.type");
DefaultTableModel dtm = new DefaultTableModel(0,0);
String header[] = {"Cin", "Passeport", "Nom", " Adresse", "Telephone", "Type"};
String test[] = {"n.cin", "n.numPassport", "n.nom", "n.adresse", "n.telephone", "n.type"};
dtm.setColumnIdentifiers(header);
jTable1.setModel(dtm);
while(res.hasNext()) {
Map<String, Object> row = res.next();
Map<String, Object> obj = new LinkedHashMap();
for (String t:test) {
obj.put(t, null);
}
for(Map.Entry<String, Object> col : row.entrySet()) {
obj.put(col.getKey(),col.getValue());
}
dtm.addRow(obj.values().toArray());
}
}
示例5: loadDb
import org.neo4j.graphdb.Result; //导入依赖的package包/类
public void loadDb(int pos, String type) {
post= pos;
this.type = type;
Result res = db.execute("MATCH (n:Personnel {cin:"+pos+"}) RETURN n.cin, n.numPassport, n.nom, n.adresse, n.telephone");
String test[] = {"n.cin", "n.numPassport", "n.nom", "n.adresse", "n.telephone"};
Map<String, Object> obj = new LinkedHashMap();
while(res.hasNext()) {
Map<String, Object> row = res.next();
for (String t:test) {
obj.put(t, null);
}
for(Map.Entry<String, Object> col : row.entrySet()) {
obj.put(col.getKey(),col.getValue());
}
}
res.close();
cin.setText(obj.get("n.cin").toString());
passeport.setText(obj.get("n.numPassport").toString());
nom.setText(obj.get("n.nom").toString());
tel.setText(obj.get("n.telephone").toString());
adresse.setText(obj.get("n.adresse").toString());
}
示例6: loadDb
import org.neo4j.graphdb.Result; //导入依赖的package包/类
public void loadDb(int pos) {
post= pos;
Result res = db.execute("MATCH (n:Vol {numero:"+pos+"}) RETURN n.numero, n.villeDep, n.villeArr, n.heureDep, n.heureArr, n.distance, n.frequence");
String test[] = {"n.numero", "n.villeDep", "n.villeArr", "n.heureDep", "n.heureArr", "n.distance", "n.frequence"};
Map<String, Object> obj = new LinkedHashMap();
while(res.hasNext()) {
Map<String, Object> row = res.next();
for (String t:test) {
obj.put(t, null);
}
for(Entry<String, Object> col : row.entrySet()) {
obj.put(col.getKey(),col.getValue());
}
}
res.close();
villeDepart.setText(obj.get("n.villeDep").toString());
villeArrive.setText(obj.get("n.villeArr").toString());
heureDepart.setText(obj.get("n.heureDep").toString());
heureArrive.setText(obj.get("n.heureArr").toString());
distance.setText(obj.get("n.distance").toString());
frequence.setText(obj.get("n.frequence").toString());
}
示例7: loadTableBD
import org.neo4j.graphdb.Result; //导入依赖的package包/类
public void loadTableBD() {
Result res = db.execute("MATCH (n:`Passager`) RETURN n.cin, n.numPassport, n.nom, n.adresse, n.telephone");
DefaultTableModel dtm = new DefaultTableModel(0,0);
String header[] = {"Cin", "Passeport", "Nom", " Adresse", "Telephone"};
String test[] = {"n.cin", "n.numPassport", "n.nom", "n.adresse", "n.telephone"};
dtm.setColumnIdentifiers(header);
jTable1.setModel(dtm);
while(res.hasNext()) {
Map<String, Object> row = res.next();
Map<String, Object> obj = new LinkedHashMap();
for (String t:test) {
obj.put(t, null);
}
for(Map.Entry<String, Object> col : row.entrySet()) {
obj.put(col.getKey(),col.getValue());
}
dtm.addRow(obj.values().toArray());
}
}
示例8: loadTableBD
import org.neo4j.graphdb.Result; //导入依赖的package包/类
public void loadTableBD() {
Result res = db.execute("MATCH (n:`Vol`) RETURN n.numero, n.villeDep, n.villeArr, n.heureDep, n.heureArr, n.distance, n.frequence ORDER BY n.numero");
DefaultTableModel dtm = new DefaultTableModel(0,0);
String header[] = {"n.numero", "Depart", "Arrivee", "Heure Depart", "Heure Arrivee", "Distance", "Frequence"};
String test[] = {"n.numero", "n.villeDep", "n.villeArr", "n.heureDep", "n.heureArr", "n.distance", "n.frequence"};
dtm.setColumnIdentifiers(header);
jTable1.setModel(dtm);
while(res.hasNext()) {
Map<String, Object> row = res.next();
Map<String, Object> obj = new LinkedHashMap();
for (String t:test) {
obj.put(t, null);
}
for(Entry<String, Object> col : row.entrySet()) {
obj.put(col.getKey(),col.getValue());
}
dtm.addRow(obj.values().toArray());
}
}
示例9: loadTableBD
import org.neo4j.graphdb.Result; //导入依赖的package包/类
public void loadTableBD(String dateAuj) {
Result res = db.execute("MATCH (a:Avion)-[r:Affecter]->(d:Depart)<-[c:Constituer]-(v:Vol) WHERE d.date='"+dateAuj+"' RETURN d.numero, d.date, v.villeDep, v.villeArr, a.type, a.capacite, v.numero, v.heureDep, v.heureArr");
DefaultTableModel dtm = new DefaultTableModel(0,0);
String header[] = {"Numero", "Date","Depart", "Arriveé", "Type", "Capacite", "NumVol", "Heure De Depart", "Heure d'arrive"};
String test[] = {"d.numero", "d.date","v.villeDep", "v.villeArr", "a.type", "a.capacite", "v.numero", "v.heureDep", "v.heureArr"};
dtm.setColumnIdentifiers(header);
jTable1.setModel(dtm);
while(res.hasNext()) {
Map<String, Object> row = res.next();
Map<String, Object> obj = new LinkedHashMap();
for (String t:test) {
obj.put(t, null);
}
for(Map.Entry<String, Object> col : row.entrySet()) {
obj.put(col.getKey(),col.getValue());
}
dtm.addRow(obj.values().toArray());
}
}
示例10: insertBd
import org.neo4j.graphdb.Result; //导入依赖的package包/类
public void insertBd() {
Result res;
try (Transaction tx = db.beginTx()) {
Node depart = db.createNode(Main.Tables.Depart);
depart.setProperty("numero",numero);
depart.setProperty("date",date);
res = db.execute("MATCH (a:Avion), (d:Depart) WHERE a.numero="+avion+" AND d.numero="+numero+" CREATE (a)-[:Affecter]->(d)");
res = db.execute("MATCH (v:Vol), (d:Depart) WHERE v.numero="+vol+" AND d.numero="+numero+" CREATE (v)-[:Constituer]->(d)");
for (int i=0; i<passagers.size(); i++) {
res = db.execute("MATCH (p:Passagers), (d:Depart) WHERE p.cin='"+passagers.get(i)+"' AND d.numero="+numero+" CREATE (p)-[:Enregistrer]->(d)");
}
for (int i=0; i<personnels.size(); i++) {
res = db.execute("MATCH (p:Passagers), (d:Depart) WHERE p.cin='"+personnels.get(i)+"' AND d.numero="+numero+" CREATE (p)-[:Enregistrer]->(d)");
}
tx.success();
}
//res = db.execute("MATCH (d:Depart{date:'"+date+"'}), (p:Passager{cin:'"+passagers.get(0)+"'}) CREATE (p)-[r:Enregistrer]->(d)");
}
示例11: loadDb
import org.neo4j.graphdb.Result; //导入依赖的package包/类
public void loadDb(int pos) {
post= pos;
Result res = db.execute("MATCH (n:Passager {cin:"+pos+"}) RETURN n.cin, n.numPassport, n.nom, n.adresse, n.telephone");
String test[] = {"n.cin", "n.numPassport", "n.nom", "n.adresse", "n.telephone"};
Map<String, Object> obj = new LinkedHashMap();
while(res.hasNext()) {
Map<String, Object> row = res.next();
for (String t:test) {
obj.put(t, null);
}
for(Map.Entry<String, Object> col : row.entrySet()) {
obj.put(col.getKey(),col.getValue());
}
}
res.close();
cin.setText(obj.get("n.cin").toString());
passeport.setText(obj.get("n.numPassport").toString());
nom.setText(obj.get("n.nom").toString());
tel.setText(obj.get("n.telephone").toString());
adresse.setText(obj.get("n.adresse").toString());
}
示例12: loadDb
import org.neo4j.graphdb.Result; //导入依赖的package包/类
public void loadDb(int pos) {
post= pos;
Result res = db.execute("MATCH (n:Avion {numero:"+pos+"}) RETURN n.numero, n.type, n.capacite");
String test[] = {"n.numero", "n.type", "n.capacite"};
Map<String, Object> obj = new LinkedHashMap();
while(res.hasNext()) {
Map<String, Object> row = res.next();
for (String t:test) {
obj.put(t, null);
}
for(Map.Entry<String, Object> col : row.entrySet()) {
obj.put(col.getKey(),col.getValue());
}
}
res.close();
typef.setText(obj.get("n.type").toString());
capacitef.setText(obj.get("n.capacite").toString());
}
示例13: GraphWalker
import org.neo4j.graphdb.Result; //导入依赖的package包/类
public GraphWalker(DbServiceDecorator dbServices, long rootId, boolean simple, boolean cfg) {
this.simple = simple;
this.cfg = cfg;
final Node root = dbServices.getNodeById(rootId);
nodes.add(root);
final Result result = dbServices.execute(
"MATCH (root)-[*]->(n) WHERE id(root) = $rootId RETURN id(n) as id",
ImmutableMap.of("rootId", rootId)
);
while (result.hasNext()) {
final Map<String, Object> next = result.next();
nodes.add(dbServices.getNodeById(Long.valueOf(next.get("id").toString())));
}
// nodes = dbServices.graphDb
// .traversalDescription()
// .breadthFirst()
// .traverse(root)
// .nodes()
// .stream().map(node -> node).collect(Collectors.toList());
}
示例14: executeQuery
import org.neo4j.graphdb.Result; //导入依赖的package包/类
private void executeQuery(JsonGenerator jg, Query query) throws IOException {
query.setStart(System.currentTimeMillis());
try ( Transaction ignored = database.beginTx(); Result result = database.execute(query.toCypher()) ) {
query.setEnd(System.currentTimeMillis());
jg.writeNumberField("duration", query.getDuration());
if (!query.isCountQuery())
jg.writeArrayFieldStart(query.getResultHeader());
while ( result.hasNext() ) {
Map<String, Object> row = result.next();
if (!query.isCountQuery())
jg.writeStartObject();
for ( Entry<String, Object> column : row.entrySet() ) {
writeField(column, jg);
}
if (!query.isCountQuery())
jg.writeEndObject();
}
if (!query.isCountQuery())
jg.writeEndArray();
}
}
示例15: deleteRelations
import org.neo4j.graphdb.Result; //导入依赖的package包/类
@Override
public Set<Node> deleteRelations(DocumentRelationContext context) {
Set<Node> orphans = new HashSet<>();
String documentKey = context.getDocumentKey();
if(StringUtils.isBlank(documentKey))
{
return orphans;
}
Result result = db.execute("MATCH (p)-[r:"+documentKey+"]->(c) RETURN r");
result.forEachRemaining((res)->{
Relationship rel = (Relationship) res.get("r");
Node parent = rel.getStartNode();
Node child = rel.getEndNode();
rel.delete();
if(log.isDebugEnabled())
{
log.debug("Delete relation "+rel);
}
updateOrphans(orphans, parent);
updateOrphans(orphans, child);
});
return orphans;
}