本文整理匯總了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);
}