本文整理汇总了Java中org.apache.tinkerpop.gremlin.structure.Graph.Features.EdgePropertyFeatures类的典型用法代码示例。如果您正苦于以下问题:Java EdgePropertyFeatures类的具体用法?Java EdgePropertyFeatures怎么用?Java EdgePropertyFeatures使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EdgePropertyFeatures类属于org.apache.tinkerpop.gremlin.structure.Graph.Features包,在下文中一共展示了EdgePropertyFeatures类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldReadGraphMLWithAllSupportedDataTypes
import org.apache.tinkerpop.gremlin.structure.Graph.Features.EdgePropertyFeatures; //导入依赖的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 = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_INTEGER_VALUES)
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_FLOAT_VALUES)
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_BOOLEAN_VALUES)
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_LONG_VALUES)
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_DOUBLE_VALUES)
@FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_FLOAT_VALUES)
public void shouldReadGraphMLWithAllSupportedDataTypes() throws IOException {
final GraphReader reader = GraphMLReader.build().create();
try (final InputStream stream = IoTest.class.getResourceAsStream(TestHelper.convertPackageToResourcePath(GraphMLResourceAccess.class) + "graph-types.xml")) {
reader.readGraph(stream, graph);
}
final Vertex v = graph.vertices().next();
assertEquals(123.45d, v.value("d"), 0.000001d);
assertEquals("some-string", v.<String>value("s"));
assertEquals(29, v.<Integer>value("i").intValue());
assertEquals(true, v.<Boolean>value("b"));
assertEquals(123.54f, v.value("f"), 0.000001f);
assertEquals(10000000l, v.<Long>value("l").longValue());
assertEquals("junk", v.<String>value("n"));
}
示例2: shouldReadGraphMLWithoutStrictOption
import org.apache.tinkerpop.gremlin.structure.Graph.Features.EdgePropertyFeatures; //导入依赖的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 = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_INTEGER_VALUES)
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_FLOAT_VALUES)
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_BOOLEAN_VALUES)
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_LONG_VALUES)
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_DOUBLE_VALUES)
@FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_FLOAT_VALUES)
public void shouldReadGraphMLWithoutStrictOption() throws IOException {
final GraphReader reader = GraphMLReader.build().strict(false).create();
try (final InputStream stream = IoTest.class.getResourceAsStream(TestHelper.convertPackageToResourcePath(GraphMLResourceAccess.class) + "graph-types-bad.xml")) {
reader.readGraph(stream, graph);
}
final Vertex v = graph.vertices().next();
assertFalse(v.values("d").hasNext());
assertEquals("some-string", v.<String>value("s"));
assertFalse(v.values("i").hasNext());
assertEquals(false, v.<Boolean>value("b"));
assertFalse(v.values("f").hasNext());
assertFalse(v.values("l").hasNext());
assertEquals("junk", v.<String>value("n"));
}
示例3: shouldReadGraphMLWithStrictOption
import org.apache.tinkerpop.gremlin.structure.Graph.Features.EdgePropertyFeatures; //导入依赖的package包/类
@Test(expected = NumberFormatException.class)
@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 = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_INTEGER_VALUES)
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_FLOAT_VALUES)
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_BOOLEAN_VALUES)
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_LONG_VALUES)
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_DOUBLE_VALUES)
@FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_FLOAT_VALUES)
public void shouldReadGraphMLWithStrictOption() throws IOException {
final GraphReader reader = GraphMLReader.build().strict(true).create();
try (final InputStream stream = IoTest.class.getResourceAsStream(TestHelper.convertPackageToResourcePath(GraphMLResourceAccess.class) + "graph-types-bad.xml")) {
reader.readGraph(stream, graph);
}
}
示例4: shouldWriteNormalizedGraphML
import org.apache.tinkerpop.gremlin.structure.Graph.Features.EdgePropertyFeatures; //导入依赖的package包/类
/**
* Only need to execute this test with TinkerGraph or other graphs that support user supplied identifiers.
*/
@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 = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_INTEGER_VALUES)
@FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_FLOAT_VALUES)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_USER_SUPPLIED_IDS)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_NUMERIC_IDS)
@LoadGraphWith(LoadGraphWith.GraphData.CLASSIC)
public void shouldWriteNormalizedGraphML() throws Exception {
try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
final GraphMLWriter w = GraphMLWriter.build().normalize(true).create();
w.writeGraph(bos, graph);
final String expected = streamToString(IoTest.class.getResourceAsStream(TestHelper.convertPackageToResourcePath(GraphMLResourceAccess.class) + "tinkerpop-classic-normalized.xml"));
assertEquals(expected.replace("\n", "").replace("\r", ""), bos.toString().replace("\n", "").replace("\r", ""));
}
}
示例5: shouldReadWriteSelfLoopingEdges
import org.apache.tinkerpop.gremlin.structure.Graph.Features.EdgePropertyFeatures; //导入依赖的package包/类
@Test
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
@FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = FEATURE_STRING_VALUES)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
public void shouldReadWriteSelfLoopingEdges() throws Exception {
final Graph source = graph;
final Vertex v1 = source.addVertex();
final Vertex v2 = source.addVertex();
v1.addEdge("CONTROL", v2);
v1.addEdge("SELFLOOP", v1);
final Configuration targetConf = graphProvider.newGraphConfiguration("target", this.getClass(), name.getMethodName(), null);
final Graph target = graphProvider.openTestGraph(targetConf);
try (ByteArrayOutputStream os = new ByteArrayOutputStream()) {
source.io(IoCore.graphml()).writer().create().writeGraph(os, source);
try (ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray())) {
target.io(IoCore.graphml()).reader().create().readGraph(is, target);
}
} catch (IOException ioe) {
throw new RuntimeException(ioe);
}
assertEquals(IteratorUtils.count(source.vertices()), IteratorUtils.count(target.vertices()));
assertEquals(IteratorUtils.count(source.edges()), IteratorUtils.count(target.edges()));
}
示例6: shouldWriteNormalizedGraphSON
import org.apache.tinkerpop.gremlin.structure.Graph.Features.EdgePropertyFeatures; //导入依赖的package包/类
/**
* Only need to execute this test with TinkerGraph or other graphs that support user supplied identifiers.
*/
@Test
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_INTEGER_VALUES)
@FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_FLOAT_VALUES)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_USER_SUPPLIED_IDS)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_NUMERIC_IDS)
@FeatureRequirement(featureClass = Graph.Features.VertexPropertyFeatures.class, feature = Graph.Features.VertexPropertyFeatures.FEATURE_USER_SUPPLIED_IDS)
@FeatureRequirement(featureClass = Graph.Features.VariableFeatures.class, feature = FEATURE_VARIABLES)
@LoadGraphWith(LoadGraphWith.GraphData.CLASSIC)
public void shouldWriteNormalizedGraphSON() throws Exception {
try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
final GraphSONMapper mapper = graph.io(graphson).mapper().normalize(true).create();
final GraphSONWriter w = graph.io(graphson).writer().mapper(mapper).create();
w.writeGraph(bos, graph);
final String expected = streamToString(IoTest.class.getResourceAsStream(TestHelper.convertPackageToResourcePath(GraphSONResourceAccess.class) + "tinkerpop-classic-normalized.json"));
assertEquals(expected.replace("\n", "").replace("\r", ""), bos.toString().replace("\n", "").replace("\r", ""));
}
}
示例7: shouldAllowRemovalFromEdgeWhenAlreadyRemoved
import org.apache.tinkerpop.gremlin.structure.Graph.Features.EdgePropertyFeatures; //导入依赖的package包/类
@Test
@FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_REMOVE_PROPERTY)
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = Graph.Features.EdgePropertyFeatures.FEATURE_INTEGER_VALUES)
public void shouldAllowRemovalFromEdgeWhenAlreadyRemoved() {
final Vertex v = graph.addVertex("name", "marko");
tryCommit(graph);
final Vertex v1 = graph.vertices(v.id()).next();
try {
final Edge edge = v1.addEdge("knows", graph.addVertex());
final Property p = edge.property("stars", 5);
p.remove();
p.remove();
edge.property("stars").remove();
edge.property("stars").remove();
} catch (Exception ex) {
fail("Removing an edge property that was already removed should not throw an exception");
}
}
示例8: shouldTransformGraphMLV2ToV3ViaXSLT
import org.apache.tinkerpop.gremlin.structure.Graph.Features.EdgePropertyFeatures; //导入依赖的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 = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_INTEGER_VALUES)
@FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_FLOAT_VALUES)
public void shouldTransformGraphMLV2ToV3ViaXSLT() throws Exception {
final InputStream stylesheet = Thread.currentThread().getContextClassLoader().getResourceAsStream("tp2-to-tp3-graphml.xslt");
final InputStream datafile = IoTest.class.getResourceAsStream(TestHelper.convertPackageToResourcePath(GraphMLResourceAccess.class) + "tinkerpop-classic-tp2.xml");
final ByteArrayOutputStream output = new ByteArrayOutputStream();
final TransformerFactory tFactory = TransformerFactory.newInstance();
final StreamSource stylesource = new StreamSource(stylesheet);
final Transformer transformer = tFactory.newTransformer(stylesource);
final StreamSource source = new StreamSource(datafile);
final StreamResult result = new StreamResult(output);
transformer.transform(source, result);
final GraphReader reader = GraphMLReader.build().create();
reader.readGraph(new ByteArrayInputStream(output.toByteArray()), graph);
assertClassicGraph(graph, false, true);
}
示例9: shouldWriteNormalizedGraphSON
import org.apache.tinkerpop.gremlin.structure.Graph.Features.EdgePropertyFeatures; //导入依赖的package包/类
/**
* Only need to execute this test with TinkerGraph or other graphs that support user supplied identifiers.
*/
@Test
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_INTEGER_VALUES)
@FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_FLOAT_VALUES)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_USER_SUPPLIED_IDS)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_NUMERIC_IDS)
@FeatureRequirement(featureClass = Graph.Features.VertexPropertyFeatures.class, feature = Graph.Features.VertexPropertyFeatures.FEATURE_USER_SUPPLIED_IDS)
@FeatureRequirement(featureClass = Graph.Features.VariableFeatures.class, feature = FEATURE_VARIABLES)
@LoadGraphWith(LoadGraphWith.GraphData.CLASSIC)
public void shouldWriteNormalizedGraphSON() throws Exception {
try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
final GraphSONMapper mapper = graph.io(graphson).mapper().version(GraphSONVersion.V1_0).normalize(true).create();
final GraphSONWriter w = graph.io(graphson).writer().mapper(mapper).create();
w.writeGraph(bos, graph);
final String expected = streamToString(IoTest.class.getResourceAsStream(TestHelper.convertPackageToResourcePath(GraphSONResourceAccess.class) + "tinkerpop-classic-normalized-v1d0.json"));
assertEquals(expected.replace("\n", "").replace("\r", ""), bos.toString().replace("\n", "").replace("\r", ""));
}
}
示例10: shouldThrowOnGraphAddEdge
import org.apache.tinkerpop.gremlin.structure.Graph.Features.EdgePropertyFeatures; //导入依赖的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.EdgePropertyFeatures.class, feature = FEATURE_PROPERTIES)
public void shouldThrowOnGraphAddEdge() throws Exception {
try {
final Vertex v = this.graph.addVertex();
v.addEdge("self", v, arguments);
fail(String.format("Call to addVertex should have thrown an exception with these arguments [%s]", arguments));
} catch (Exception ex) {
validateException(expectedException, ex);
}
}
示例11: shouldThrowOnGraphEdgeSetPropertyStandard
import org.apache.tinkerpop.gremlin.structure.Graph.Features.EdgePropertyFeatures; //导入依赖的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.EdgePropertyFeatures.class, feature = FEATURE_PROPERTIES)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_PROPERTY)
public void shouldThrowOnGraphEdgeSetPropertyStandard() throws Exception {
try {
final Vertex v = this.graph.addVertex();
v.addEdge("self", v).property(key, val);
fail(String.format("Call to Edge.setProperty should have thrown an exception with these arguments [%s, %s]", key, val));
} catch (Exception ex) {
validateException(expectedException, ex);
}
}
示例12: shouldSetValueOnEdge
import org.apache.tinkerpop.gremlin.structure.Graph.Features.EdgePropertyFeatures; //导入依赖的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_ADD_PROPERTY)
public void shouldSetValueOnEdge() throws Exception {
assumeThat(graph.features().supports(EdgePropertyFeatures.class, featureName), is(true));
final Edge edge = createEdgeForPropertyFeatureTests();
edge.property("aKey", value);
assertPropertyValue(edge);
}
示例13: shouldSetValueOnEdgeOnAdd
import org.apache.tinkerpop.gremlin.structure.Graph.Features.EdgePropertyFeatures; //导入依赖的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)
public void shouldSetValueOnEdgeOnAdd() throws Exception {
assumeThat(graph.features().supports(EdgePropertyFeatures.class, featureName), is(true));
final Edge edge = createEdgeForPropertyFeatureTests("aKey", value);
assertPropertyValue(edge);
}
示例14: shouldEnableFeatureOnEdgeIfNotEnabled
import org.apache.tinkerpop.gremlin.structure.Graph.Features.EdgePropertyFeatures; //导入依赖的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 = EdgeFeatures.FEATURE_ADD_PROPERTY)
public void shouldEnableFeatureOnEdgeIfNotEnabled() throws Exception {
assumeThat(graph.features().supports(EdgePropertyFeatures.class, featureName), is(false));
try {
final Edge edge = createEdgeForPropertyFeatureTests();
edge.property("aKey", value);
fail(String.format(INVALID_FEATURE_SPECIFICATION, EdgePropertyFeatures.class.getSimpleName(), featureName));
} catch (Exception e) {
validateException(Property.Exceptions.dataTypeOfPropertyValueNotSupported(value), e);
}
}
示例15: shouldSupportADataTypeIfEdgeHasPropertyEnabled
import org.apache.tinkerpop.gremlin.structure.Graph.Features.EdgePropertyFeatures; //导入依赖的package包/类
@Test
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_PROPERTIES)
public void shouldSupportADataTypeIfEdgeHasPropertyEnabled() {
assertEquals(edgePropertyFeatures.supportsProperties(), (edgePropertyFeatures.supportsBooleanValues() || edgePropertyFeatures.supportsDoubleValues()
|| edgePropertyFeatures.supportsFloatValues() || edgePropertyFeatures.supportsIntegerValues()
|| edgePropertyFeatures.supportsLongValues() || edgePropertyFeatures.supportsMapValues()
|| edgePropertyFeatures.supportsMixedListValues() || edgePropertyFeatures.supportsByteValues()
|| edgePropertyFeatures.supportsBooleanArrayValues() || edgePropertyFeatures.supportsByteArrayValues()
|| edgePropertyFeatures.supportsDoubleArrayValues() || edgePropertyFeatures.supportsFloatArrayValues()
|| edgePropertyFeatures.supportsIntegerArrayValues() || edgePropertyFeatures.supportsLongArrayValues()
|| edgePropertyFeatures.supportsSerializableValues() || edgePropertyFeatures.supportsStringValues()
|| edgePropertyFeatures.supportsUniformListValues() || edgePropertyFeatures.supportsStringArrayValues()));
}