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

Java Neo4jGraph类代码示例

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

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



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

示例1: getBaseConfiguration

import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph; //导入依赖的package包/类
@Override
public Map<String, Object> getBaseConfiguration(final String graphName, final Class<?> test, final String testMethodName, final LoadGraphWith.GraphData graphData) {
    final String directory = makeTestDirectory(graphName, test, testMethodName);

    return new HashMap<String, Object>() {{
        put(Graph.GRAPH, Neo4jGraph.class.getName());
        put(Neo4jGraph.CONFIG_DIRECTORY, directory);
        put(Neo4jGraph.CONFIG_META_PROPERTIES, true);
        put(Neo4jGraph.CONFIG_MULTI_PROPERTIES, true);
    }};
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:12,代码来源:MultiMetaNeo4jGraphProvider.java


示例2: clear

import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph; //导入依赖的package包/类
@Override
public void clear(final Graph graph, final Configuration configuration) throws Exception {
    if (null != graph) {
        if (graph.tx().isOpen()) graph.tx().rollback();
        graph.close();
    }

    if (configuration.containsKey(Neo4jGraph.CONFIG_DIRECTORY)) {
        // this is a non-in-sideEffects configuration so blow away the directory
        final File graphDirectory = new File(configuration.getString(Neo4jGraph.CONFIG_DIRECTORY));
        deleteDirectory(graphDirectory);
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:14,代码来源:AbstractNeo4jGraphProvider.java


示例3: dropIndices

import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph; //导入依赖的package包/类
public static void dropIndices(final Neo4jGraph graph, final LoadGraphWith.GraphData graphData) {
    if (graphData.equals(LoadGraphWith.GraphData.GRATEFUL)) {
        graph.tx().readWrite();
        graph.cypher("DROP INDEX ON :artist(name)").iterate();
        graph.cypher("DROP INDEX ON :song(name)").iterate();
        graph.cypher("DROP INDEX ON :song(songType)").iterate();
        graph.cypher("DROP INDEX ON :song(performances)").iterate();
        graph.tx().commit();
    } else if (graphData.equals(LoadGraphWith.GraphData.MODERN)) {
        graph.tx().readWrite();
        graph.cypher("DROP INDEX ON :person(name)").iterate();
        graph.cypher("DROP INDEX ON :person(age)").iterate();
        graph.cypher("DROP INDEX ON :software(name)").iterate();
        graph.cypher("DROP INDEX ON :software(lang)").iterate();
        graph.tx().commit();
    } else if (graphData.equals(LoadGraphWith.GraphData.CLASSIC)) {
        graph.tx().readWrite();
        graph.cypher("DROP INDEX ON :vertex(name)").iterate();
        graph.cypher("DROP INDEX ON :vertex(age)").iterate();
        graph.cypher("DROP INDEX ON :vertex(lang)").iterate();
        graph.tx().commit();
    } else {
        // TODO: add CREW work here.
        // TODO: add meta_property indices when meta_property graph is provided
        //throw new RuntimeException("Could not load graph with " + graphData);
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:28,代码来源:AbstractNeo4jGraphProvider.java


示例4: getBaseConfiguration

import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph; //导入依赖的package包/类
@Override
public Map<String, Object> getBaseConfiguration(final String graphName, final Class<?> test, final String testMethodName, final LoadGraphWith.GraphData graphData) {
    final String directory = makeTestDirectory(graphName, test, testMethodName);

    return new HashMap<String, Object>() {{
        put(Graph.GRAPH, Neo4jGraph.class.getName());
        put(Neo4jGraph.CONFIG_DIRECTORY, directory);
        put(Neo4jGraph.CONFIG_META_PROPERTIES, false);
        put(Neo4jGraph.CONFIG_MULTI_PROPERTIES, false);
    }};
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:12,代码来源:NoMultiNoMetaNeo4jGraphProvider.java


示例5: getStorage

import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph; //导入依赖的package包/类
private static Storage getStorage(AntiochConfiguration config) {
  String dataDir = config.getStorageDirectory() + "/neo4jdb";
  createWhenAbsent(dataDir);
  try {
    graph = Neo4jGraph.open(dataDir);
  } catch (Exception e) {
    e.printStackTrace();
    throw new RuntimeException("There was an error starting up the Neo4J graph; If this was caused by an interrupted indexing job, restarting the server might help.");
  }
  setIndexes();
  return new Storage(graph);
}
 
开发者ID:HuygensING,项目名称:antioch,代码行数:13,代码来源:Neo4JService.java


示例6: setGraphProvider

import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph; //导入依赖的package包/类
@BeforeClass
public static void setGraphProvider() throws IOException {
    GraphTest.graphProvider = new GraphProvider() {
        public Graph getGraph() throws IOException {
            return Neo4jGraph.open(folder.newFolder().getAbsolutePath());
        }
    };
}
 
开发者ID:bayofmany,项目名称:peapod,代码行数:9,代码来源:Neo4JSuite.java


示例7: getBaseConfiguration

import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph; //导入依赖的package包/类
@Override
public Map<String, Object> getBaseConfiguration(final String graphName, final Class<?> test, final String testMethodName, final LoadGraphWith.GraphData graphData) {
    final String directory = makeTestDirectory(graphName, test, testMethodName);

    return new HashMap<String, Object>() {{
        put(Graph.GRAPH, Neo4jGraph.class.getName());
        put(Neo4jGraph.CONFIG_DIRECTORY, directory);
        put(Neo4jGraph.CONFIG_META_PROPERTIES, true);
        put(Neo4jGraph.CONFIG_MULTI_PROPERTIES, true);
        put(Neo4jGraph.CONFIG_CONF + ".dbms.memory.pagecache.size", "1m");
    }};
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:13,代码来源:MultiMetaNeo4jGraphProvider.java


示例8: getBaseConfiguration

import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph; //导入依赖的package包/类
@Override
public Map<String, Object> getBaseConfiguration(final String graphName, final Class<?> test, final String testMethodName, final LoadGraphWith.GraphData graphData) {
    final String directory = makeTestDirectory(graphName, test, testMethodName);

    return new HashMap<String, Object>() {{
        put(Graph.GRAPH, Neo4jGraph.class.getName());
        put(Neo4jGraph.CONFIG_DIRECTORY, directory);
        put(Neo4jGraph.CONFIG_META_PROPERTIES, false);
        put(Neo4jGraph.CONFIG_MULTI_PROPERTIES, false);
        put(Neo4jGraph.CONFIG_CONF + ".dbms.memory.pagecache.size", "1m");
    }};
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:13,代码来源:NoMultiNoMetaNeo4jGraphProvider.java


示例9: generateTestParameters

import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph; //导入依赖的package包/类
@Parameterized.Parameters(name = "{0}")
public static Iterable<Object[]> generateTestParameters() {
    final int LAZY_SIZE = 2500;
    return Arrays.asList(new Object[][]{
            {__.V().out(), g_V().out(), Collections.emptyList()},
            {__.V().has("name", "marko").out(), g_V("name", eq("marko")).out(), Collections.emptyList()},
            {__.V().has("name", "marko").has("age", gt(31).and(lt(10))).out(),
                    g_V("name", eq("marko"), "age", gt(31), "age", lt(10)).out(), Collections.emptyList()},
            {__.V().has("name", "marko").or(has("age"), has("age", gt(32))).has("lang", "java"),
                    g_V("name", eq("marko"), "lang", eq("java")).or(has("age"), has("age", gt(32))), Collections.singletonList(FilterRankingStrategy.instance())},
            {__.V().has("name", "marko").as("a").or(has("age"), has("age", gt(32))).has("lang", "java"),
                    g_V("name", eq("marko")).as("a").or(has("age"), has("age", gt(32))).has("lang", "java"), Collections.emptyList()},
            {__.V().has("name", "marko").as("a").or(has("age"), has("age", gt(32))).has("lang", "java"),
                    g_V("name", eq("marko"), "lang", eq("java")).or(has("age"), has("age", gt(32))).as("a"), Collections.singletonList(FilterRankingStrategy.instance())},
            {__.V().dedup().has("name", "marko").or(has("age"), has("age", gt(32))).has("lang", "java"),
                    g_V("name", eq("marko"), "lang", eq("java")).or(has("age"), has("age", gt(32))).dedup(), Collections.singletonList(FilterRankingStrategy.instance())},
            {__.V().as("a").dedup().has("name", "marko").or(has("age"), has("age", gt(32))).has("lang", "java"),
                    g_V("name", eq("marko"), "lang", eq("java")).or(has("age"), has("age", gt(32))).dedup().as("a"), Collections.singletonList(FilterRankingStrategy.instance())},
            {__.V().as("a").has("name", "marko").as("b").or(has("age"), has("age", gt(32))).has("lang", "java"),
                    g_V("name", eq("marko"), "lang", eq("java")).or(has("age"), has("age", gt(32))).as("b", "a"), Collections.singletonList(FilterRankingStrategy.instance())},
            {__.V().as("a").dedup().has("name", "marko").or(has("age"), has("age", gt(32))).filter(has("name", "bob")).has("lang", "java"),
                    g_V("name", eq("marko"), "lang", eq("java"), "name", eq("bob")).or(has("age"), has("age", gt(32))).dedup().as("a"), Arrays.asList(InlineFilterStrategy.instance(), FilterRankingStrategy.instance())},
            {__.V().as("a").dedup().has("name", "marko").or(has("age", 10), has("age", gt(32))).filter(has("name", "bob")).has("lang", "java"),
                    g_V("name", eq("marko"), "lang", eq("java"), "name", eq("bob"), "age", eq(10).or(gt(32))).dedup().as("a"), TraversalStrategies.GlobalCache.getStrategies(Neo4jGraph.class).toList()},
            {__.V().has("name", "marko").or(not(has("age")), has("age", gt(32))).has("name", "bob").has("lang", "java"),
                    g_V("name", eq("marko"), "name", eq("bob"), "lang", eq("java")).or(not(filter(properties("age"))), has("age", gt(32))), TraversalStrategies.GlobalCache.getStrategies(Neo4jGraph.class).toList()},
            {__.V().has("name", P.eq("marko").or(P.eq("bob").and(P.eq("stephen")))).out("knows"),
                    g_V("name", eq("marko").or(P.eq("bob").and(P.eq("stephen")))).out("knows"), Collections.emptyList()},
            {__.V().has("name", P.eq("marko").and(P.eq("bob").and(P.eq("stephen")))).out("knows"),
                    g_V("name", eq("marko"), "name", eq("bob"), "name", eq("stephen")).out("knows"), Collections.emptyList()},
            {__.V().has("name", P.eq("marko").and(P.eq("bob").or(P.eq("stephen")))).out("knows"),
                    g_V("name", eq("marko"), "name", P.eq("bob").or(eq("stephen"))).out("knows"), Collections.emptyList()},
            ///////
            {__.V().out().out().V().has("name", "marko").out(), g_V().out().barrier(LAZY_SIZE).out().barrier(LAZY_SIZE).asAdmin().addStep(V("name", eq("marko"))).barrier(LAZY_SIZE).out(), Arrays.asList(InlineFilterStrategy.instance(), FilterRankingStrategy.instance(), LazyBarrierStrategy.instance())},
            {__.V().out().out().V().has("name", "marko").as("a").out(), g_V().out().barrier(LAZY_SIZE).out().barrier(LAZY_SIZE).asAdmin().addStep(V("name", eq("marko"))).barrier(LAZY_SIZE).as("a").out(), Arrays.asList(InlineFilterStrategy.instance(), FilterRankingStrategy.instance(), LazyBarrierStrategy.instance())},
            {__.V().out().V().has("age", gt(32)).barrier(10).has("name", "marko").as("a"), g_V().out().barrier(LAZY_SIZE).asAdmin().addStep(V("age", gt(32), "name", eq("marko"))).barrier(LAZY_SIZE).barrier(10).as("a"), Arrays.asList(InlineFilterStrategy.instance(), FilterRankingStrategy.instance(), LazyBarrierStrategy.instance())},
            {__.V().out().V().has("age", gt(32)).barrier(10).has("name", "marko").as("a"), g_V().out().barrier(LAZY_SIZE).asAdmin().addStep(V("age", gt(32), "name", eq("marko"))).barrier(LAZY_SIZE).barrier(10).as("a"), TraversalStrategies.GlobalCache.getStrategies(Neo4jGraph.class).toList()},
    });
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:40,代码来源:Neo4jGraphStepStrategyTest.java


示例10: getOrCreateGraph

import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph; //导入依赖的package包/类
private static Neo4jGraph getOrCreateGraph(final GraphDatabaseService database) {
    if (neo4jGraph == null) {
        synchronized (LOCK) {
            if (neo4jGraph == null) {
                final Neo4jGraphAPI neo4jGraphAPI = new Neo4jGraphAPIImpl(database);
                neo4jGraph = Neo4jGraph.open(neo4jGraphAPI);
            }
        }
    }
    return neo4jGraph;
}
 
开发者ID:thinkaurelius,项目名称:neo4j-gremlin-plugin,代码行数:12,代码来源:GremlinPlugin.java


示例11: start

import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph; //导入依赖的package包/类
@Override
public void start() throws Exception {
  synchronized (graphWaitList) {
    initGraphDatabaseService();
    this.graph = Neo4jGraph.open(new Neo4jGraphAPIImpl(graphDatabase));
    new DatabaseMigrator(this, migrations).execute();
    callWaiters();
  }
}
 
开发者ID:HuygensING,项目名称:timbuctoo,代码行数:10,代码来源:TinkerPopGraphManager.java


示例12: build

import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph; //导入依赖的package包/类
public Neo4jGraph build() {
  //When creating a new database you have to close the previous one, because
  //each database will create a new thread. This fills up the available
  //threads when running thousands of tests.
  //
  //Closing the database is very slow however (testruns go from less then a
  //second to 3 minutes on a machine with an SSD) so instead we now re-use
  //the same neo4j database that we clear when the function to create a new
  //one is called.
  if (neo4jDb == reusableNeo4jDb) {
    if (trans != null) {
      trans.close();
    }
    cleanDb(neo4jDb);
  }
  Neo4jGraphAPIImpl neo4jGraphApi = new Neo4jGraphAPIImpl(neo4jDb);
  Neo4jGraph neo4jGraph = Neo4jGraph.open(neo4jGraphApi);

  try (org.apache.tinkerpop.gremlin.structure.Transaction tx = neo4jGraph.tx()) {
    final List<RelationData> requestedRelations = new LinkedList<>();
    final Map<String, Vertex> identifiableVertices = new HashMap<>();
    //Create all identifiable vertices
    graphFragmentBuilders.forEach(
      builder -> {
        Tuple<Vertex, String> result = builder.build(neo4jGraph, requestedRelations::add);
        identifiableVertices.put(result.getRight(), result.getLeft());
      }
    );
    //then we can create the relations between them
    requestedRelations.forEach(
      relationData -> relationData.makeRelation(identifiableVertices)
    );
    tx.commit();
  }

  if (neo4jDb == reusableNeo4jDb) { //we're re-using the database
    trans = neo4jDb.beginTx(); //make sure we own the toplevel transaction so are guaranteed to close it
  }
  return neo4jGraph;
}
 
开发者ID:HuygensING,项目名称:timbuctoo,代码行数:41,代码来源:TestGraphBuilder.java


示例13: vertices

import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph; //导入依赖的package包/类
private Iterator<? extends Vertex> vertices() {
    final Neo4jGraph graph = (Neo4jGraph) this.getTraversal().getGraph().get();
    return graph.getTrait().lookupVertices(graph, this.hasContainers, this.ids);
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:5,代码来源:Neo4jGraphStep.java


示例14: Neo4jCypherIterator

import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph; //导入依赖的package包/类
public Neo4jCypherIterator(final Iterator<Map<String, T>> iterator, final Neo4jGraph graph) {
    this.iterator = iterator;
    this.graph = graph;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:5,代码来源:Neo4jCypherIterator.java


示例15: loadGraphData

import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph; //导入依赖的package包/类
@Override
public void loadGraphData(final Graph graph, final LoadGraphWith loadGraphWith, final Class testClass, final String testName) {
    if (loadGraphWith != null) this.createIndices((Neo4jGraph) graph, loadGraphWith.value());
    super.loadGraphData(graph, loadGraphWith, testClass, testName);
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:6,代码来源:AbstractNeo4jGraphProvider.java


示例16: createIndices

import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph; //导入依赖的package包/类
private void createIndices(final Neo4jGraph graph, final LoadGraphWith.GraphData graphData) {
    final Random random = new Random();
    final boolean pick = random.nextBoolean();
    if (graphData.equals(LoadGraphWith.GraphData.GRATEFUL)) {
        if (pick) {
            graph.tx().readWrite();
            if (random.nextBoolean())
                graph.cypher("CREATE INDEX ON :artist(name)").iterate();
            if (random.nextBoolean())
                graph.cypher("CREATE INDEX ON :song(name)").iterate();
            if (random.nextBoolean())
                graph.cypher("CREATE INDEX ON :song(songType)").iterate();
            if (random.nextBoolean())
                graph.cypher("CREATE INDEX ON :song(performances)").iterate();
            graph.tx().commit();
        } // else no indices
    } else if (graphData.equals(LoadGraphWith.GraphData.MODERN)) {
        if (pick) {
            graph.tx().readWrite();
            if (random.nextBoolean())
                graph.cypher("CREATE INDEX ON :person(name)").iterate();
            if (random.nextBoolean())
                graph.cypher("CREATE INDEX ON :person(age)").iterate();
            if (random.nextBoolean())
                graph.cypher("CREATE INDEX ON :software(name)").iterate();
            if (random.nextBoolean()) {
                graph.cypher("CREATE INDEX ON :software(lang)").iterate();
            }
            graph.tx().commit();
        } // else no indices
    } else if (graphData.equals(LoadGraphWith.GraphData.CLASSIC)) {
        if (pick) {
            graph.tx().readWrite();
            if (random.nextBoolean())
                graph.cypher("CREATE INDEX ON :vertex(name)").iterate();
            if (random.nextBoolean())
                graph.cypher("CREATE INDEX ON :vertex(age)").iterate();
            if (random.nextBoolean())
                graph.cypher("CREATE INDEX ON :vertex(lang)").iterate();
            graph.tx().commit();
        } // else no indices
    } else {
        // TODO: add CREW work here.
        // TODO: add meta_property indices when meta_property graph is provided
        //throw new RuntimeException("Could not load graph with " + graphData);
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:48,代码来源:AbstractNeo4jGraphProvider.java


示例17: getGraph

import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph; //导入依赖的package包/类
protected Neo4jGraph getGraph() {
    return (Neo4jGraph) this.graph;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:4,代码来源:AbstractNeo4jGremlinTest.java


示例18: getBaseGraph

import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph; //导入依赖的package包/类
protected Neo4jGraphAPI getBaseGraph() {
    return ((Neo4jGraph) this.graph).getBaseGraph();
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:4,代码来源:AbstractNeo4jGremlinTest.java


示例19: vertices

import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph; //导入依赖的package包/类
private Iterator<? extends Vertex> vertices() {
    if (null == this.ids)
        return Collections.emptyIterator();
    final Neo4jGraph graph = (Neo4jGraph) this.getTraversal().getGraph().get();
    return graph.getTrait().lookupVertices(graph, this.hasContainers, this.ids);
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:7,代码来源:Neo4jGraphStep.java


示例20: TestableTinkerPopGraphManager

import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph; //导入依赖的package包/类
public TestableTinkerPopGraphManager(GraphDatabaseService graphDatabaseService, Neo4jGraph graph) {
  super(new TinkerPopConfig(), new LinkedHashMap<>());
  this.graphDatabase = graphDatabaseService;
  this.graph = graph;
}
 
开发者ID:HuygensING,项目名称:timbuctoo,代码行数:6,代码来源:TestableTinkerPopGraphManager.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java StreamSchema类代码示例发布时间:2022-05-22
下一篇:
Java Mode类代码示例发布时间: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