• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JanusGraphFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.janusgraph.core.JanusGraphFactory的典型用法代码示例。如果您正苦于以下问题:Java JanusGraphFactory类的具体用法?Java JanusGraphFactory怎么用?Java JanusGraphFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



JanusGraphFactory类属于org.janusgraph.core包,在下文中一共展示了JanusGraphFactory类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: clear

import org.janusgraph.core.JanusGraphFactory; //导入依赖的package包/类
@Override
public void clear()
{
    if (this.graph == null)
        return;
    if (this.graph.isOpen())
        close();

    try
    {
        JanusGraphFactory.drop(this.graph);
    }
    catch (Exception e)
    {
        LOG.log(Level.WARNING, "Failed to delete graph due to: " + e.getMessage(), e);
    }
}
 
开发者ID:windup,项目名称:windup,代码行数:18,代码来源:GraphContextImpl.java


示例2: main

import org.janusgraph.core.JanusGraphFactory; //导入依赖的package包/类
public static void main(String[] args) {

        if (null == args || args.length < 2) {
            System.err.println("Usage: SchemaLoader <janusgraph-config-file> <schema-file>");
            System.exit(1);
        }

        String configFile = args[0];
        String schemaFile = args[1];

        // use custom or default config file to get JanusGraph
        JanusGraph g = JanusGraphFactory.open(configFile);

        try {
            new SchemaLoader().loadSchema(g, schemaFile);
        } catch (Exception e) {
            System.out.println("Failed to import schema due to " + e.getMessage());
        } finally {
            g.close();
        }

    }
 
开发者ID:IBM,项目名称:janusgraph-utils,代码行数:23,代码来源:SchemaLoader.java


示例3: main

import org.janusgraph.core.JanusGraphFactory; //导入依赖的package包/类
public static void main(String args[]) throws Exception {

        if (null == args || args.length < 4) {
            System.err.println(
                    "Usage: BatchImport <janusgraph-config-file> <data-files-directory> <schema.json> <data-mapping.json> [skipSchema]");
            System.exit(1);
        }

        JanusGraph graph = JanusGraphFactory.open(args[0]);
        if (!(args.length > 4 && args[4].equals("skipSchema")))
            new SchemaLoader().loadSchema(graph, args[2]);
        new DataLoader(graph).loadVertex(args[1], args[3]);
        new DataLoader(graph).loadEdges(args[1], args[3]);
        graph.close();
    }
 
开发者ID:IBM,项目名称:janusgraph-utils,代码行数:16,代码来源:BatchImport.java


示例4: main

import org.janusgraph.core.JanusGraphFactory; //导入依赖的package包/类
public static void main(String args[]) throws Exception {

        if (null == args || args.length < 4) {
            System.err.println("Usage: BatchImport <janusgraph-config-file> <data-files-directory> <schema.json> <data-mapping.json>");
            System.exit(1);
        }

        JanusGraph graph = JanusGraphFactory.open(args[0]);
        new SchemaLoader(graph).loadFile(args[2]);
        new DataLoader(graph).loadVertex(args[1], args[3]);
        new DataLoader(graph).loadEdges(args[1], args[3]);
        graph.close();
    }
 
开发者ID:tedhtchang,项目名称:JanusGraphBench,代码行数:14,代码来源:BatchImport.java


示例5: workerIterationStart

import org.janusgraph.core.JanusGraphFactory; //导入依赖的package包/类
@Override
public void workerIterationStart(final Memory memory) {
  LOGGER.info("workerIterationStart");
  // TODO: add method in GraphEtl that allows us to simply copy from config to properties.
  graph = JanusGraphFactory.open(configuration);
  g = graph.traversal();
  sevenDaysAgo = (new Date()).getTime() - (1000 * 60 * 60 * 24 * 7);
  count = 0;
  min = -10;
  max = 0;
}
 
开发者ID:marcelocf,项目名称:janusgraph_tutorial,代码行数:12,代码来源:ComputeWeightVertexProgram.java


示例6: CreateWeightIndex

import org.janusgraph.core.JanusGraphFactory; //导入依赖的package包/类
/**
 * Initialize the graph and the graph management interface.
 *
 * @param configFile
 */
public CreateWeightIndex(String configFile) {
  LOGGER.info("Connecting graph");
  graph = JanusGraphFactory.open(configFile);
  LOGGER.info("Getting management");
  mgt = graph.openManagement();
}
 
开发者ID:marcelocf,项目名称:janusgraph_tutorial,代码行数:12,代码来源:CreateWeightIndex.java


示例7: main

import org.janusgraph.core.JanusGraphFactory; //导入依赖的package包/类
public static void main(String argv[]) throws Exception {
  JanusGraph graph = JanusGraphFactory.open(Schema.CONFIG_FILE);
  HadoopQueryRunner q = new HadoopQueryRunner(graph.traversal(), "testUser1");
  int runs = 10;

  for(int i =0; i < runs; i++) {
    LOGGER.info("New timeline (run {} of {})", i+1, runs);
    q.printTimeline(q.getTimeline3(10));
  }
  q.close();
  graph.close();
}
 
开发者ID:marcelocf,项目名称:janusgraph_tutorial,代码行数:13,代码来源:NewTimeline.java


示例8: main

import org.janusgraph.core.JanusGraphFactory; //导入依赖的package包/类
public static void main(String argv[]) throws Exception {
  JanusGraph graph = JanusGraphFactory.open(Schema.CONFIG_FILE);
  HadoopQueryRunner q = new HadoopQueryRunner(graph.traversal(), "testUser1");
  int runs = 10;

  for(int i =0; i < runs; i++) {
    LOGGER.info("Previous timeline (run {} of {})", i+1, runs);
    q.printTimeline(q.getTimeline2(10));
  }
  q.close();
  graph.close();
}
 
开发者ID:marcelocf,项目名称:janusgraph_tutorial,代码行数:13,代码来源:OldTimeline.java


示例9: CreateSupernodes

import org.janusgraph.core.JanusGraphFactory; //导入依赖的package包/类
/**
 * Initialize the graph connection.
 *
 * @param configFile
 */
public CreateSupernodes(String configFile) throws Exception {
  graph = JanusGraphFactory.open(configFile);
  faker = new Faker();
  queryRunner = new QueryRunner(graph.traversal(), "test");

  Calendar cal = Calendar.getInstance();
  cal.add(Calendar.YEAR, -1);
  oneYearAgo = cal.getTime();
}
 
开发者ID:marcelocf,项目名称:janusgraph_tutorial,代码行数:15,代码来源:CreateSupernodes.java


示例10: LoadData

import org.janusgraph.core.JanusGraphFactory; //导入依赖的package包/类
/**
 * Initialize the graph connection.
 *
 * @param configFile
 */
public LoadData(String configFile) {
  graph = JanusGraphFactory.open(configFile);
  faker = new Faker();

  Calendar cal = Calendar.getInstance();
  cal.add(Calendar.MONTH, -1);
  oneMonthAgo = cal.getTime();
}
 
开发者ID:marcelocf,项目名称:janusgraph_tutorial,代码行数:14,代码来源:LoadData.java


示例11: configureGraph

import org.janusgraph.core.JanusGraphFactory; //导入依赖的package包/类
private JanusGraph configureGraph(boolean batchLoading){
    JanusGraphFactory.Builder builder = JanusGraphFactory.build().
            set("storage.hostname", session().uri()).
            set("storage.cassandra.keyspace", session().keyspace().getValue()).
            set("storage.batch-loading", batchLoading);

    String storageBackend = "storage.backend";

    //Load Defaults
    DEFAULT_PROPERTIES.forEach((key, value) -> builder.set(key.toString(), value));

    //Load Passed in properties
    session().config().properties().forEach((key, value) -> {

        //Overwrite storage
        if(key.equals(storageBackend)){
            value = storageBackendMapper.get(value);
        }

        //Inject properties into other default properties
        if(overrideMap.containsKey(key)){
            builder.set(overrideMap.get(key), value);
        }

        builder.set(key.toString(), value);
    });



    LOG.debug("Opening graph on {}", session().uri());
    return builder.open();
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:33,代码来源:TxFactoryJanus.java


示例12: performanceTest

import org.janusgraph.core.JanusGraphFactory; //导入依赖的package包/类
/**
 * This test is to demonstrate performance in response to a report of elevated latency for committing 30 vertices.
 * http://stackoverflow.com/questions/42899388/titan-dynamodb-local-incredibly-slow-8s-commit-for-30-vertices
 * @throws BackendException in case cleanUpTables fails
 */
@Test
public void performanceTest() throws BackendException {
    final Graph graph = JanusGraphFactory.open(TestGraphUtil.instance.createTestGraphConfig(BackendDataModel.MULTI));
    IntStream.of(30).forEach(i -> graph.addVertex(LABEL));
    final Stopwatch watch = Stopwatch.createStarted();
    graph.tx().commit();
    System.out.println("Committing took " + watch.stop().elapsed(TimeUnit.MILLISECONDS) + " ms");
    TestGraphUtil.instance.cleanUpTables();
}
 
开发者ID:awslabs,项目名称:dynamodb-janusgraph-storage-backend,代码行数:15,代码来源:ScenarioTests.java


示例13: tripleIngestBase

import org.janusgraph.core.JanusGraphFactory; //导入依赖的package包/类
private void tripleIngestBase(final BiConsumer<StandardJanusGraph, List<Triple>> writer) throws BackendException {
    final Stopwatch watch = Stopwatch.createStarted();
    final StandardJanusGraph graph = (StandardJanusGraph) JanusGraphFactory.open(TestGraphUtil.instance.createTestGraphConfig(BackendDataModel.MULTI));
    log.info("Created graph in " + watch.elapsed(TimeUnit.MILLISECONDS) + " ms");
    watch.reset();
    watch.start();
    createHotelSchema(graph);
    log.info("Created schema in " + watch.elapsed(TimeUnit.MILLISECONDS) + " ms");

    watch.reset();
    watch.start();
    final URL url = ScenarioTests.class.getClassLoader().getResource("META-INF/HotelTriples.txt");
    Preconditions.checkNotNull(url);
    final List<Triple> lines;
    try (CSVReader reader = new CSVReader(new InputStreamReader(url.openStream()))) {
        lines = reader.readAll().stream()
            .map(Triple::new)
            .collect(Collectors.toList());
    } catch (IOException e) {
        throw new IllegalStateException("Error processing triple file", e);
    }
    log.info("Read file into Triple objects in " + watch.elapsed(TimeUnit.MILLISECONDS) + " ms");
    watch.reset();
    watch.start();
    writer.accept(graph, lines);
    log.info("Added objects in " + watch.elapsed(TimeUnit.MILLISECONDS) + " ms");
    TestGraphUtil.instance.cleanUpTables();
}
 
开发者ID:awslabs,项目名称:dynamodb-janusgraph-storage-backend,代码行数:29,代码来源:ScenarioTests.java


示例14: main

import org.janusgraph.core.JanusGraphFactory; //导入依赖的package包/类
public static void main(String[] args) {
    JanusGraph graph = JanusGraphFactory.open("conf/janusgraph-berkeleyje-lucene.properties");
    GraphTraversalSource g = graph.traversal();
    if (g.V().count().next() == 0) {
        // load the schema and graph data
        GraphOfTheGodsFactory.load(graph);
    }
    Map<String, ?> saturnProps = g.V().has("name", "saturn").valueMap(true).next();
    LOGGER.info(saturnProps.toString());
    List<Edge> places = g.E().has("place", Geo.geoWithin(Geoshape.circle(37.97, 23.72, 50))).toList();
    LOGGER.info(places.toString());
    System.exit(0);
}
 
开发者ID:pluradj,项目名称:janusgraph-java-example,代码行数:14,代码来源:JavaExample.java


示例15: main

import org.janusgraph.core.JanusGraphFactory; //导入依赖的package包/类
/**
 * Run every example query, outputting results via @LOGGER
 *
 * @param argv
 * @throws Exception
 */
public static void main(String[] argv) throws Exception {
  JanusGraph graph = JanusGraphFactory.open(Schema.CONFIG_FILE);
  GraphTraversalSource graphTraversalSource = graph.traversal();

  QueryRunner queryRunner = new QueryRunner(graphTraversalSource, "testUser0");

  LOGGER.info("Initialized the builtin query executor");

  queryRunner.runQueries();

  queryRunner.close();

  graph.close();

  System.exit(0);
}
 
开发者ID:marcelocf,项目名称:janusgraph_tutorial,代码行数:23,代码来源:BuiltinQueries.java


示例16: initializeJanusGraph

import org.janusgraph.core.JanusGraphFactory; //导入依赖的package包/类
private JanusGraph initializeJanusGraph(boolean createMode)
{
    LOG.fine("Initializing graph.");

    Path lucene = graphDir.resolve("graphsearch");
    Path berkeley = graphDir.resolve("titangraph");

    // TODO: Externalize this.
    conf = new BaseConfiguration();

    // Sets a unique id in order to fix WINDUP-697. This causes Titan to not attempt to generate and ID,
    // as the Titan id generation code fails on machines with broken network configurations.
    conf.setProperty("graph.unique-instance-id", "windup_" + System.nanoTime() + "_" + RandomStringUtils.randomAlphabetic(6));
    conf.setProperty("storage.directory", berkeley.toAbsolutePath().toString());
    conf.setProperty("storage.backend", "berkeleyje");

    // Sets the berkeley cache to a relatively small value to reduce the memory footprint.
    // This is actually more important than performance on some of the smaller machines out there, and
    // the performance decrease seems to be minimal.
    conf.setProperty("storage.berkeleydb.cache-percentage", 1);

    // Set READ UNCOMMITTED to improve performance
    conf.setProperty("storage.berkeleydb.lock-mode", LockMode.READ_UNCOMMITTED);
    conf.setProperty("storage.berkeleydb.isolation-level", BerkeleyJEStoreManager.IsolationLevel.READ_UNCOMMITTED);

    // Increase storage write buffer since we basically do a large bulk load during the first phases.
    // See http://s3.thinkaurelius.com/docs/titan/current/bulk-loading.html
    conf.setProperty("storage.buffer-size", "4096");

    // Turn off transactions to improve performance
    conf.setProperty("storage.transactions", false);

    conf.setProperty("ids.block-size", 25000);
    // conf.setProperty("ids.flush", true);
    // conf.setProperty("", false);

    //
    // turn on a db-cache that persists across txn boundaries, but make it relatively small
    conf.setProperty("cache.db-cache", true);
    conf.setProperty("cache.db-cache-clean-wait", 0);
    conf.setProperty("cache.db-cache-size", .09);
    conf.setProperty("cache.db-cache-time", 0);

    conf.setProperty("index.search.backend", "lucene");
    conf.setProperty("index.search.directory", lucene.toAbsolutePath().toString());

    writeToPropertiesFile(conf, graphDir.resolve("TitanConfiguration.properties").toFile());
    JanusGraph janusGraph = JanusGraphFactory.open(conf);

    /*
     * We only need to setup the eventing system when initializing a graph, not when loading it later for
     * reporting.
     */
    if (createMode)
    {
        TraversalStrategies graphStrategies = TraversalStrategies.GlobalCache
                .getStrategies(StandardJanusGraph.class)
                .clone();

        // Remove any old listeners
        if (graphStrategies.getStrategy(EventStrategy.class) != null)
            graphStrategies.removeStrategies(EventStrategy.class);

        graphStrategies.addStrategies(EventStrategy.build().addListener(mutationListener).create());
        TraversalStrategies.GlobalCache.registerStrategies(StandardJanusGraph.class, graphStrategies);
        mutationListener.setGraph(this);
    }
    return janusGraph;
}
 
开发者ID:windup,项目名称:windup,代码行数:70,代码来源:GraphContextImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java KeyDescriptor类代码示例发布时间:2022-05-22
下一篇:
Java KewApiServiceLocator类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap