org.apache.tinkerpop.gremlin.structure.util.StringFactory Java Examples

The following examples show how to use org.apache.tinkerpop.gremlin.structure.util.StringFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ObjectVertexTest.java    From act-platform with ISC License 6 votes vote down vote up
@Test
public void testGetPropertyKeysOnVertex() {
  Vertex vertex = createVertex(list(new PropertyEntry<>("value", "someObjectValue")));
  // Test that the following properties exists on the vertex.
  Map<String, String> expected = map(
          T("value", "someObjectValue")
  );

  Set<String> keys = vertex.keys();
  Set<VertexProperty<Object>> properties = set(vertex.properties());

  assertEquals(expected.size(), keys.size());
  assertEquals(expected.size(), properties.size());

  for (Map.Entry<String, String> entry : expected.entrySet()) {
    assertTrue(keys.contains(entry.getKey()));

    VertexProperty<Object> property = vertex.property(entry.getKey());
    assertNotNull(property.id());
    assertEquals(entry.getValue(), property.value());
    assertEquals(property.key(), property.label());
    assertEquals(StringFactory.propertyString(property), property.toString());
    assertSame(vertex, property.element());
  }
}
 
Example #2
Source File: VariablesTest.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Test
@FeatureRequirement(featureClass = Graph.Features.VariableFeatures.class, feature = Graph.Features.VariableFeatures.FEATURE_VARIABLES)
@FeatureRequirement(featureClass = Graph.Features.VariableFeatures.class, feature = Graph.Features.VariableFeatures.FEATURE_STRING_VALUES)
public void testVariables() {
    final Graph.Variables variables = graph.variables();
    variables.set("xo", "test1");
    variables.set("yo", "test2");
    variables.set("zo", "test3");

    tryCommit(graph, graph -> assertEquals(StringFactory.graphVariablesString(variables), variables.toString()));
}
 
Example #3
Source File: RepeatStep.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    if (this.untilFirst && this.emitFirst)
        return StringFactory.stepString(this, untilString(), emitString(), this.repeatTraversal);
    else if (this.emitFirst)
        return StringFactory.stepString(this, emitString(), this.repeatTraversal, untilString());
    else if (this.untilFirst)
        return StringFactory.stepString(this, untilString(), this.repeatTraversal, emitString());
    else
        return StringFactory.stepString(this, this.repeatTraversal, untilString(), emitString());
}
 
Example #4
Source File: EdgeTest.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@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 shouldHaveStandardStringRepresentation() {
    final Vertex v1 = graph.addVertex();
    final Vertex v2 = graph.addVertex();
    final Edge e = v1.addEdge("friends", v2);

    assertEquals(StringFactory.edgeString(e), e.toString());
}
 
Example #5
Source File: HugeVertexStep.java    From hugegraph with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    if (this.hasContainers.isEmpty()) {
        return super.toString();
    }

    return StringFactory.stepString(
           this,
           getDirection(),
           Arrays.asList(getEdgeLabels()),
           getReturnClass().getSimpleName(),
           this.hasContainers);
}
 
Example #6
Source File: HBaseVertexStep.java    From hgraphdb with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    if (this.hasContainers.isEmpty())
        return super.toString();
    else
        return StringFactory.stepString(this, getDirection(), Arrays.asList(getEdgeLabels()), getReturnClass().getSimpleName().toLowerCase(), this.hasContainers);
}
 
Example #7
Source File: TinkerGraphStep.java    From tinkergraph-gremlin with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    if (this.hasContainers.isEmpty())
        return super.toString();
    else
        return 0 == this.ids.length ?
                StringFactory.stepString(this, this.returnClass.getSimpleName().toLowerCase(), this.hasContainers) :
                StringFactory.stepString(this, this.returnClass.getSimpleName().toLowerCase(), Arrays.toString(this.ids), this.hasContainers);
}
 
Example #8
Source File: SqlgEdge.java    From sqlg with MIT License 5 votes vote down vote up
@Override
public String toString() {
    if (this.inVertex == null) {
        load();
    }
    return StringFactory.edgeString(this);
}
 
Example #9
Source File: HBaseProperty.java    From hgraphdb with Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.propertyString(this);
}
 
Example #10
Source File: TinkerGraphComputer.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.graphComputerString(this);
}
 
Example #11
Source File: PageRankMapReduce.java    From titan1withtp3.1 with Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.mapReduceString(this, this.memoryKey);
}
 
Example #12
Source File: Neo4jProperty.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.propertyString(this);
}
 
Example #13
Source File: HBaseGraph.java    From hgraphdb with Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.graphString(this, HBaseGraphConfiguration.HBASE_GRAPH_CLASS.getSimpleName().toLowerCase());
}
 
Example #14
Source File: OptionalStep.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.stepString(this, this.optionalTraversal);
}
 
Example #15
Source File: Neo4jGraphVariables.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.graphVariablesString(this);
}
 
Example #16
Source File: AddEdgeStartStep.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.stepString(this, this.parameters.toString());
}
 
Example #17
Source File: LocalStep.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.stepString(this, this.localTraversal);
}
 
Example #18
Source File: GraphComputerTest.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Test
@LoadGraphWith(MODERN)
public void shouldHaveStandardStringRepresentation() {
    final GraphComputer computer = graphProvider.getGraphComputer(graph);
    assertEquals(StringFactory.graphComputerString(computer), computer.toString());
}
 
Example #19
Source File: BlazeEdge.java    From tinkerpop3 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.edgeString(this);
}
 
Example #20
Source File: SqlgGraph.java    From sqlg with MIT License 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.featureString(this);
}
 
Example #21
Source File: TreeStep.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.stepString(this, this.traversalRing);
}
 
Example #22
Source File: WhereTraversalStep.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.stepString(this, this.selectKey);
}
 
Example #23
Source File: HadoopIoStep.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.stepString(this, new GraphFilter(this.computer));
}
 
Example #24
Source File: BlazeVertexProperty.java    From tinkerpop3 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Pass through to {@link StringFactory#propertyString(Property)}
 */
@Override
public String toString() {
    return StringFactory.propertyString(this);
}
 
Example #25
Source File: EmptyBlazeProperty.java    From tinkerpop3 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.propertyString(this);
}
 
Example #26
Source File: BlazeGraphFeatures.java    From tinkerpop3 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.featureString(this);
}
 
Example #27
Source File: BitsyEdge.java    From bitsy with Apache License 2.0 4 votes vote down vote up
public String toString() {
    return StringFactory.edgeString(this);
}
 
Example #28
Source File: SqlgLocalStepBarrier.java    From sqlg with MIT License 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.stepString(this, this.localTraversal);
}
 
Example #29
Source File: CloneVertexProgram.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.vertexProgramString(this);
}
 
Example #30
Source File: DefaultTraversalSideEffects.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public String toString() {
    return StringFactory.traversalSideEffectsString(this);
}