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

The following examples show how to use org.apache.tinkerpop.gremlin.structure.util.StringFactory. These examples are extracted from open source projects. 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 Project: act-platform   Source File: ObjectVertexTest.java    License: 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 Project: hugegraph   Source File: HugeVertexStep.java    License: 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 3
Source Project: tinkerpop   Source File: EdgeTest.java    License: 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 4
Source Project: sqlg   Source File: SqlgEdge.java    License: MIT License 5 votes vote down vote up
@Override
public String toString() {
    if (this.inVertex == null) {
        load();
    }
    return StringFactory.edgeString(this);
}
 
Example 5
Source Project: tinkergraph-gremlin   Source File: TinkerGraphStep.java    License: 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 6
Source Project: tinkerpop   Source File: RepeatStep.java    License: 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 7
Source Project: tinkerpop   Source File: VariablesTest.java    License: 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 8
Source Project: hgraphdb   Source File: HBaseVertexStep.java    License: 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 9
Source Project: tinkerpop   Source File: AndP.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return "and(" + StringFactory.removeEndBrackets(this.predicates) + ")";
}
 
Example 10
Source Project: tinkerpop   Source File: EdgeVertexStep.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.stepString(this, this.direction);
}
 
Example 11
Source Project: hugegraph   Source File: HugeVertex.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.vertexString(this);
}
 
Example 12
Source Project: titan1withtp3.1   Source File: ShortestDistanceMapReduce.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.mapReduceString(this, this.memoryKey);
}
 
Example 13
Source Project: sqlg   Source File: SqlgWhereTraversalStepBarrier.java    License: MIT License 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.stepString(this, this.selectKey);
}
 
Example 14
@Override
public String toString() {
    return StringFactory.stepString(this, this.clusterProperty, new GraphFilter(this.computer));
}
 
Example 15
Source Project: tinkerpop   Source File: FileSystemStorage.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.storageString(this.fs.toString());
}
 
Example 16
Source Project: tinkerpop   Source File: TailGlobalStep.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.stepString(this, this.limit);
}
 
Example 17
Source Project: sqlg   Source File: SqlgProperty.java    License: MIT License 4 votes vote down vote up
public String toString() {
    return StringFactory.propertyString(this);
}
 
Example 18
Source Project: titan1withtp3.1   Source File: AbstractEdge.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.edgeString(this);
}
 
Example 19
Source Project: act-platform   Source File: ObjectProperty.java    License: ISC License 4 votes vote down vote up
@Override
public String toString() {
  return StringFactory.propertyString(this);
}
 
Example 20
Source Project: act-platform   Source File: ObjectVertex.java    License: ISC License 4 votes vote down vote up
@Override
public String toString() {
  return StringFactory.vertexString(this);
}
 
Example 21
Source Project: tinkerpop   Source File: KeyedVertexProperty.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.propertyString(this);
}
 
Example 22
Source Project: titan1withtp3.1   Source File: FulgoraMemory.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.memoryString(this);
}
 
Example 23
Source Project: tinkerpop   Source File: StarGraph.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.graphString(this, "starOf:" + this.starVertex);
}
 
Example 24
Source Project: tinkerpop   Source File: SideEffectCapStep.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.stepString(this, this.sideEffectKeys);
}
 
Example 25
Source Project: act-platform   Source File: ActGraph.java    License: ISC License 4 votes vote down vote up
@Override
public String toString() {
  return StringFactory.graphString(this, "");
}
 
Example 26
Source Project: tinkerpop   Source File: PageRankVertexProgramStep.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.stepString(this, this.edgeTraversal.get(), this.pageRankProperty, this.times, new GraphFilter(this.computer));
}
 
Example 27
Source Project: tinkerpop   Source File: TraversalMapStep.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.stepString(this, this.mapTraversal);
}
 
Example 28
Source Project: tinkerpop   Source File: DefaultTraversalStrategies.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.traversalStrategiesString(this);
}
 
Example 29
Source Project: tinkerpop   Source File: GroupSideEffectStep.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.stepString(this, this.sideEffectKey, this.keyTraversal, this.valueTraversal);
}
 
Example 30
Source Project: tinkerpop   Source File: VertexStep.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return StringFactory.stepString(this, this.direction, Arrays.asList(this.edgeLabels), this.returnClass.getSimpleName().toLowerCase());
}