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


Java JanusGraph类代码示例

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


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

示例1: EdgeLoaderWorker

import org.janusgraph.core.JanusGraph; //导入依赖的package包/类
public EdgeLoaderWorker(final Iterator<Map<String, String>> records, final Map<String, Object> propertiesMap,
		final JanusGraph graph) {
	super(records, propertiesMap, graph);
	
	this.currentRecord = 0;
	this.defaultEdgeLabel = (String) propertiesMap.get(Constants.EDGE_LABEL_MAPPING);
	this.edgeLabelFieldName = null;
	COMMIT_COUNT = Config.getConfig().getEdgeRecordCommitCount();
	if (propertiesMap.values().contains(Constants.EDGE_LABEL_MAPPING)) {
		for (String propName : propertiesMap.keySet()) {
			if (Constants.EDGE_LABEL_MAPPING.equals(propertiesMap.get(propName))) {
				this.edgeLabelFieldName = propName;
				break;
			}
		}
	}
}
 
开发者ID:tedhtchang,项目名称:JanusGraphBench,代码行数:18,代码来源:EdgeLoaderWorker.java

示例2: EdgeLoaderWorker

import org.janusgraph.core.JanusGraph; //导入依赖的package包/类
public EdgeLoaderWorker(final Iterator<Map<String, String>> records, final Map<String, Object> propertiesMap,
        final JanusGraph graph) {
    super(records, propertiesMap, graph);

    this.currentRecord = 0;
    this.defaultEdgeLabel = (String) propertiesMap.get(Constants.EDGE_LABEL_MAPPING);
    this.edgeLabelFieldName = null;
    COMMIT_COUNT = Config.getConfig().getEdgeRecordCommitCount();
    if (propertiesMap.values().contains(Constants.EDGE_LABEL_MAPPING)) {
        for (String propName : propertiesMap.keySet()) {
            if (Constants.EDGE_LABEL_MAPPING.equals(propertiesMap.get(propName))) {
                this.edgeLabelFieldName = propName;
                break;
            }
        }
    }
}
 
开发者ID:IBM,项目名称:janusgraph-utils,代码行数:18,代码来源:EdgeLoaderWorker.java

示例3: VertexLoaderWorker

import org.janusgraph.core.JanusGraph; //导入依赖的package包/类
public VertexLoaderWorker(final Iterator<Map<String, String>> records, final Map<String, Object> propertiesMap,
        final JanusGraph graph) {
    super(records, propertiesMap, graph);

    this.currentRecord = 0;
    this.defaultVertexLabel = (String) propertiesMap.get(Constants.VERTEX_LABEL_MAPPING);
    this.vertexLabelFieldName = null;

    COMMIT_COUNT = Config.getConfig().getVertexRecordCommitCount();

    if (propertiesMap.values().contains(Constants.VERTEX_LABEL_MAPPING)) {
        // find the vertex
        for (String propName : propertiesMap.keySet()) {
            if (Constants.VERTEX_LABEL_MAPPING.equals(propertiesMap.get(propName))) {
                this.vertexLabelFieldName = propName;
                break;
            }
        }
    }
}
 
开发者ID:IBM,项目名称:janusgraph-utils,代码行数:21,代码来源:VertexLoaderWorker.java

示例4: main

import org.janusgraph.core.JanusGraph; //导入依赖的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

示例5: main

import org.janusgraph.core.JanusGraph; //导入依赖的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

示例6: startWorkers

import org.janusgraph.core.JanusGraph; //导入依赖的package包/类
private void startWorkers(Iterator<CSVRecord> iter, long targetRecordCount, WorkerPool workers)
		throws Exception {
	while (iter.hasNext()) {
		long currentRecord = 0;
		List<Map<String,String>> sub = new ArrayList<Map<String,String>>(); 
		while (iter.hasNext() && currentRecord < targetRecordCount) {
			sub.add(iter.next().toMap());
			currentRecord++;
		}
		Constructor<Worker> constructor = workerClass.getConstructor(Iterator.class, Map.class, JanusGraph.class);
		Worker worker = constructor.newInstance(sub.iterator(), propertiesMap, graph);
		workers.submit(worker);
	}
}
 
开发者ID:tedhtchang,项目名称:JanusGraphBench,代码行数:15,代码来源:DataFileLoader.java

示例7: VertexLoaderWorker

import org.janusgraph.core.JanusGraph; //导入依赖的package包/类
public VertexLoaderWorker(final Iterator<Map<String,String>> records, final Map<String, Object> propertiesMap,
		final JanusGraph graph) {
	super(records, propertiesMap, graph);

	this.currentRecord = 0;
	this.defaultVertexLabel = (String) propertiesMap.get(Constants.VERTEX_LABEL_MAPPING);
	this.vertexLabelFieldName = null;

	COMMIT_COUNT = Config.getConfig().getVertexRecordCommitCount();

	if (propertiesMap.values().contains(Constants.VERTEX_LABEL_MAPPING)) {
		// find the vertex
		for (String propName : propertiesMap.keySet()) {
			if (Constants.VERTEX_LABEL_MAPPING.equals(propertiesMap.get(propName))) {
				this.vertexLabelFieldName = propName;
				break;
			}
		}
	}
}
 
开发者ID:tedhtchang,项目名称:JanusGraphBench,代码行数:21,代码来源:VertexLoaderWorker.java

示例8: SchemaLoader

import org.janusgraph.core.JanusGraph; //导入依赖的package包/类
/**
 * Constructor of JansugraphGSONSchema object with the {@code graph}
 * 
 * @param graph
 *            a JanusGraph and write GraphSON schema into it
 */

public SchemaLoader(JanusGraph graph) {
	if (graph == null) {
		// throw new Exception("JanusGraph is null");
	}
	this.graph = graph;
}
 
开发者ID:tedhtchang,项目名称:JanusGraphBench,代码行数:14,代码来源:SchemaLoader.java

示例9: main

import org.janusgraph.core.JanusGraph; //导入依赖的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

示例10: main

import org.janusgraph.core.JanusGraph; //导入依赖的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

示例11: main

import org.janusgraph.core.JanusGraph; //导入依赖的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

示例12: getGraphWithNewTransaction

import org.janusgraph.core.JanusGraph; //导入依赖的package包/类
@Override
public JanusGraph getGraphWithNewTransaction(JanusGraph graph, boolean batchloading){
    if(graph.isClosed()) graph = buildTinkerPopGraph(batchloading);

    if(!graph.tx().isOpen()){
        graph.tx().open();
    }
    return graph;
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:10,代码来源:TxFactoryJanus.java

示例13: configureGraph

import org.janusgraph.core.JanusGraph; //导入依赖的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

示例14: buildJanusIndexes

import org.janusgraph.core.JanusGraph; //导入依赖的package包/类
private static void buildJanusIndexes(JanusGraph graph) {
    JanusGraphManagement management = graph.openManagement();

    makeVertexLabels(management);
    makeEdgeLabels(management);
    makePropertyKeys(management);

    makeIndicesVertexCentric(management);
    makeIndicesComposite(management);

    management.commit();
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:13,代码来源:TxFactoryJanus.java

示例15: testSingleton

import org.janusgraph.core.JanusGraph; //导入依赖的package包/类
@Test
public void testSingleton(){
    when(session.keyspace()).thenReturn(Keyspace.of("anothertest"));
    TxFactoryJanus factory = new TxFactoryJanus(session);
    GraknTxJanus mg1 = factory.open(GraknTxType.BATCH);
    JanusGraph tinkerGraphMg1 = mg1.getTinkerPopGraph();
    mg1.close();
    GraknTxJanus mg2 = factory.open(GraknTxType.WRITE);
    JanusGraph tinkerGraphMg2 = mg2.getTinkerPopGraph();
    mg2.close();
    GraknTxJanus mg3 = factory.open(GraknTxType.BATCH);

    assertEquals(mg1, mg3);
    assertEquals(tinkerGraphMg1, mg3.getTinkerPopGraph());

    assertTrue(mg1.isBatchTx());
    assertFalse(mg2.isBatchTx());

    assertNotEquals(mg1, mg2);
    assertNotEquals(tinkerGraphMg1, tinkerGraphMg2);

    StandardJanusGraph standardJanusGraph1 = (StandardJanusGraph) tinkerGraphMg1;
    StandardJanusGraph standardJanusGraph2 = (StandardJanusGraph) tinkerGraphMg2;

    assertTrue(standardJanusGraph1.getConfiguration().isBatchLoading());
    assertFalse(standardJanusGraph2.getConfiguration().isBatchLoading());
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:28,代码来源:TxFactoryJanusTest.java


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