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


Java BatchInserterIndexProvider.relationshipIndex方法代码示例

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


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

示例1: getOrCreateIndex

import org.neo4j.unsafe.batchinsert.BatchInserterIndexProvider; //导入方法依赖的package包/类
protected Tuple<BatchInserterIndex, BatchInserterIndexProvider> getOrCreateIndex(final String name, final String property,
                                                                                 final boolean nodeIndex, final int cachSize) {

	final BatchInserterIndexProvider indexProvider = new LuceneBatchInserterIndexProvider(inserter);
	final BatchInserterIndex index;

	if (nodeIndex) {

		index = indexProvider.nodeIndex(name, MapUtil.stringMap("type", "exact"));
	} else {

		index = indexProvider.relationshipIndex(name, MapUtil.stringMap("type", "exact"));
	}

	index.setCacheCapacity(property, cachSize);

	return Tuple.tuple(index, indexProvider);
}
 
开发者ID:dswarm,项目名称:dswarm-graph-neo4j,代码行数:19,代码来源:BatchNeo4jProcessor.java

示例2: run

import org.neo4j.unsafe.batchinsert.BatchInserterIndexProvider; //导入方法依赖的package包/类
public static void run(final String neo4storage,
        final String redisQueueName, final String redisHost) {

    ObelixQueue redisQueueManager = new RedisObelixQueue(redisQueueName, redisHost);

    Label userLabel = DynamicLabel.label("User");
    Label itemLabel = DynamicLabel.label("Item");

    Map<String, Long> usersNodesMap = new HashMap<>();
    Map<String, Long> itemsNodesMap = new HashMap<>();
    Map<String, Long> relationshipsMap = new HashMap<>();

    Map<String, String> config = new HashMap<>();
    config.put("neostore.nodestore.db.mapped_memory", "2G");
    config.put("neostore.relationshipstore.db.mapped_memory", "9G");
    config.put("neostore.propertystore.db.mapped_memory", "800M");
    config.put("neostore.propertystore.db.strings.mapped_memory", "800M");
    config.put("neostore.propertystore.db.arrays.mapped_memory", "500M");

    BatchInserter inserter;

    inserter = BatchInserters.inserter(neo4storage, config);

    BatchInserterIndexProvider indexProvider = new LuceneBatchInserterIndexProvider(inserter);

    registerShutdownHook(inserter, indexProvider);

    BatchInserterIndex usersIndex = indexProvider.nodeIndex("users",
            MapUtil.stringMap("type", "exact"));
    usersIndex.setCacheCapacity("node_id", NEO_CACHE_CAPACITY);

    BatchInserterIndex itemsIndex = indexProvider.nodeIndex("items",
            MapUtil.stringMap("type", "exact"));
    usersIndex.setCacheCapacity("node_id", NEO_CACHE_CAPACITY);

    BatchInserterIndex relationshipIndex = indexProvider.relationshipIndex("relationships",
            MapUtil.stringMap("type", "exact"));
    usersIndex.setCacheCapacity("timestamp", NEO_CACHE_CAPACITY);

    boolean notFinised = true;

    int c = 0;
    while (notFinised) {

        ObelixQueueElement result = redisQueueManager.pop();

        if (result == null) {
            notFinised = false;
        }

        if (result != null) {

            NeoEvent event = getEvent(result.toString());

            if (event == null) {
                continue;
            }

            long userid = getOrCreateUserNodeID(event.getUser(), usersNodesMap,
                    usersIndex, inserter, userLabel);

            long itemid = getOrCreateItemNodeID(event.getItem(), itemsNodesMap,
                    itemsIndex, inserter, itemLabel);


            getOrCreateRelatinshipID(event.getTimestamp(),
                    userid, itemid, relationshipsMap, relationshipIndex,
                    inserter, NeoHelpers.RelTypes.VIEWED);

        }

        c += 1;

        if (c % IMPORTS_BETWEEN_EACH_LOG_MESSAGE == 0) {
            LOGGER.info("Imported " + c);
        }
    }
}
 
开发者ID:inveniosoftware-contrib,项目名称:obelix,代码行数:79,代码来源:ObelixBatchImport.java


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