本文整理汇总了Java中org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexFeatures类的典型用法代码示例。如果您正苦于以下问题:Java VertexFeatures类的具体用法?Java VertexFeatures怎么用?Java VertexFeatures使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VertexFeatures类属于org.apache.tinkerpop.gremlin.structure.Graph.Features包,在下文中一共展示了VertexFeatures类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldAddEdgeWithUserSuppliedAnyIdUsingAnyObject
import org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexFeatures; //导入依赖的package包/类
@Test
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_USER_SUPPLIED_IDS)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ANY_IDS)
public void shouldAddEdgeWithUserSuppliedAnyIdUsingAnyObject() {
final UUID uuid = UUID.randomUUID();
// this is different from "FEATURE_CUSTOM_IDS" as TinkerGraph does not define a specific id class
// (i.e. TinkerId) for the identifier.
final CustomId customId = new CustomId("test", uuid);
final Vertex v = graph.addVertex();
v.addEdge("self", v, T.id, customId);
tryCommit(graph, graph -> {
final Edge e = graph.edges(customId).next();
assertEquals(customId, e.id());
});
}
示例2: shouldHaveExceptionConsistencyWhenAssigningSameIdOnEdge
import org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexFeatures; //导入依赖的package包/类
@Test
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_USER_SUPPLIED_IDS)
public void shouldHaveExceptionConsistencyWhenAssigningSameIdOnEdge() {
final Vertex v = graph.addVertex();
final Object o = graphProvider.convertId("1", Edge.class);
v.addEdge("self", v, T.id, o);
try {
v.addEdge("self", v, T.id, o);
fail("Assigning the same ID to an Element should throw an exception");
} catch (Exception ex) {
validateException(Graph.Exceptions.edgeWithIdAlreadyExists(o), ex);
}
}
示例3: shouldEvaluateEquivalentVertexHashCodeWithSuppliedIds
import org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexFeatures; //导入依赖的package包/类
@Test
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS)
public void shouldEvaluateEquivalentVertexHashCodeWithSuppliedIds() {
final Vertex v = graph.addVertex(T.id, graphProvider.convertId("1", Vertex.class));
final Vertex u = graph.vertices(graphProvider.convertId("1", Vertex.class)).next();
assertEquals(v, u);
final Set<Vertex> set = new HashSet<>();
set.add(v);
set.add(v);
set.add(u);
set.add(u);
set.add(graph.vertices(graphProvider.convertId("1", Vertex.class)).next());
set.add(graph.vertices(graphProvider.convertId("1", Vertex.class)).next());
assertEquals(1, set.size());
assertEquals(v.hashCode(), u.hashCode());
}
示例4: shouldSupportUserSuppliedIdsOfTypeString
import org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexFeatures; //导入依赖的package包/类
@Test
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS)
@FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_STRING_IDS, supported = false)
public void shouldSupportUserSuppliedIdsOfTypeString() throws Exception {
final String id = "this-is-a-valid-id";
// a graph can "allow" an id without internally supporting it natively and therefore doesn't need
// to throw the exception
assumeFalse(graph.features().vertex().willAllowId(id));
try {
graph.addVertex(T.id, id);
fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_STRING_IDS));
} catch (Exception e) {
validateException(Vertex.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e);
}
}
示例5: shouldSupportUserSuppliedIdsOfTypeNumericInt
import org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexFeatures; //导入依赖的package包/类
@Test
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS)
@FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_NUMERIC_IDS, supported = false)
public void shouldSupportUserSuppliedIdsOfTypeNumericInt() throws Exception {
final int id = 123456;
// a graph can "allow" an id without internally supporting it natively and therefore doesn't need
// to throw the exception
assumeFalse(graph.features().vertex().willAllowId(id));
try {
graph.addVertex(T.id, id);
fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_NUMERIC_IDS));
} catch (Exception e) {
validateException(Vertex.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e);
}
}
示例6: shouldSupportUserSuppliedIdsOfTypeNumericLong
import org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexFeatures; //导入依赖的package包/类
@Test
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS)
@FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_NUMERIC_IDS, supported = false)
public void shouldSupportUserSuppliedIdsOfTypeNumericLong() throws Exception {
final long id = 123456l;
// a graph can "allow" an id without internally supporting it natively and therefore doesn't need
// to throw the exception
assumeFalse(graph.features().vertex().willAllowId(id));
try {
graph.addVertex(T.id, id);
fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_NUMERIC_IDS));
} catch (Exception e) {
validateException(Vertex.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e);
}
}
示例7: shouldSupportUserSuppliedIdsOfTypeUuid
import org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexFeatures; //导入依赖的package包/类
@Test
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS)
@FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_UUID_IDS, supported = false)
public void shouldSupportUserSuppliedIdsOfTypeUuid() throws Exception {
final UUID id = UUID.randomUUID();
// a graph can "allow" an id without internally supporting it natively and therefore doesn't need
// to throw the exception
assumeFalse(graph.features().vertex().willAllowId(id));
try {
graph.addVertex(T.id, id);
fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_UUID_IDS));
} catch (Exception e) {
validateException(Vertex.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e);
}
}
示例8: shouldSupportUserSuppliedIdsOfTypeAny
import org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexFeatures; //导入依赖的package包/类
@Test
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS)
@FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_ANY_IDS, supported = false)
public void shouldSupportUserSuppliedIdsOfTypeAny() throws Exception {
try {
final Date id = new Date();
graph.addVertex(T.id, id);
// a graph can "allow" an id without internally supporting it natively and therefore doesn't need
// to throw the exception
if (!graph.features().vertex().willAllowId(id))
fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_ANY_IDS));
} catch (Exception e) {
validateException(Vertex.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e);
}
}
示例9: shouldAddEdgeWithUserSuppliedNumericId
import org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexFeatures; //导入依赖的package包/类
@Test
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_USER_SUPPLIED_IDS)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_NUMERIC_IDS)
public void shouldAddEdgeWithUserSuppliedNumericId() {
final Vertex v = graph.addVertex();
v.addEdge("self", v, T.id, 1000l);
tryCommit(graph, graph -> {
final Edge e = graph.edges(1000l).next();
assertEquals(1000l, e.id());
});
}
示例10: shouldAddEdgeWithUserSuppliedStringId
import org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexFeatures; //导入依赖的package包/类
@Test
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_USER_SUPPLIED_IDS)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_STRING_IDS)
public void shouldAddEdgeWithUserSuppliedStringId() {
final Vertex v = graph.addVertex();
v.addEdge("self", v, T.id, "1000");
tryCommit(graph, graph -> {
final Edge e = graph.edges("1000").next();
assertEquals("1000", e.id());
});
}
示例11: shouldAddEdgeWithUserSuppliedUuidId
import org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexFeatures; //导入依赖的package包/类
@Test
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_USER_SUPPLIED_IDS)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_UUID_IDS)
public void shouldAddEdgeWithUserSuppliedUuidId() {
final UUID uuid = UUID.randomUUID();
final Vertex v = graph.addVertex();
v.addEdge("self", v, T.id, uuid);
tryCommit(graph, graph -> {
final Edge e = graph.edges(uuid).next();
assertEquals(uuid, e.id());
});
}
示例12: shouldAddEdgeWithUserSuppliedAnyIdUsingUuid
import org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexFeatures; //导入依赖的package包/类
@Test
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_USER_SUPPLIED_IDS)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ANY_IDS)
public void shouldAddEdgeWithUserSuppliedAnyIdUsingUuid() {
final UUID uuid = UUID.randomUUID();
final Vertex v = graph.addVertex();
v.addEdge("self", v, T.id, uuid);
tryCommit(graph, graph -> {
final Edge e = graph.edges(uuid).next();
assertEquals(uuid, e.id());
});
}
示例13: shouldAddEdgeWithUserSuppliedAnyIdUsingString
import org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexFeatures; //导入依赖的package包/类
@Test
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_USER_SUPPLIED_IDS)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ANY_IDS)
public void shouldAddEdgeWithUserSuppliedAnyIdUsingString() {
final UUID uuid = UUID.randomUUID();
final Vertex v = graph.addVertex();
v.addEdge("self", v, T.id, uuid.toString());
tryCommit(graph, graph -> {
final Edge e = graph.edges(uuid.toString()).next();
assertEquals(uuid.toString(), e.id());
});
}
示例14: shouldValidateEquality
import org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexFeatures; //导入依赖的package包/类
@Test
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
public void shouldValidateEquality() {
final Vertex v1 = graph.addVertex();
final Vertex v2 = graph.addVertex();
assertEquals(v1, v1);
assertEquals(v2, v2);
assertNotEquals(v1, v2);
}
示例15: shouldValidateIdEquality
import org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexFeatures; //导入依赖的package包/类
@Test
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
public void shouldValidateIdEquality() {
final Vertex v1 = graph.addVertex();
final Vertex v2 = graph.addVertex();
assertEquals(v1.id(), v1.id());
assertEquals(v2.id(), v2.id());
assertEquals(v1.id().toString(), v1.id().toString());
assertEquals(v2.id().toString(), v2.id().toString());
assertNotEquals(v1.id(), v2.id());
assertNotEquals(v1.id().toString(), v2.id().toString());
}