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


Java TitanManagement.commit方法代码示例

本文整理汇总了Java中com.thinkaurelius.titan.core.schema.TitanManagement.commit方法的典型用法代码示例。如果您正苦于以下问题:Java TitanManagement.commit方法的具体用法?Java TitanManagement.commit怎么用?Java TitanManagement.commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.thinkaurelius.titan.core.schema.TitanManagement的用法示例。


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

示例1: createUniqueCompositeIndex

import com.thinkaurelius.titan.core.schema.TitanManagement; //导入方法依赖的package包/类
public static void createUniqueCompositeIndex(final Graph newGraph, final String indexName,
        final String[] propertyKeyNames, final Class<?> propertyKeyType) throws InterruptedException {

    Assert.notEmpty(propertyKeyNames);
    newGraph.tx().rollback(); // Never create new indexes while a transaction is active
    TitanManagement mgmt = ((TitanGraph) newGraph).openManagement();
    IndexBuilder indexBuilder = mgmt.buildIndex(indexName, Vertex.class);
    if (!mgmt.containsGraphIndex(indexName)) {
        for (String propertyKeyName : propertyKeyNames) {
            PropertyKey indexPropertyKey = getOrCreatePropertyKey(propertyKeyName, propertyKeyType, mgmt);
            indexBuilder.addKey(indexPropertyKey);
        }
        indexBuilder.unique().buildCompositeIndex();
    }
    mgmt.commit();
    // Wait for the index to become available
    ManagementSystem.awaitGraphIndexStatus((TitanGraph) newGraph, indexName).status(SchemaStatus.ENABLED).call();
}
 
开发者ID:eclipse,项目名称:keti,代码行数:19,代码来源:GraphConfig.java

示例2: loadGraphData

import com.thinkaurelius.titan.core.schema.TitanManagement; //导入方法依赖的package包/类
@Override
public void loadGraphData(final Graph g, final LoadGraphWith loadGraphWith, final Class testClass, final String testName) {
    if (loadGraphWith != null) {
        this.createIndices((TitanGraph) g, loadGraphWith.value());
    } else {
        if (TransactionTest.class.equals(testClass) && testName.equalsIgnoreCase("shouldExecuteWithCompetingThreads")) {
            TitanManagement mgmt = ((TitanGraph) g).openManagement();
            mgmt.makePropertyKey("blah").dataType(Double.class).make();
            mgmt.makePropertyKey("bloop").dataType(Integer.class).make();
            mgmt.makePropertyKey("test").dataType(Object.class).make();
            mgmt.makeEdgeLabel("friend").make();
            mgmt.commit();
        }
    }
    super.loadGraphData(g, loadGraphWith, testClass, testName);
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:17,代码来源:AbstractTitanGraphProvider.java

示例3: testValueOrdering

import com.thinkaurelius.titan.core.schema.TitanManagement; //导入方法依赖的package包/类
@Test
public void testValueOrdering() {
    StandardTitanGraph graph = (StandardTitanGraph) StorageSetup.getInMemoryGraph();
    TitanManagement mgmt = graph.openManagement();
    EdgeLabel father = mgmt.makeEdgeLabel("father").multiplicity(Multiplicity.MANY2ONE).make();
    for (int i=1;i<=5;i++) mgmt.makePropertyKey("key" + i).dataType(Integer.class).make();
    mgmt.commit();

    TitanVertex v1 = graph.addVertex(), v2 = graph.addVertex();
    TitanEdge e1 = v1.addEdge("father",v2);
    for (int i=1;i<=5;i++) e1.property("key"+i,i);

    graph.tx().commit();

    e1.remove();
    graph.tx().commit();

}
 
开发者ID:graben1437,项目名称:titan1.0.1.kafka,代码行数:19,代码来源:EdgeSerializerTest.java

示例4: clopen

import com.thinkaurelius.titan.core.schema.TitanManagement; //导入方法依赖的package包/类
public void clopen(Object... settings) {
    config = getConfiguration();
    if (mgmt!=null && mgmt.isOpen()) mgmt.rollback();
    if (null != tx && tx.isOpen()) tx.commit();
    if (settings!=null && settings.length>0) {
        Map<TestConfigOption,Object> options = validateConfigOptions(settings);
        TitanManagement gconf = null;
        ModifiableConfiguration lconf = new ModifiableConfiguration(GraphDatabaseConfiguration.ROOT_NS,config, BasicConfiguration.Restriction.LOCAL);
        for (Map.Entry<TestConfigOption,Object> option : options.entrySet()) {
            if (option.getKey().option.isLocal()) {
                lconf.set(option.getKey().option,option.getValue(),option.getKey().umbrella);
            } else {
                if (gconf==null) gconf = graph.openManagement();
                gconf.set(ConfigElement.getPath(option.getKey().option,option.getKey().umbrella),option.getValue());
            }
        }
        if (gconf!=null) gconf.commit();
        lconf.close();
    }
    if (null != graph && graph.isOpen())
        graph.close();
    Preconditions.checkNotNull(config);
    open(config);
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:25,代码来源:TitanGraphBaseTest.java

示例5: testCanReadListValuedProperty

import com.thinkaurelius.titan.core.schema.TitanManagement; //导入方法依赖的package包/类
@Test
public void testCanReadListValuedProperty() throws Exception {
    TitanGraph tg = TitanFactory.open(getTitanConfiguration());

    TitanManagement mgmt = tg.getManagementSystem();
    mgmt.makePropertyKey("email").dataType(String.class).cardinality(com.thinkaurelius.titan.core.Cardinality.LIST).make();
    mgmt.commit();
    tg.commit();

    TitanVertex v = tg.addVertex();
    v.addProperty("email", "one");
    v.addProperty("email", "two");
    tg.commit();

    Configuration c = new Configuration();
    c.set("titan.hadoop.input.format", "com.thinkaurelius.titan.hadoop.formats.cassandra.TitanCassandraInputFormat");
    c.set("titan.hadoop.input.conf.storage.backend", "cassandrathrift");
    c.set("titan.hadoop.input.conf.storage.cassandra.keyspace", KEYSPACE_NAME);
    c.set("titan.hadoop.sideeffect.format", "org.apache.hadoop.mapreduce.lib.output.TextOutputFormat");
    c.set("titan.hadoop.output.format", "com.thinkaurelius.titan.hadoop.formats.graphson.GraphSONOutputFormat");
    c.set("cassandra.input.partitioner.class", "org.apache.cassandra.dht.Murmur3Partitioner");

    HadoopGraph hg = new HadoopGraph(c);

    assertEquals(0, new HadoopPipeline(hg).V().map().submit());
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:27,代码来源:TitanCassandraInputFormatTest.java

示例6: testValueOrdering

import com.thinkaurelius.titan.core.schema.TitanManagement; //导入方法依赖的package包/类
@Test
public void testValueOrdering() {
    StandardTitanGraph graph = (StandardTitanGraph) StorageSetup.getInMemoryGraph();
    TitanManagement mgmt = graph.getManagementSystem();
    EdgeLabel father = mgmt.makeEdgeLabel("father").multiplicity(Multiplicity.MANY2ONE).make();
    for (int i=1;i<=5;i++) mgmt.makePropertyKey("key" + i).dataType(Integer.class).make();
    mgmt.commit();

    TitanVertex v1 = graph.addVertex(null), v2 = graph.addVertex(null);
    TitanEdge e1 = v1.addEdge("father",v2);
    for (int i=1;i<=5;i++) e1.setProperty("key"+i,i);

    graph.commit();

    e1.remove();
    graph.commit();

}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:19,代码来源:EdgeSerializerTest.java

示例7: testUnidirectionEdges

import com.thinkaurelius.titan.core.schema.TitanManagement; //导入方法依赖的package包/类
@Test
    public void testUnidirectionEdges() throws Exception {
        // Declare schema in Titan
        TitanManagement mgmt = g.getManagementSystem();
        mgmt.makeEdgeLabel("father").unidirected().make();
        mgmt.commit();

//        // Reload schema from Titan into Faunus's Type Manager
//        FaunusTypeManager.getTypeManager(null).clear();
//        SchemaProvider titanSchemaProvider = new SchemaContainer(g);
//        FaunusTypeManager typeManager = FaunusTypeManager.getTypeManager(null); //argument is ignored
//        typeManager.setSchemaProvider(titanSchemaProvider);

        bulkLoadGraphOfTheGods(f1);
        clopen();
        assertEquals(12, new GremlinPipeline(g).V().count());
        assertEquals(17, new GremlinPipeline(g).E().count());
        assertEquals(new GremlinPipeline(g).V("name", "hercules").out("father").count(), 1);
        assertEquals(new GremlinPipeline(g).V("name", "jupiter").in("father").count(), 0);

//        // Reset/clear types to avoid interference with subsequent tests
//        typeManager.clear();
//        typeManager.setSchemaProvider(DefaultSchemaProvider.INSTANCE);
    }
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:25,代码来源:TitanOutputFormatTest.java

示例8: testCompetingThreads

import com.thinkaurelius.titan.core.schema.TitanManagement; //导入方法依赖的package包/类
@Override
public void testCompetingThreads() {
    TitanBlueprintsGraph graph = (TitanBlueprintsGraph) graphTest.generateGraph();
    //Need to define types before hand to avoid deadlock in transactions

    TitanManagement mgmt = graph.getManagementSystem();
    mgmt.makeEdgeLabel("friend").make();
    mgmt.makePropertyKey("test").dataType(Long.class).make();
    mgmt.makePropertyKey("blah").dataType(Float.class).make();
    mgmt.makePropertyKey("bloop").dataType(Integer.class).make();


    mgmt.commit();
    graph.shutdown();
    super.testCompetingThreads();
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:17,代码来源:TransactionalTitanGraphTestSuite.java

示例9: createIndex

import com.thinkaurelius.titan.core.schema.TitanManagement; //导入方法依赖的package包/类
public static void createIndex(final Graph newGraph, final String indexName, final String indexKey)
        throws InterruptedException {
    newGraph.tx().rollback(); // Never create new indexes while a transaction is active
    TitanManagement mgmt = ((TitanGraph) newGraph).openManagement();
    if (!mgmt.containsGraphIndex(indexName)) {
        PropertyKey indexPropertyKey = mgmt.makePropertyKey(indexKey).dataType(String.class).make();
        mgmt.buildIndex(indexName, Vertex.class).addKey(indexPropertyKey).buildCompositeIndex();
    }
    mgmt.commit();
    // Wait for the index to become available
    ManagementSystem.awaitGraphIndexStatus((TitanGraph) newGraph, indexName).status(SchemaStatus.ENABLED).call();
}
 
开发者ID:eclipse,项目名称:keti,代码行数:13,代码来源:GraphConfig.java

示例10: createUniqueIndexForLabel

import com.thinkaurelius.titan.core.schema.TitanManagement; //导入方法依赖的package包/类
public static void createUniqueIndexForLabel(final Graph newGraph, final String indexName, final String indexKey,
        final String label) throws InterruptedException {
    newGraph.tx().rollback(); // Never create new indexes while a transaction is active
    TitanManagement mgmt = ((TitanGraph) newGraph).openManagement();
    if (!mgmt.containsGraphIndex(indexName)) {
        PropertyKey indexPropertyKey = mgmt.makePropertyKey(indexKey).dataType(Integer.class).make();
        VertexLabel versionLabel = mgmt.makeVertexLabel(label).make();
        // Create a unique composite index for the property key that indexes only vertices with a given label
        mgmt.buildIndex(indexName, Vertex.class).addKey(indexPropertyKey).indexOnly(versionLabel).unique()
                .buildCompositeIndex();
    }
    mgmt.commit();
    // Wait for the index to become available
    ManagementSystem.awaitGraphIndexStatus((TitanGraph) newGraph, indexName).status(SchemaStatus.ENABLED).call();
}
 
开发者ID:eclipse,项目名称:keti,代码行数:16,代码来源:GraphConfig.java

示例11: createEdgeIndex

import com.thinkaurelius.titan.core.schema.TitanManagement; //导入方法依赖的package包/类
public static void createEdgeIndex(final Graph newGraph, final String indexName, final String label,
        final String indexKey) throws InterruptedException {
    newGraph.tx().rollback(); // Never create new indexes while a transaction is active
    TitanManagement mgmt = ((TitanGraph) newGraph).openManagement();
    EdgeLabel edgeLabel = mgmt.getOrCreateEdgeLabel(label);
    if (!mgmt.containsRelationIndex(edgeLabel, indexName)) {
        PropertyKey indexPropertyKey = getOrCreatePropertyKey(indexKey, String.class, mgmt);
        mgmt.buildEdgeIndex(edgeLabel, indexName, Direction.OUT, indexPropertyKey);
    }
    mgmt.commit();
    // Wait for the index to become available
    ManagementSystem.awaitRelationIndexStatus((TitanGraph) newGraph, indexName, label).status(SchemaStatus.ENABLED)
            .call();
}
 
开发者ID:eclipse,项目名称:keti,代码行数:15,代码来源:GraphConfig.java

示例12: testReservedNamesRejectedForPropertyKeys

import com.thinkaurelius.titan.core.schema.TitanManagement; //导入方法依赖的package包/类
@Test
public void testReservedNamesRejectedForPropertyKeys() {
    for (String s : ILLEGAL_USER_DEFINED_NAMES) {
        TitanManagement tm = graph.openManagement();
        try {
            tm.makePropertyKey(s);
            Assert.fail("Property key  \"" + s + "\" must be rejected");
        } catch (IllegalArgumentException e) {
            log.debug("Caught expected exception", e);
        } finally {
            tm.commit();
        }
    }
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:15,代码来源:ManagementTest.java

示例13: testGraphQueryForEdges

import com.thinkaurelius.titan.core.schema.TitanManagement; //导入方法依赖的package包/类
@Override
public void testGraphQueryForEdges() {
    TitanGraph g = (TitanGraph) graphTest.generateGraph();
    if (g.getRelationType("weight") == null) {
        TitanManagement mgmt = g.getManagementSystem();
        mgmt.makePropertyKey("weight").dataType(Double.class).cardinality(Cardinality.SINGLE).make();
        mgmt.commit();
    }
    g.shutdown();
    super.testGraphQueryForEdges();
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:12,代码来源:TitanGraphQueryTestSuite.java

示例14: testIncrementalVertexPropertyLoad

import com.thinkaurelius.titan.core.schema.TitanManagement; //导入方法依赖的package包/类
@Test
public void testIncrementalVertexPropertyLoad() throws Exception {
    TitanManagement mgmt = g.getManagementSystem();
    mgmt.makePropertyKey("type").dataType(String.class).cardinality(Cardinality.LIST).make();
    mgmt.makePropertyKey("heads").dataType(Integer.class).cardinality(Cardinality.LIST).make();
    mgmt.commit();

    // Reload schema from Titan into Faunus's Type Manager
    FaunusSchemaManager.getTypeManager(null).clear();
    SchemaProvider titanSchemaProvider = new SchemaContainer(g);
    FaunusSchemaManager typeManager = FaunusSchemaManager.getTypeManager(null); //argument is ignored
    typeManager.setSchemaProvider(titanSchemaProvider);


    bulkLoadGraphOfTheGods(f1);
    clopen();
    assertEquals(12, new GremlinPipeline(g).V().count());
    assertEquals(17, new GremlinPipeline(g).E().count());
    assertEquals(1, new GremlinPipeline(g).V("name", "jupiter").count());
    assertEquals(1, new GremlinPipeline(g).V("name", "cerberus").has("type", "monster").count());
    assertEquals(1, Iterators.size(((TitanVertex) Iterables.getOnlyElement(g.getVertices("name", "cerberus"))).getProperties("type").iterator()));
    assertEquals(0, Iterators.size(((TitanVertex) Iterables.getOnlyElement(g.getVertices("name", "cerberus"))).getProperties("heads").iterator()));

    // Incrementally load a new Cerberus property by defining getOrCreateVertex and getOrCreateVertexProperty
    bulkLoadGraphOfTheGods(getCustomIncrementalCerberusLoad());
    clopen();

    assertEquals(1, new GremlinPipeline(g).V("name", "cerberus").has("type", "monster").count());
    assertEquals(1, Iterators.size(((TitanVertex) Iterables.getOnlyElement(g.getVertices("name", "cerberus"))).getProperties("type").iterator()));
    assertEquals(1, Iterators.size(((TitanVertex) Iterables.getOnlyElement(g.getVertices("name", "cerberus"))).getProperties("heads").iterator()));

    // Control case: define getOrCreateVertex, but omit getOrCreateVertexProperty
    // This should lead to a single Cerberus vertex with two values for the type property
    bulkLoadGraphOfTheGods(getNaiveIncrementalCerberusLoad());
    clopen();
    assertEquals(1, new GremlinPipeline(g).V("name", "cerberus").has("type", "monster").count());
    assertEquals(2, Iterators.size(((TitanVertex) Iterables.getOnlyElement(g.getVertices("name", "cerberus"))).getProperties("type").iterator()));
    assertEquals(2, Iterators.size(((TitanVertex) Iterables.getOnlyElement(g.getVertices("name", "cerberus"))).getProperties("heads").iterator()));
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:40,代码来源:TitanOutputFormatTest.java

示例15: testRemoveGraphIndex

import com.thinkaurelius.titan.core.schema.TitanManagement; //导入方法依赖的package包/类
@Test
public void testRemoveGraphIndex() throws InterruptedException, BackendException, ExecutionException {
    tx.commit();
    mgmt.commit();

    // Load the "Graph of the Gods" sample data
    GraphOfTheGodsFactory.loadWithoutMixedIndex(graph, true);

    // Disable the "name" composite index
    TitanManagement m = graph.openManagement();
    TitanGraphIndex nameIndex = m.getGraphIndex("name");
    m.updateIndex(nameIndex, SchemaAction.DISABLE_INDEX);
    m.commit();
    graph.tx().commit();

    // Block until the SchemaStatus transitions to DISABLED
    assertTrue(ManagementSystem.awaitGraphIndexStatus(graph, "name")
            .status(SchemaStatus.DISABLED).call().getSucceeded());

    // Remove index
    MapReduceIndexManagement mri = new MapReduceIndexManagement(graph);
    m = graph.openManagement();
    TitanGraphIndex index = m.getGraphIndex("name");
    ScanMetrics metrics = mri.updateIndex(index, SchemaAction.REMOVE_INDEX).get();

    assertEquals(12, metrics.getCustom(IndexRemoveJob.DELETED_RECORDS_COUNT));
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:28,代码来源:AbstractIndexManagementIT.java


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