org.apache.tinkerpop.gremlin.structure.util.wrapped.WrappedVertex Java Examples
The following examples show how to use
org.apache.tinkerpop.gremlin.structure.util.wrapped.WrappedVertex.
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: JanusGraphPropertiesStep.java From grakn with GNU Affero General Public License v3.0 | 6 votes |
@Override protected Iterator<E> flatMap(Traverser.Admin<Element> traverser) { if (useMultiQuery) { //it is guaranteed that all elements are vertices if (multiQueryResults == null || !multiQueryResults.containsKey(traverser.get())) { initializeMultiQuery(Arrays.asList(traverser)); } return convertIterator(multiQueryResults.get(traverser.get())); } else if (traverser.get() instanceof JanusGraphVertex || traverser.get() instanceof WrappedVertex) { JanusGraphVertexQuery query = makeQuery((JanusGraphTraversalUtil.getJanusGraphVertex(traverser)).query()); return convertIterator(query.properties()); } else { //It is some other element (edge or vertex property) Iterator<E> iterator; if (getReturnType().forValues()) { iterator = traverser.get().values(getPropertyKeys()); } else { //HasContainers don't apply => empty result set if (!hasContainers.isEmpty()) return Collections.emptyIterator(); iterator = (Iterator<E>) traverser.get().properties(getPropertyKeys()); } if (limit != Query.NO_LIMIT) iterator = Iterators.limit(iterator, limit); return iterator; } }
Example #2
Source File: JanusGraphTraversalUtil.java From grakn with GNU Affero General Public License v3.0 | 5 votes |
public static JanusGraphVertex getJanusGraphVertex(Element v) { while (v instanceof WrappedVertex) { v = ((WrappedVertex<Vertex>) v).getBaseVertex(); } if (v instanceof JanusGraphVertex) { return (JanusGraphVertex) v; } else throw new IllegalArgumentException("Expected traverser of JanusGraph vertex but found: " + v); }
Example #3
Source File: TitanTraversalUtil.java From titan1withtp3.1 with Apache License 2.0 | 5 votes |
public static TitanVertex getTitanVertex(Element v) { while (v instanceof WrappedVertex) { v = ((WrappedVertex<Vertex>) v).getBaseVertex(); } if (v instanceof TitanVertex) { return (TitanVertex) v; } else throw new IllegalArgumentException("Expected traverser of Titan vertex but found: " + v); }