当前位置: 首页>>代码示例>>Java>>正文


Java Result.close方法代码示例

本文整理汇总了Java中org.neo4j.graphdb.Result.close方法的典型用法代码示例。如果您正苦于以下问题:Java Result.close方法的具体用法?Java Result.close怎么用?Java Result.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.neo4j.graphdb.Result的用法示例。


在下文中一共展示了Result.close方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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());
    
}
 
开发者ID:ATF19,项目名称:flight-management-system-java,代码行数:24,代码来源:ModifierEmp.java

示例2: 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());
    
}
 
开发者ID:ATF19,项目名称:flight-management-system-java,代码行数:24,代码来源:ModifierVol.java

示例3: 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());
    
}
 
开发者ID:ATF19,项目名称:flight-management-system-java,代码行数:23,代码来源:ModifierPass.java

示例4: 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());
    
}
 
开发者ID:ATF19,项目名称:flight-management-system-java,代码行数:20,代码来源:ModifierAvion.java

示例5: evaluateSingleNodeResult

import org.neo4j.graphdb.Result; //导入方法依赖的package包/类
private Optional<Node> evaluateSingleNodeResult(String prefixedRecordURI, Result result) {

		if(result == null) {

			LOG.error("couldn't retrieve record for uri '{}'", prefixedRecordURI);

			return Optional.empty();
		}

		if (!result.hasNext()) {

			result.close();

			LOG.error("couldn't find record for uri '{}'", prefixedRecordURI);

			return Optional.empty();
		}

		final Map<String, Object> row = result.next();

		final Iterator<Map.Entry<String, Object>> rowIter = row.entrySet().iterator();

		if (!rowIter.hasNext()) {

			result.close();

			LOG.error("couldn't find record for uri '{}'", prefixedRecordURI);

			return Optional.empty();
		}

		final Map.Entry<String, Object> column = rowIter.next();

		if (column.getValue() == null) {

			result.close();

			LOG.error("couldn't find record for uri '{}'", prefixedRecordURI);

			return Optional.empty();
		}

		if (!column.getKey().equals(RECORD_VARIABLE) || !Node.class.isInstance(column.getValue())) {

			result.close();

			return Optional.empty();
		}

		final Node record = (Node) column.getValue();

		result.close();

		return Optional.ofNullable(record);
	}
 
开发者ID:dswarm,项目名称:dswarm-graph-neo4j,代码行数:56,代码来源:RecordsNeo4jDeprecator.java

示例6: executeQueryWithSingleResult

import org.neo4j.graphdb.Result; //导入方法依赖的package包/类
private static String executeQueryWithSingleResult(final String query, final String resultVariableName, final GraphDatabaseService graphDB)
		throws DMPGraphException {

	String resultValue = null;

	try (final Transaction tx = graphDB.beginTx()) {

		final Result result = graphDB.execute(query);

		if (result != null) {

			if (result.hasNext()) {

				final Map<String, Object> row = result.next();

				final Set<Map.Entry<String, Object>> entrySet = row.entrySet();

				final Iterator<Map.Entry<String, Object>> iter = entrySet.iterator();

				if (iter.hasNext()) {

					final Map.Entry<String, Object> column = iter.next();

					if (column.getValue() != null) {

						if (column.getKey().equals(resultVariableName)) {

							resultValue = column.getValue().toString();
						}
					}
				}
			}

			result.close();
		}

		tx.success();
	} catch (final Exception e) {

		final String message = "couldn't execute query with single result";

		GraphDBUtil.LOG.error(message, e);

		throw new DMPGraphException(message);
	}

	return resultValue;
}
 
开发者ID:dswarm,项目名称:dswarm-graph-neo4j,代码行数:49,代码来源:GraphDBUtil.java

示例7: executeQueryWithMultipleResults

import org.neo4j.graphdb.Result; //导入方法依赖的package包/类
public static Collection<String> executeQueryWithMultipleResults(final String query, final String resultVariableName,
                                                                 final GraphDatabaseService graphDB) throws DMPGraphException {

	final Set<String> resultSet = new HashSet<>();

	try (final Transaction tx = graphDB.beginTx()) {

		final Result result = graphDB.execute(query);

		if (result != null) {

			while (result.hasNext()) {

				final Map<String, Object> row = result.next();

				for (final Map.Entry<String, Object> column : row.entrySet()) {

					if (column.getValue() != null) {

						if (column.getKey().equals(resultVariableName)) {

							resultSet.add(column.getValue().toString());
						}
					}
				}
			}

			result.close();
		}

		tx.success();
	} catch (final Exception e) {

		final String message = "couldn't execute query with multiple results";

		GraphDBUtil.LOG.error(message, e);

		throw new DMPGraphException(message);
	}

	return resultSet;
}
 
开发者ID:dswarm,项目名称:dswarm-graph-neo4j,代码行数:43,代码来源:GraphDBUtil.java

示例8: executeQueryWithMultipleResultsWithValues

import org.neo4j.graphdb.Result; //导入方法依赖的package包/类
private static Map<String, String> executeQueryWithMultipleResultsWithValues(final String query, final String resultVariableName,
                                                                             final String uriVariableName, final String valueVariableName, final GraphDatabaseService graphDB)
		throws DMPGraphException {

	final Map<String, String> resultSet = new HashMap<>();

	try (final Transaction tx = graphDB.beginTx()) {

		final Result result = graphDB.execute(query);

		if (result != null) {

			while (result.hasNext()) {

				final Map<String, Object> row = result.next();

				String identifier = null;
				String value = null;

				for (final Map.Entry<String, Object> column : row.entrySet()) {

					if (column.getValue() != null) {

						if (column.getKey().equals(resultVariableName)) {

							identifier = column.getValue().toString();
						}

						if (column.getKey().equals(uriVariableName) || column.getKey().equals(valueVariableName)) {

							value = column.getValue().toString();
						}
					}
				}

				if (identifier != null && value != null) {

					resultSet.put(identifier, value);
				}
			}

			result.close();
		}

		tx.success();
	} catch (final Exception e) {

		final String message = "couldn't execute query with multiple results with values";

		GraphDBUtil.LOG.error(message, e);

		throw new DMPGraphException(message);
	}

	return resultSet;
}
 
开发者ID:dswarm,项目名称:dswarm-graph-neo4j,代码行数:57,代码来源:GraphDBUtil.java

示例9: executeQueryWithSingleRelationshipResult

import org.neo4j.graphdb.Result; //导入方法依赖的package包/类
/**
 * note: should be executed in transaction scope
 *
 * @param query
 * @param resultVariableName
 * @param graphDB
 * @return
 */
public static Relationship executeQueryWithSingleRelationshipResult(final String query, final String resultVariableName,
                                                                    final GraphDatabaseService graphDB) {

	final Result result = graphDB.execute(query);

	if (result == null) {

		return null;
	}

	if (!result.hasNext()) {

		result.close();

		return null;
	}

	final Map<String, Object> row = result.next();

	final Iterator<Map.Entry<String, Object>> rowIter = row.entrySet().iterator();

	if (!rowIter.hasNext()) {

		result.close();

		return null;
	}

	final Map.Entry<String, Object> column = rowIter.next();

	if (column.getValue() == null) {

		result.close();

		return null;
	}

	if (!column.getKey().equals(resultVariableName) || !Relationship.class.isInstance(column.getValue())) {

		result.close();

		return null;
	}

	final Relationship rel = (Relationship) column.getValue();

	result.close();

	return rel;
}
 
开发者ID:dswarm,项目名称:dswarm-graph-neo4j,代码行数:59,代码来源:GraphDBUtil.java


注:本文中的org.neo4j.graphdb.Result.close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。