*/
public GraphTraversalBuilder(Loader loader, GraphTraversalSource source) {
super(loader, source);
-
traversal = (GraphTraversal<Vertex, E>) __.<E>start();
}
public QueryBuilder<Vertex> getVerticesByProperty(String key, Object value) {
// correct value call because the index is registered as an Integer
- traversal.has(key, this.correctObjectType(value));
-
+ this.vertexHas(key, this.correctObjectType(value));
stepIndex++;
return (QueryBuilder<Vertex>) this;
}
+ @Override
+ protected void vertexHas(String key, Object value) {
+ traversal.has(key, value);
+ }
+
+ @Override
+ protected void vertexHasNot(String key) {
+ traversal.hasNot(key);
+ }
+
+ @Override
+ protected void vertexHas(String key) {
+ traversal.has(key);
+ }
+
+ // TODO: Remove this once we test this - at this point i dont thib this is required
+ // because predicare is an object
+ /*
+ * @Override
+ * protected void vertexHas(final String key, final P<?> predicate) {
+ * traversal.has(key, predicate);
+ * }
+ */
+
/**
* @{inheritDoc}
*/
correctedValues.add(this.correctObjectType(item));
}
- traversal.has(key, P.within(correctedValues));
+ this.vertexHas(key, P.within(correctedValues));
+ stepIndex++;
+ return (QueryBuilder<Vertex>) this;
+ }
+
+ /**
+ * @{inheritDoc}
+ */
+ public QueryBuilder<Vertex> getVerticesByCommaSeperatedValue(String key, String value) {
+ ArrayList<String> values = new ArrayList<>(Arrays.asList(value.split(",")));
+ int size = values.size();
+ for (int i = 0; i < size; i++) {
+ values.set(i, values.get(i).trim());
+ }
+ this.vertexHas(key, P.within(values));
stepIndex++;
return (QueryBuilder<Vertex>) this;
public QueryBuilder<Vertex> getVerticesStartsWithProperty(String key, Object value) {
// correct value call because the index is registered as an Integer
- traversal.has(key, org.janusgraph.core.attribute.Text.textPrefix(value));
+ // TODO Check if this needs to be in QB and add these as internal
+ this.vertexHas(key, org.janusgraph.core.attribute.Text.textPrefix(value));
stepIndex++;
return (QueryBuilder<Vertex>) this;
*/
@Override
public QueryBuilder<Vertex> getVerticesByProperty(String key) {
-
- traversal.has(key);
+ this.vertexHas(key);
stepIndex++;
return (QueryBuilder<Vertex>) this;
}
*/
@Override
public QueryBuilder<Vertex> getVerticesExcludeByProperty(String key) {
-
- traversal.hasNot(key);
+ this.vertexHasNot(key);
stepIndex++;
return (QueryBuilder<Vertex>) this;
}
public QueryBuilder<Vertex> getVerticesExcludeByProperty(String key, Object value) {
// correct value call because the index is registered as an Integer
- traversal.has(key, P.neq(this.correctObjectType(value)));
-
+ this.vertexHas(key, P.neq(this.correctObjectType(value)));
stepIndex++;
return (QueryBuilder<Vertex>) this;
}
correctedValues.add(this.correctObjectType(item));
}
- traversal.has(key, P.without(correctedValues));
-
+ this.vertexHas(key, P.without(correctedValues));
stepIndex++;
return (QueryBuilder<Vertex>) this;
}
@Override
public QueryBuilder<Vertex> getVerticesGreaterThanProperty(final String key, Object value) {
-
- traversal.has(key, P.gte(this.correctObjectType(value)));
+ this.vertexHas(key, P.gte(this.correctObjectType(value)));
stepIndex++;
return (QueryBuilder<Vertex>) this;
@Override
public QueryBuilder<Vertex> getVerticesLessThanProperty(final String key, Object value) {
-
- traversal.has(key, P.lte(this.correctObjectType(value)));
+ this.vertexHas(key, P.lte(this.correctObjectType(value)));
stepIndex++;
return (QueryBuilder<Vertex>) this;
public QueryBuilder<Vertex> getTypedVerticesByMap(String type, Map<String, String> map) {
for (Map.Entry<String, String> es : map.entrySet()) {
- traversal.has(es.getKey(), es.getValue());
+ this.vertexHas(es.getKey(), es.getValue());
stepIndex++;
}
traversal.has(AAIProperties.NODE_TYPE, type);
bValue = (Boolean) value;
}
- traversal.has(key, bValue);
+ this.vertexHas(key, bValue);
stepIndex++;
}
return (QueryBuilder<Vertex>) this;
if (val != null) {
// this is because the index is registered as an Integer
if (val.getClass().equals(Long.class)) {
- traversal.has(key, new Integer(val.toString()));
+ this.vertexHas(key, new Integer(val.toString()));
} else {
- traversal.has(key, val);
+ this.vertexHas(key, val);
}
stepIndex++;
}
}
// this is because the index is registered as an Integer
if (val.getClass().equals(Long.class)) {
- traversal.has(prop, new Integer(val.toString()));
+ this.vertexHas(prop, new Integer(val.toString()));
} else {
- traversal.has(prop, val);
+ this.vertexHas(prop, val);
}
stepIndex++;
}
}
/**
- *
* @{inheritDoc}
*/
@Override
return this;
}
+ @Override
+ public QueryBuilder<E> valueMap() {
+ this.traversal.valueMap();
+ stepIndex++;
+
+ return this;
+ }
+
+ @Override
+ public QueryBuilder<E> valueMap(String... names) {
+ this.traversal.valueMap(names);
+ stepIndex++;
+
+ return this;
+ }
+
/**
* {@inheritDoc}
*/
return (QueryBuilder<Edge>) this;
}
+
}