Java 验证neo4j中的数据库是否为空

Java 验证neo4j中的数据库是否为空,java,database,neo4j,Java,Database,Neo4j,我正在用java开发neo4j,我有一个问题。创建节点时,如何验证数据库是否为空 以下是我创建节点的代码: br = new BufferedReader(new FileReader(csvFile)); while (br.ready()==true) { transaction = graphDb.beginTx(); int cont = 0;//limitador de tuplas por query

我正在用java开发neo4j,我有一个问题。创建节点时,如何验证数据库是否为空

以下是我创建节点的代码:

br = new BufferedReader(new FileReader(csvFile));

        while (br.ready()==true) {
            transaction = graphDb.beginTx();
            int cont = 0;//limitador de tuplas por query
            while ((line = br.readLine()) != null && cont < 10000) {

                String[] dado = line.split(cvsSplitBy);

                // inserir comando para criar o nós com a data
                Node no = graphDb.createNode();
                no.setProperty("data", dado[0]);
                no.setProperty("temperatura", dado[1]);
                no.setProperty("latitude", dado[2]);
                no.setProperty("longitude", dado[3]);
                no.setProperty("variação", dado[4]);

                System.out.println(cont);
                cont++;
            }
            transaction.success();
            transaction.close();
        }
br=new-BufferedReader(new-FileReader(csvFile));
while(br.ready()==true){
事务=graphDb.beginTx();
int cont=0;//limitador de tuplas por查询
而((line=br.readLine())!=null&&cont<10000){
String[]dado=line.split(cvsSplitBy);
//巴西国家统计局(inserir comando para criar o nós com a)数据
节点号=graphDb.createNode();
no.setProperty(“数据”,护墙板[0]);
no.setProperty(“温度”,护墙板[1]);
no.setProperty(“纬度”,护墙板[2]);
no.setProperty(“经度”,护墙板[3]);
no.setProperty(“variação”,护墙板[4]);
系统输出打印项次(续);
cont++;
}
transaction.success();
transaction.close();
}

使用此查询:

MATCH (n) RETURN count(n);

如果答案为零,则数据库为空。如果是其他的,则不是。

这里是一个高效的密码查询,返回布尔
isEmpty
结果

MATCH (n)
RETURN n IS NULL AS isEmpty
LIMIT 1;
我希望Neo4J能够减少处理这个查询的麻烦,因为我知道它不必像前面的回答那样费心计算或过滤

match (n) 
return 1 
limit 1