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

Java TitanManagement类代码示例

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

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



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


示例4: 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,项目名称:titan1withtp3.1,代码行数:19,代码来源:EdgeSerializerTest.java


示例5: SchemaContainer

import com.thinkaurelius.titan.core.schema.TitanManagement; //导入依赖的package包/类
public SchemaContainer(TitanGraph graph) {
    vertexLabels = Maps.newHashMap();
    relationTypes = Maps.newHashMap();
    TitanManagement mgmt = graph.openManagement();

    try {
        for (VertexLabel vl : mgmt.getVertexLabels()) {
            VertexLabelDefinition vld = new VertexLabelDefinition(vl);
            vertexLabels.put(vld.getName(),vld);
        }

        for (EdgeLabel el : mgmt.getRelationTypes(EdgeLabel.class)) {
            EdgeLabelDefinition eld = new EdgeLabelDefinition(el);
            relationTypes.put(eld.getName(),eld);
        }
        for (PropertyKey pk : mgmt.getRelationTypes(PropertyKey.class)) {
            PropertyKeyDefinition pkd = new PropertyKeyDefinition(pk);
            relationTypes.put(pkd.getName(), pkd);
        }
    } finally {
        mgmt.rollback();
    }

}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:25,代码来源:SchemaContainer.java


示例6: Titan1Graph

import com.thinkaurelius.titan.core.schema.TitanManagement; //导入依赖的package包/类
public Titan1Graph() {
    //determine multi-properties once at startup
    TitanManagement mgmt = null;
    try {
        mgmt = Titan1GraphDatabase.getGraphInstance().openManagement();
        Iterable<PropertyKey> keys = mgmt.getRelationTypes(PropertyKey.class);
        multiProperties = new HashSet<>();
        for (PropertyKey key : keys) {
            if (key.cardinality() != Cardinality.SINGLE) {
                multiProperties.add(key.name());
            }
        }
    } finally {
        if (mgmt != null) {
            mgmt.rollback();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:19,代码来源:Titan1Graph.java


示例7: Titan0Graph

import com.thinkaurelius.titan.core.schema.TitanManagement; //导入依赖的package包/类
public Titan0Graph() {
    //determine multi-properties once at startup
    TitanManagement mgmt = null;
    try {
        mgmt = Titan0GraphDatabase.getGraphInstance().getManagementSystem();
        Iterable<PropertyKey> keys = mgmt.getRelationTypes(PropertyKey.class);
        multiProperties = Collections.synchronizedSet(new HashSet<String>());
        for(PropertyKey key : keys) {
            if (key.getCardinality() != Cardinality.SINGLE) {
                multiProperties.add(key.getName());
            }
        }
    } finally {
        if (mgmt != null) {
            mgmt.rollback();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:19,代码来源:Titan0Graph.java


示例8: validateIndexBackend

import com.thinkaurelius.titan.core.schema.TitanManagement; //导入依赖的package包/类
static void validateIndexBackend(Configuration config) {
    String configuredIndexBackend = config.getString(INDEX_BACKEND_CONF);
    TitanManagement managementSystem = null;

    try {
        managementSystem = getGraphInstance().getManagementSystem();
        String currentIndexBackend = managementSystem.get(INDEX_BACKEND_CONF);

        if (!equals(configuredIndexBackend, currentIndexBackend)) {
            throw new RuntimeException("Configured Index Backend " + configuredIndexBackend
                    + " differs from earlier configured Index Backend " + currentIndexBackend + ". Aborting!");
        }

    } finally {
        if (managementSystem != null) {
            managementSystem.commit();
        }
    }


}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:22,代码来源:Titan0GraphDatabase.java


示例9: 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


示例10: 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


示例11: 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


示例12: 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


示例13: SchemaContainer

import com.thinkaurelius.titan.core.schema.TitanManagement; //导入依赖的package包/类
public SchemaContainer(TitanGraph graph) {
    vertexLabels = Maps.newHashMap();
    relationTypes = Maps.newHashMap();
    TitanManagement mgmt = graph.getManagementSystem();

    try {
        for (VertexLabel vl : mgmt.getVertexLabels()) {
            VertexLabelDefinition vld = new VertexLabelDefinition(vl);
            vertexLabels.put(vld.getName(),vld);
        }

        for (EdgeLabel el : mgmt.getRelationTypes(EdgeLabel.class)) {
            EdgeLabelDefinition eld = new EdgeLabelDefinition(el);
            relationTypes.put(eld.getName(),eld);
        }
        for (PropertyKey pk : mgmt.getRelationTypes(PropertyKey.class)) {
            PropertyKeyDefinition pkd = new PropertyKeyDefinition(pk);
            relationTypes.put(pkd.getName(), pkd);
        }
    } finally {
        mgmt.rollback();
    }

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


示例14: prepareIndices

import com.thinkaurelius.titan.core.schema.TitanManagement; //导入依赖的package包/类
protected void prepareIndices(String... keys)
  {
    // https://groups.google.com/forum/#!topic/aureliusgraphs/lGA3Ye4RI5E
    // transactional scope difference between management and graph
    if (Tools.isSet(keys))
    {
      TitanManagement m = G.getManagementSystem();

      for (String key : keys)
        prepareCompositeIndex(m, key);
//      makeStrKeys(m, ACC,NAME,ORGANISM,SUBCELOC,LABEL,DB,TYPE,PROTEIN,GENE,TERM,PATHWAY,MOLTYPE,EVIDENCE,ENTRY,PROTID);
//      m.buildIndex("byAcc",  Vertex.class).addKey(getStrKey(ACC) ).buildCompositeIndex();
//      m.buildIndex("byName", Vertex.class).addKey(getStrKey(NAME)).buildCompositeIndex();
      m.commit();
    }
  }
 
开发者ID:wyu,项目名称:molgraph,代码行数:17,代码来源:TitanHandler.java


示例15: 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


示例16: 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


示例17: getOrCreatePropertyKey

import com.thinkaurelius.titan.core.schema.TitanManagement; //导入依赖的package包/类
private static PropertyKey getOrCreatePropertyKey(final String keyName, final Class<?> keyType,
        final TitanManagement mgmt) {
    PropertyKey propertyKey = mgmt.getPropertyKey(keyName);
    if (null == propertyKey) {
        propertyKey = mgmt.makePropertyKey(keyName).dataType(keyType).make();
    }
    return propertyKey;
}
 
开发者ID:eclipse,项目名称:keti,代码行数:9,代码来源:GraphConfig.java


示例18: 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


示例19: 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


示例20: testReservedNamesRejectedForEdgeLabels

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java New类代码示例发布时间:2022-05-21
下一篇:
Java ModuleBuilder类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap