本文整理汇总了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;
}
示例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);
}
}
示例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;
}
示例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);
}
示例5: defaultPropertyCardinality
@Override
public Cardinality defaultPropertyCardinality(String key) {
return Cardinality.LIST;
}
示例6: acquireLock
public static boolean acquireLock(CompositeIndexType index, boolean acquireLocksConfig) {
return acquireLocksConfig && index.getConsistencyModifier()==ConsistencyModifier.LOCK
&& index.getCardinality()!= Cardinality.LIST;
}