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


Java IteratorUtil.count方法代码示例

本文整理汇总了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);

}
 
开发者ID:rafaelmss,项目名称:GraphClustering,代码行数:17,代码来源:NetworkNeo4j.java

示例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;
}
 
开发者ID:socialsensor,项目名称:graphdb-benchmarks,代码行数:21,代码来源:Neo4jGraphDatabase.java

示例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;
}
 
开发者ID:socialsensor,项目名称:graphdb-benchmarks,代码行数:22,代码来源:Neo4jGraphDatabase.java

示例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);
}
 
开发者ID:rafaelmss,项目名称:GraphClustering,代码行数:10,代码来源:NetworkNeo4j.java

示例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 ) );
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:30,代码来源:TestLuceneIndex.java

示例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);
}
 
开发者ID:Glamdring,项目名称:welshare,代码行数:11,代码来源:ViralLinkDaoNeo4j.java

示例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();
    }
}
 
开发者ID:jexp,项目名称:neo4j-rdbms-import,代码行数:11,代码来源:DataImporterNorthwindTest.java

示例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();
    }
}
 
开发者ID:jexp,项目名称:neo4j-rdbms-import,代码行数:12,代码来源:DataImporterSakilaTest.java

示例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();
    }
}
 
开发者ID:jexp,项目名称:neo4j-rdbms-import,代码行数:14,代码来源:DataImporterTest.java

示例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;
}
 
开发者ID:Graphify,项目名称:graphify,代码行数:15,代码来源:VectorUtil.java

示例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;
}
 
开发者ID:Graphify,项目名称:graphify,代码行数:29,代码来源:VectorUtil.java

示例12: getNumberOfNodes

import org.neo4j.helpers.collection.IteratorUtil; //导入方法依赖的package包/类
@Override
public int getNumberOfNodes() {
    return IteratorUtil.count(getAllVertex());
}
 
开发者ID:rafaelmss,项目名称:GraphClustering,代码行数:5,代码来源:NetworkNeo4j.java

示例13: getNumberOfEdges

import org.neo4j.helpers.collection.IteratorUtil; //导入方法依赖的package包/类
@Override
public int getNumberOfEdges() {
    return IteratorUtil.count(getAllEdges());
}
 
开发者ID:rafaelmss,项目名称:GraphClustering,代码行数:5,代码来源:NetworkNeo4j.java

示例14: getNumberOfPartitions

import org.neo4j.helpers.collection.IteratorUtil; //导入方法依赖的package包/类
@Override
public int getNumberOfPartitions() {
    return IteratorUtil.count(getPartitions());
}
 
开发者ID:rafaelmss,项目名称:GraphClustering,代码行数:5,代码来源:NetworkNeo4j.java

示例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));
}
 
开发者ID:rafaelmss,项目名称:GraphClustering,代码行数:5,代码来源:NetworkNeo4j.java


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