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


Java JanusGraphFactory类代码示例

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


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


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