本文整理汇总了Java中org.neo4j.helpers.collection.IteratorUtil.count方法的典型用法代码示例。如果您正苦于以下问题:Java IteratorUtil.count方法的具体用法?Java IteratorUtil.count怎么用?Java IteratorUtil.count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.neo4j.helpers.collection.IteratorUtil
的用法示例。
在下文中一共展示了IteratorUtil.count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNumVertexWithoutPartition
import org.neo4j.helpers.collection.IteratorUtil; //导入方法依赖的package包/类
@Override
public int getNumVertexWithoutPartition() {
int num = 0;
try {
beginTransaction();
Result result = graphDb.execute("MATCH (n:NODE) WHERE n.PARTITION IS NULL RETURN n");
Iterator<Integer> list = result.columnAs("n");
num = IteratorUtil.count(list);
} finally {
endTransaction();
}
return num;//IteratorUtil.count(list);
}
示例2: getNodeCount
import org.neo4j.helpers.collection.IteratorUtil; //导入方法依赖的package包/类
@Override
public int getNodeCount()
{
int nodeCount = 0;
try (final Transaction tx = beginUnforcedTransaction())
{
try
{
nodeCount = IteratorUtil.count(GlobalGraphOperations.at(neo4jGraph).getAllNodes());
tx.success();
}
catch (Exception e)
{
tx.failure();
throw new BenchmarkingException("unable to get node count", e);
}
}
return nodeCount;
}
示例3: getGraphWeightSum
import org.neo4j.helpers.collection.IteratorUtil; //导入方法依赖的package包/类
@Override
public double getGraphWeightSum()
{
int edgeCount = 0;
try (final Transaction tx = beginUnforcedTransaction())
{
try
{
edgeCount = IteratorUtil.count(GlobalGraphOperations.at(neo4jGraph).getAllRelationships());
tx.success();
}
catch (Exception e)
{
tx.failure();
throw new BenchmarkingException("unable to get graph weight sum", e);
}
}
return (double) edgeCount;
}
示例4: getDegreeOfNode
import org.neo4j.helpers.collection.IteratorUtil; //导入方法依赖的package包/类
@Override
public int getDegreeOfNode(long id, int level) {
if (level == 0) {
return getDegreeOfNode(id);
}
Vertex v = getVertex(id, level);
Iterator<Long> neighbor = getIdFromNeighbor(v);
return IteratorUtil.count(neighbor);
}
示例5: testAbandonedIds
import org.neo4j.helpers.collection.IteratorUtil; //导入方法依赖的package包/类
@SuppressWarnings( "unchecked" )
private <T extends PropertyContainer> void testAbandonedIds( EntityCreator<T> creator,
Index<T> index )
{
// TODO This doesn't actually test that they are deleted, it just triggers it
// so that you manually can inspect what's going on
T a = creator.create();
T b = creator.create();
T c = creator.create();
String key = "name";
String value = "value";
index.add( a, key, value );
index.add( b, key, value );
index.add( c, key, value );
restartTx();
creator.delete( b );
restartTx();
IteratorUtil.count( (Iterator<Node>) index.get( key, value ) );
rollbackTx();
beginTx();
IteratorUtil.count( (Iterator<Node>) index.get( key, value ) );
index.add( c, "something", "whatever" );
restartTx();
IteratorUtil.count( (Iterator<Node>) index.get( key, value ) );
}
示例6: fillNodesFromBeginning
import org.neo4j.helpers.collection.IteratorUtil; //导入方法依赖的package包/类
private void fillNodesFromBeginning(Node currentNode, ViralShortUrl url) {
// nodes from beginning, counted via a simple depth-first traversal
// in the opposite direction
Traverser t = Traversal.description().depthFirst()
.evaluator(Evaluators.excludeStartPosition())
.relationships(LinkRelationship.SPAWNS, Direction.INCOMING)
.traverse(currentNode);
int nodesFromBeginning = IteratorUtil.count(t);
url.setNodesFromBeginning(nodesFromBeginning);
}
示例7: importInfo
import org.neo4j.helpers.collection.IteratorUtil; //导入方法依赖的package包/类
private static String importInfo() {
GraphDatabaseService db = new GraphDatabaseFactory().newEmbeddedDatabase(STORE_DIR);
try (Transaction tx = db.beginTx()) {
int nodes = IteratorUtil.count(db.getAllNodes());
int rels = IteratorUtil.count(GlobalGraphOperations.at(db).getAllRelationships());
return "Imported nodes " + nodes + " rels " + rels;
} finally {
db.shutdown();
}
}
示例8: importInfo
import org.neo4j.helpers.collection.IteratorUtil; //导入方法依赖的package包/类
private static String importInfo() {
GraphDatabaseService db = new GraphDatabaseFactory().newEmbeddedDatabase(STORE_DIR);
try (Transaction tx = db.beginTx()) {
int nodes = IteratorUtil.count(db.getAllNodes());
int rels = IteratorUtil.count(GlobalGraphOperations.at(db).getAllRelationships());
return "Imported nodes " + nodes + " rels " + rels;
} finally {
db.shutdown();
}
}
示例9: assertImport
import org.neo4j.helpers.collection.IteratorUtil; //导入方法依赖的package包/类
private static String assertImport() {
GraphDatabaseService db = new GraphDatabaseFactory().newEmbeddedDatabase(STORE_DIR);
try (Transaction tx = db.beginTx()) {
int nodes = IteratorUtil.count(db.getAllNodes());
Assert.assertEquals(USERS, nodes);
int rels = IteratorUtil.count(GlobalGraphOperations.at(db).getAllRelationships());
Assert.assertEquals(FRIENDSHIPS, rels);
return "Imported nodes " + nodes + " rels " + rels;
} finally {
db.shutdown();
}
}
示例10: getDocumentSize
import org.neo4j.helpers.collection.IteratorUtil; //导入方法依赖的package包/类
public static int getDocumentSize(GraphDatabaseService db)
{
int documentSize;
String cacheKey = "GLOBAL_DOCUMENT_SIZE";
if(vectorSpaceModelCache.getIfPresent(cacheKey) == null) {
documentSize = IteratorUtil.count(GlobalGraphOperations.at(db).getAllNodesWithLabel(DynamicLabel.label("Class")));
vectorSpaceModelCache.put(cacheKey, documentSize);
}
else
{
documentSize = (Integer)vectorSpaceModelCache.getIfPresent(cacheKey);
}
return documentSize;
}
示例11: getDocumentSizeForFeature
import org.neo4j.helpers.collection.IteratorUtil; //导入方法依赖的package包/类
public static int getDocumentSizeForFeature(GraphDatabaseService db, Long id)
{
int documentSize;
String cacheKey = "DOCUMENT_SIZE_FEATURE_" + id;
if(vectorSpaceModelCache.getIfPresent(cacheKey) == null) {
Node startNode = db.getNodeById(id);
Iterator<Node> classes = db.traversalDescription()
.depthFirst()
.relationships(withName("HAS_CLASS"), Direction.OUTGOING)
.evaluator(Evaluators.fromDepth(1))
.evaluator(Evaluators.toDepth(1))
.traverse(startNode)
.nodes().iterator();
documentSize = IteratorUtil.count(classes);
vectorSpaceModelCache.put(cacheKey, documentSize);
}
else
{
documentSize = (Integer)vectorSpaceModelCache.getIfPresent(cacheKey);
}
return documentSize;
}
示例12: getNumberOfNodes
import org.neo4j.helpers.collection.IteratorUtil; //导入方法依赖的package包/类
@Override
public int getNumberOfNodes() {
return IteratorUtil.count(getAllVertex());
}
示例13: getNumberOfEdges
import org.neo4j.helpers.collection.IteratorUtil; //导入方法依赖的package包/类
@Override
public int getNumberOfEdges() {
return IteratorUtil.count(getAllEdges());
}
示例14: getNumberOfPartitions
import org.neo4j.helpers.collection.IteratorUtil; //导入方法依赖的package包/类
@Override
public int getNumberOfPartitions() {
return IteratorUtil.count(getPartitions());
}
示例15: getSubnetworkFrontierNum
import org.neo4j.helpers.collection.IteratorUtil; //导入方法依赖的package包/类
@Override
public int getSubnetworkFrontierNum(int partition1, int partition2, int num) {
return IteratorUtil.count(getFrontierBetweenPartitions(partition1, partition2, num));
}