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


Java Cardinality.LIST属性代码示例

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


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

示例1: createCompositeIndex

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,代码行数:39,代码来源:ManagementSystem.java

示例2: createCardinality

/**
 * Converts a Multiplicity to a Cardinality.
 *
 * @param multiplicity
 * @return
 */
public static Cardinality createCardinality(AtlasCardinality cardinality) {
    switch(cardinality) {

    case SINGLE:
        return Cardinality.SINGLE;
    case LIST:
        return Cardinality.LIST;
    case SET:
        return Cardinality.SET;
    default:
        throw new IllegalStateException("Unrecognized cardinality: " + cardinality);
    }
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:19,代码来源:TitanObjectFactory.java

示例3: createCardinality

/**
 * Converts a Multiplicity to a Cardinality.
 *
 * @param cardinality
 * @return
 */
public static AtlasCardinality createCardinality(Cardinality cardinality) {

    if (cardinality == Cardinality.SINGLE) {
        return AtlasCardinality.SINGLE;
    } else if (cardinality == Cardinality.LIST) {
        return AtlasCardinality.LIST;
    }
    return AtlasCardinality.SET;
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:15,代码来源:GraphDbObjectFactory.java

示例4: getPropertyKey

@Override
public PropertyKeyDefinition getPropertyKey(String name) {
    Cardinality card = Cardinality.SINGLE;
    if (name.endsWith("list")) card=Cardinality.LIST;
    else if (name.endsWith("set")) card=Cardinality.SET;
    return new PropertyKeyDefinition(name, getId(), card, Object.class);
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:7,代码来源:TestSchemaProvider.java

示例5: defaultPropertyCardinality

@Override
public Cardinality defaultPropertyCardinality(String key) {
    return Cardinality.LIST;
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:4,代码来源:Tp3DefaultSchemaMaker.java

示例6: acquireLock

public static boolean acquireLock(CompositeIndexType index, boolean acquireLocksConfig) {
    return acquireLocksConfig && index.getConsistencyModifier()==ConsistencyModifier.LOCK
            && index.getCardinality()!= Cardinality.LIST;
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:4,代码来源:StandardTitanGraph.java


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