本文整理汇总了Java中org.janusgraph.core.JanusGraph类的典型用法代码示例。如果您正苦于以下问题:Java JanusGraph类的具体用法?Java JanusGraph怎么用?Java JanusGraph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JanusGraph类属于org.janusgraph.core包,在下文中一共展示了JanusGraph类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: getGraph
import org.janusgraph.core.JanusGraph; //导入依赖的package包/类
private static JanusGraph getGraph() {
Keyspace name = Keyspace.of("hehe" + UUID.randomUUID().toString().replaceAll("-", ""));
when(session.keyspace()).thenReturn(name);
janusGraphFactory = new TxFactoryJanus(session);
Graph graph = janusGraphFactory.open(GraknTxType.WRITE).getTinkerPopGraph();
assertThat(graph, instanceOf(JanusGraph.class));
return (JanusGraph) graph;
}
开发者ID:graknlabs,项目名称:grakn,代码行数:9,代码来源:TxFactoryJanusTest.java
示例17: process
import org.janusgraph.core.JanusGraph; //导入依赖的package包/类
private static void process(final JanusGraph graph, final Appeared appeared) {
Vertex comicBookVertex = get(graph, COMIC_BOOK, appeared.getComicBook());
if (null == comicBookVertex) {
REGISTRY.counter("error.missingComicBook." + appeared.getComicBook()).inc();
comicBookVertex = graph.addVertex();
comicBookVertex.property(COMIC_BOOK, appeared.getComicBook());
}
Vertex characterVertex = get(graph, CHARACTER, appeared.getCharacter());
if (null == characterVertex) {
REGISTRY.counter("error.missingCharacter." + appeared.getCharacter()).inc();
characterVertex = graph.addVertex();
characterVertex.property(CHARACTER, appeared.getCharacter());
characterVertex.property(WEAPON, WEAPONS.get(RANDOM.nextInt(WEAPONS.size())));
}
characterVertex.addEdge(APPEARED, comicBookVertex);
}
开发者ID:awslabs,项目名称:dynamodb-janusgraph-storage-backend,代码行数:17,代码来源:MarvelGraphFactory.java
示例18: get
import org.janusgraph.core.JanusGraph; //导入依赖的package包/类
private static Vertex get(final JanusGraph graph, final String key, final String value) {
final GraphTraversalSource g = graph.traversal();
final Iterator<Vertex> it = g.V().has(key, value);
if (it.hasNext()) {
return it.next();
}
return null;
}
开发者ID:awslabs,项目名称:dynamodb-janusgraph-storage-backend,代码行数:9,代码来源:MarvelGraphFactory.java
示例19: createHotelSchema
import org.janusgraph.core.JanusGraph; //导入依赖的package包/类
private static void createHotelSchema(final JanusGraph graph) {
//another issue, you should only try to create the schema once.
//you use uniqueness constraints, so you need to define the schema up front with the unique() call,
//but if you did not use uniqueness constraints, you could just let JanusGraph create the schema for you.
final JanusGraphManagement mgmt = graph.openManagement();
final PropertyKey brandtypePropertyKey = mgmt.makePropertyKey("brandtype").dataType(String.class).make();
mgmt.buildIndex("brandtypeIndex", Vertex.class).addKey(brandtypePropertyKey).unique().buildCompositeIndex();
final PropertyKey namePropertyKey = mgmt.makePropertyKey("name").dataType(String.class).make();
mgmt.buildIndex("nameIndex", Vertex.class).addKey(namePropertyKey).unique().buildCompositeIndex();
mgmt.makeEdgeLabel(Relationship.hotelBrandType.name()).multiplicity(Multiplicity.MANY2ONE).make();
mgmt.makeEdgeLabel(Relationship.instanceOf.name()).multiplicity(Multiplicity.MANY2ONE).make();
mgmt.commit();
}
开发者ID:awslabs,项目名称:dynamodb-janusgraph-storage-backend,代码行数:14,代码来源:ScenarioTests.java
示例20: loadData
import org.janusgraph.core.JanusGraph; //导入依赖的package包/类
protected static void loadData(final JanusGraph graph, final int numLines) throws Exception {
Preconditions.checkArgument(numLines >= 1, "Need to test with at least one line");
// it takes a long time to process all 100,000 lines so we can
// run a subset as a unit test.
final int lines = Integer.valueOf(System.getProperty("MarvelTestLines", String.valueOf(numLines)));
MarvelGraphFactory.load(graph, lines, false /*report*/);
}
开发者ID:awslabs,项目名称:dynamodb-janusgraph-storage-backend,代码行数:8,代码来源:MarvelTest.java
注:本文中的org.janusgraph.core.JanusGraph类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论