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


Java Cardinality.SINGLE属性代码示例

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


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

示例1: Titan1Graph

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

示例2: getProperty

@Override
public <O> O getProperty(PropertyKey key) {
    if (!((InternalRelationType)key).isHiddenType() && tx().getConfiguration().hasPropertyPrefetching()) {
        getProperties().iterator().hasNext();
    }
    Iterator<TitanProperty> iter = query().type(key).properties().iterator();
    if (key.getCardinality()== Cardinality.SINGLE) {
        if (iter.hasNext()) return (O)iter.next().getValue();
        else return null;
    } else {
        List<Object> result = new ArrayList<Object>();
        while (iter.hasNext()) {
            result.add(iter.next().getValue());
        }
        return (O)result;
    }
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:17,代码来源:AbstractVertex.java

示例3: supports

@Override
public boolean supports(KeyInformation information, TitanPredicate titanPredicate) {
    if (information.getCardinality()!= Cardinality.SINGLE) return false;
    Class<?> dataType = information.getDataType();
    Mapping mapping = Mapping.getMapping(information);
    if (mapping!=Mapping.DEFAULT && !AttributeUtil.isString(dataType)) return false;

    if (Number.class.isAssignableFrom(dataType)) {
        if (titanPredicate instanceof Cmp) return true;
    } else if (dataType == Geoshape.class) {
        return titanPredicate == Geo.WITHIN;
    } else if (AttributeUtil.isString(dataType)) {
        switch(mapping) {
            case DEFAULT:
            case TEXT:
                return titanPredicate == Text.CONTAINS || titanPredicate == Text.CONTAINS_PREFIX; // || titanPredicate == Text.CONTAINS_REGEX;
            case STRING:
                return titanPredicate == Cmp.EQUAL || titanPredicate==Cmp.NOT_EQUAL || titanPredicate==Text.PREFIX || titanPredicate==Text.REGEX;
        }
    } else if (dataType == Date.class || dataType == Instant.class) {
        if (titanPredicate instanceof Cmp) return true;
    } else if (dataType == Boolean.class) {
        return titanPredicate == Cmp.EQUAL || titanPredicate == Cmp.NOT_EQUAL;
    } else if (dataType == UUID.class) {
        return titanPredicate == Cmp.EQUAL || titanPredicate == Cmp.NOT_EQUAL;
    }
    return false;
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:28,代码来源:LuceneIndex.java

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

示例5: StandardKeyInformation

public StandardKeyInformation(Class<?> dataType, Parameter... parameters) {
    Preconditions.checkNotNull(dataType);
    Preconditions.checkNotNull(parameters);
    this.dataType = dataType;
    this.parameters = parameters;
    this.cardinality = Cardinality.SINGLE;
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:7,代码来源:StandardKeyInformation.java

示例6: validTitanOrder

public static boolean validTitanOrder(OrderGlobalStep ostep, Traversal rootTraversal,
                                      boolean isVertexOrder) {
    for (Comparator comp : (List<Comparator>) ostep.getComparators()) {
        if (!(comp instanceof ElementValueComparator)) return false;
        ElementValueComparator evc = (ElementValueComparator) comp;
        if (!(evc.getValueComparator() instanceof Order)) return false;

        TitanTransaction tx = TitanTraversalUtil.getTx(rootTraversal.asAdmin());
        String key = evc.getPropertyKey();
        PropertyKey pkey = tx.getPropertyKey(key);
        if (pkey == null || !(Comparable.class.isAssignableFrom(pkey.dataType()))) return false;
        if (isVertexOrder && pkey.cardinality() != Cardinality.SINGLE) return false;
    }
    return true;
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:15,代码来源:HasStepFolder.java

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

示例8: supports

@Override
public boolean supports(KeyInformation information) {
    if(information.getCardinality() != Cardinality.SINGLE) {
        return false;
    }
    Class<?> dataType = information.getDataType();
    Mapping mapping = Mapping.getMapping(information);
    if (Number.class.isAssignableFrom(dataType) || dataType == Geoshape.class || dataType == Date.class || dataType == Instant.class || dataType == Boolean.class || dataType == UUID.class) {
        if (mapping==Mapping.DEFAULT) return true;
    } else if (AttributeUtil.isString(dataType)) {
        if (mapping==Mapping.DEFAULT || mapping==Mapping.TEXT || mapping==Mapping.STRING) return true;
    }
    return false;
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:14,代码来源:SolrIndex.java

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

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

示例11: isUnique

@Override
public boolean isUnique() {
    if (index.isMixedIndex()) return false;
    return ((CompositeIndexType)index).getCardinality()== Cardinality.SINGLE;
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:5,代码来源:TitanGraphIndexWrapper.java

示例12: getPropertyKey

@Override
public PropertyKeyDefinition getPropertyKey(String name) {
    log.debug("Creating default property key definition for {}", name);
    return new PropertyKeyDefinition(name, FaunusElement.NO_ID, Cardinality.SINGLE, Object.class);
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:5,代码来源:DefaultSchemaProvider.java

示例13: cardinality

@Override
public Cardinality cardinality() {
    return Cardinality.SINGLE;
}
 
开发者ID:graben1437,项目名称:titan1.0.1.kafka,代码行数:4,代码来源:ImplicitKey.java


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