本文整理汇总了Java中com.thinkaurelius.titan.graphdb.types.vertices.RelationTypeVertex类的典型用法代码示例。如果您正苦于以下问题:Java RelationTypeVertex类的具体用法?Java RelationTypeVertex怎么用?Java RelationTypeVertex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RelationTypeVertex类属于com.thinkaurelius.titan.graphdb.types.vertices包,在下文中一共展示了RelationTypeVertex类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setConsistency
import com.thinkaurelius.titan.graphdb.types.vertices.RelationTypeVertex; //导入依赖的package包/类
/**
* Sets the consistency level for those schema elements that support it (types and internal indexes)
* </p>
* Note, that it is possible to have a race condition here if two threads simultaneously try to change the
* consistency level. However, this is resolved when the consistency level is being read by taking the
* first one and deleting all existing attached consistency levels upon modification.
*
* @param element
* @param consistency
*/
@Override
public void setConsistency(TitanSchemaElement element, ConsistencyModifier consistency) {
if (element instanceof RelationType) {
RelationTypeVertex rv = (RelationTypeVertex) element;
Preconditions.checkArgument(consistency != ConsistencyModifier.FORK || !rv.multiplicity().isConstrained(),
"Cannot apply FORK consistency mode to constraint relation type: %s", rv.name());
} else if (element instanceof TitanGraphIndex) {
IndexType index = ((TitanGraphIndexWrapper) element).getBaseIndex();
if (index.isMixedIndex())
throw new IllegalArgumentException("Cannot change consistency on mixed index: " + element);
} else throw new IllegalArgumentException("Cannot change consistency of schema element: " + element);
setTypeModifier(element, ModifierType.CONSISTENCY, consistency);
}
示例2: getTTL
import com.thinkaurelius.titan.graphdb.types.vertices.RelationTypeVertex; //导入依赖的package包/类
@Override
public Duration getTTL(final TitanSchemaType type) {
Preconditions.checkArgument(type != null);
int ttl;
if (type instanceof VertexLabelVertex) {
ttl = ((VertexLabelVertex) type).getTTL();
} else if (type instanceof RelationTypeVertex) {
ttl = ((RelationTypeVertex) type).getTTL();
} else {
throw new IllegalArgumentException("given type does not support TTL: " + type.getClass());
}
return Duration.ofSeconds(ttl);
}
示例3: setConsistency
import com.thinkaurelius.titan.graphdb.types.vertices.RelationTypeVertex; //导入依赖的package包/类
/**
* Sets the consistency level for those schema elements that support it (types and internal indexes)
* </p>
* Note, that it is possible to have a race condition here if two threads simultaneously try to change the
* consistency level. However, this is resolved when the consistency level is being read by taking the
* first one and deleting all existing attached consistency levels upon modification.
*
* @param element
* @param consistency
*/
@Override
public void setConsistency(TitanSchemaElement element, ConsistencyModifier consistency) {
if (element instanceof RelationType) {
RelationTypeVertex rv = (RelationTypeVertex) element;
Preconditions.checkArgument(consistency != ConsistencyModifier.FORK || !rv.getMultiplicity().isConstrained(),
"Cannot apply FORK consistency mode to constraint relation type: %s",rv.getName());
} else if (element instanceof TitanGraphIndex) {
IndexType index = ((TitanGraphIndexWrapper)element).getBaseIndex();
if (index.isMixedIndex()) throw new IllegalArgumentException("Cannot change consistency on mixed index: " + element);
} else throw new IllegalArgumentException("Cannot change consistency of schema element: " + element);
setTypeModifier(element, ModifierType.CONSISTENCY, consistency);
}
示例4: getTTL
import com.thinkaurelius.titan.graphdb.types.vertices.RelationTypeVertex; //导入依赖的package包/类
@Override
public Duration getTTL(final TitanSchemaType type) {
Preconditions.checkArgument(type != null);
int ttl;
if (type instanceof VertexLabelVertex) {
ttl = ((VertexLabelVertex) type).getTTL();
} else if (type instanceof RelationTypeVertex) {
ttl = ((RelationTypeVertex) type).getTTL();
} else {
throw new IllegalArgumentException("given type does not support TTL: " + type.getClass());
}
return new StandardDuration(ttl, TimeUnit.SECONDS);
}