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


Java TypeDefinitionMap类代码示例

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


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

示例1: createMixedIndex

import com.thinkaurelius.titan.graphdb.types.TypeDefinitionMap; //导入依赖的package包/类
private TitanGraphIndex createMixedIndex(String indexName, ElementCategory elementCategory,
                                         TitanSchemaType constraint, String backingIndex) {
    Preconditions.checkArgument(graph.getIndexSerializer().containsIndex(backingIndex), "Unknown external index backend: %s", backingIndex);
    checkIndexName(indexName);

    TypeDefinitionMap def = new TypeDefinitionMap();
    def.setValue(TypeDefinitionCategory.INTERNAL_INDEX, false);
    def.setValue(TypeDefinitionCategory.ELEMENT_CATEGORY, elementCategory);
    def.setValue(TypeDefinitionCategory.BACKING_INDEX, backingIndex);
    def.setValue(TypeDefinitionCategory.INDEXSTORE_NAME, indexName);
    def.setValue(TypeDefinitionCategory.INDEX_CARDINALITY, Cardinality.LIST);
    def.setValue(TypeDefinitionCategory.STATUS, SchemaStatus.ENABLED);
    TitanSchemaVertex indexVertex = transaction.makeSchemaVertex(TitanSchemaCategory.GRAPHINDEX, indexName, def);

    Preconditions.checkArgument(constraint == null || (elementCategory.isValidConstraint(constraint) && constraint instanceof TitanSchemaVertex));
    if (constraint != null) {
        addSchemaEdge(indexVertex, (TitanSchemaVertex) constraint, TypeDefinitionCategory.INDEX_SCHEMA_CONSTRAINT, null);
    }
    updateSchemaVertex(indexVertex);
    return new TitanGraphIndexWrapper(indexVertex.asIndexType());
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:22,代码来源:ManagementSystem.java

示例2: createMixedIndex

import com.thinkaurelius.titan.graphdb.types.TypeDefinitionMap; //导入依赖的package包/类
private TitanGraphIndex createMixedIndex(String indexName, ElementCategory elementCategory,
                                         TitanSchemaType constraint, String backingIndex) {
    Preconditions.checkArgument(graph.getIndexSerializer().containsIndex(backingIndex),"Unknown external index backend: %s",backingIndex);
    checkIndexName(indexName);

    TypeDefinitionMap def = new TypeDefinitionMap();
    def.setValue(TypeDefinitionCategory.INTERNAL_INDEX,false);
    def.setValue(TypeDefinitionCategory.ELEMENT_CATEGORY,elementCategory);
    def.setValue(TypeDefinitionCategory.BACKING_INDEX,backingIndex);
    def.setValue(TypeDefinitionCategory.INDEXSTORE_NAME,indexName);
    def.setValue(TypeDefinitionCategory.INDEX_CARDINALITY, Cardinality.LIST);
    def.setValue(TypeDefinitionCategory.STATUS,SchemaStatus.ENABLED);
    TitanSchemaVertex indexVertex = transaction.makeSchemaVertex(TitanSchemaCategory.GRAPHINDEX,indexName,def);

    Preconditions.checkArgument(constraint==null || (elementCategory.isValidConstraint(constraint) && constraint instanceof TitanSchemaVertex));
    if (constraint!=null) {
        addSchemaEdge(indexVertex,(TitanSchemaVertex)constraint,TypeDefinitionCategory.INDEX_SCHEMA_CONSTRAINT,null);
    }
    updateSchemaVertex(indexVertex);
    return new TitanGraphIndexWrapper(indexVertex.asIndexType());
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:22,代码来源:ManagementSystem.java

示例3: createCompositeIndex

import com.thinkaurelius.titan.graphdb.types.TypeDefinitionMap; //导入依赖的package包/类
private TitanGraphIndex createCompositeIndex(String indexName, ElementCategory elementCategory, boolean unique, TitanSchemaType constraint, PropertyKey... keys) {
    checkIndexName(indexName);
    Preconditions.checkArgument(keys != null && keys.length > 0, "Need to provide keys to index [%s]", indexName);
    Preconditions.checkArgument(!unique || elementCategory == ElementCategory.VERTEX, "Unique indexes can only be created on vertices [%s]", indexName);
    boolean allSingleKeys = true;
    boolean oneNewKey = false;
    for (PropertyKey key : keys) {
        Preconditions.checkArgument(key != null && key instanceof PropertyKeyVertex, "Need to provide valid keys: %s", key);
        if (key.cardinality() != Cardinality.SINGLE) allSingleKeys = false;
        if (key.isNew()) oneNewKey = true;
        else updatedTypes.add((PropertyKeyVertex) key);
    }

    Cardinality indexCardinality;
    if (unique) indexCardinality = Cardinality.SINGLE;
    else indexCardinality = (allSingleKeys ? Cardinality.SET : Cardinality.LIST);

    TypeDefinitionMap def = new TypeDefinitionMap();
    def.setValue(TypeDefinitionCategory.INTERNAL_INDEX, true);
    def.setValue(TypeDefinitionCategory.ELEMENT_CATEGORY, elementCategory);
    def.setValue(TypeDefinitionCategory.BACKING_INDEX, Token.INTERNAL_INDEX_NAME);
    def.setValue(TypeDefinitionCategory.INDEXSTORE_NAME, indexName);
    def.setValue(TypeDefinitionCategory.INDEX_CARDINALITY, indexCardinality);
    def.setValue(TypeDefinitionCategory.STATUS, oneNewKey ? SchemaStatus.ENABLED : SchemaStatus.INSTALLED);
    TitanSchemaVertex indexVertex = transaction.makeSchemaVertex(TitanSchemaCategory.GRAPHINDEX, indexName, def);
    for (int i = 0; i < keys.length; i++) {
        Parameter[] paras = {ParameterType.INDEX_POSITION.getParameter(i)};
        addSchemaEdge(indexVertex, keys[i], TypeDefinitionCategory.INDEX_FIELD, paras);
    }

    Preconditions.checkArgument(constraint == null || (elementCategory.isValidConstraint(constraint) && constraint instanceof TitanSchemaVertex));
    if (constraint != null) {
        addSchemaEdge(indexVertex, (TitanSchemaVertex) constraint, TypeDefinitionCategory.INDEX_SCHEMA_CONSTRAINT, null);
    }
    updateSchemaVertex(indexVertex);
    TitanGraphIndexWrapper index = new TitanGraphIndexWrapper(indexVertex.asIndexType());
    if (!oneNewKey) updateIndex(index, SchemaAction.REGISTER_INDEX);
    return index;
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:40,代码来源:ManagementSystem.java

示例4: createCompositeIndex

import com.thinkaurelius.titan.graphdb.types.TypeDefinitionMap; //导入依赖的package包/类
private TitanGraphIndex createCompositeIndex(String indexName, ElementCategory elementCategory, boolean unique, TitanSchemaType constraint, PropertyKey... keys) {
    checkIndexName(indexName);
    Preconditions.checkArgument(keys!=null && keys.length>0,"Need to provide keys to index [%s]",indexName);
    Preconditions.checkArgument(!unique || elementCategory==ElementCategory.VERTEX,"Unique indexes can only be created on vertices [%s]",indexName);
    boolean allSingleKeys = true;
    boolean oneNewKey = false;
    for (PropertyKey key : keys) {
        Preconditions.checkArgument(key!=null && key instanceof PropertyKeyVertex,"Need to provide valid keys: %s",key);
        if (key.getCardinality()!=Cardinality.SINGLE) allSingleKeys=false;
        if (key.isNew()) oneNewKey = true;
        else updatedTypes.add((PropertyKeyVertex)key);
    }

    Cardinality indexCardinality;
    if (unique) indexCardinality=Cardinality.SINGLE;
    else indexCardinality=(allSingleKeys?Cardinality.SET:Cardinality.LIST);

    TypeDefinitionMap def = new TypeDefinitionMap();
    def.setValue(TypeDefinitionCategory.INTERNAL_INDEX,true);
    def.setValue(TypeDefinitionCategory.ELEMENT_CATEGORY,elementCategory);
    def.setValue(TypeDefinitionCategory.BACKING_INDEX,Token.INTERNAL_INDEX_NAME);
    def.setValue(TypeDefinitionCategory.INDEXSTORE_NAME,indexName);
    def.setValue(TypeDefinitionCategory.INDEX_CARDINALITY,indexCardinality);
    def.setValue(TypeDefinitionCategory.STATUS,oneNewKey?SchemaStatus.ENABLED:SchemaStatus.INSTALLED);
    TitanSchemaVertex indexVertex = transaction.makeSchemaVertex(TitanSchemaCategory.GRAPHINDEX,indexName,def);
    for (int i = 0; i <keys.length; i++) {
        Parameter[] paras = {ParameterType.INDEX_POSITION.getParameter(i)};
        addSchemaEdge(indexVertex,keys[i],TypeDefinitionCategory.INDEX_FIELD,paras);
    }

    Preconditions.checkArgument(constraint==null || (elementCategory.isValidConstraint(constraint) && constraint instanceof TitanSchemaVertex));
    if (constraint!=null) {
        addSchemaEdge(indexVertex,(TitanSchemaVertex)constraint,TypeDefinitionCategory.INDEX_SCHEMA_CONSTRAINT,null);
    }
    updateSchemaVertex(indexVertex);
    TitanGraphIndexWrapper index = new TitanGraphIndexWrapper(indexVertex.asIndexType());
    if (!oneNewKey) updateIndex(index,SchemaAction.REGISTER_INDEX);
    return index;
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:40,代码来源:ManagementSystem.java


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