Revert "Update tinkerpop to 3.2.3 in aai-core"
[aai/aai-common.git] / aai-core / src / main / java / org / onap / aai / query / builder / QueryBuilder.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *    http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.aai.query.builder;
22
23 import java.io.UnsupportedEncodingException;
24 import java.net.URI;
25 import java.util.Iterator;
26 import java.util.List;
27 import java.util.Map;
28
29 import javax.ws.rs.core.MultivaluedMap;
30
31 import org.apache.tinkerpop.gremlin.process.traversal.Path;
32 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
33 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
34 import org.apache.tinkerpop.gremlin.structure.Edge;
35 import org.apache.tinkerpop.gremlin.structure.Vertex;
36 import org.onap.aai.config.SpringContextAware;
37 import org.onap.aai.db.props.AAIProperties;
38 import org.onap.aai.edges.EdgeIngestor;
39 import org.onap.aai.edges.enums.AAIDirection;
40 import org.onap.aai.edges.enums.EdgeProperty;
41 import org.onap.aai.edges.enums.EdgeType;
42 import org.onap.aai.exceptions.AAIException;
43 import org.onap.aai.introspection.Introspector;
44 import org.onap.aai.introspection.Loader;
45 import org.onap.aai.parsers.query.QueryParser;
46 import org.onap.aai.parsers.query.QueryParserStrategy;
47 import org.springframework.context.ApplicationContext;
48
49 /**
50  * The Class QueryBuilder.
51  */
52 public abstract class QueryBuilder<E> implements Iterator<E> {
53
54     protected final GraphTraversalSource source;
55     protected QueryParserStrategy factory = null;
56     protected Loader loader = null;
57     protected EdgeIngestor edgeRules;
58     protected boolean optimize = false;
59     protected Vertex start = null;
60
61     protected int parentStepIndex = 0;
62     protected int containerStepIndex = 0;
63     protected int stepIndex = 0;
64
65     /**
66      * Instantiates a new query builder.
67      *
68      * @param loader the loader
69      */
70     public QueryBuilder(Loader loader, GraphTraversalSource source) {
71         this.loader = loader;
72         this.source = source;
73         initEdgeIngestor();
74     }
75
76     /**
77      * Instantiates a new query builder.
78      *
79      * @param loader the loader
80      * @param start the start
81      */
82     public QueryBuilder(Loader loader, GraphTraversalSource source, Vertex start) {
83         this.loader = loader;
84         this.start = start;
85         this.source = source;
86         initEdgeIngestor();
87     }
88
89     public void changeLoader(Loader loader) {
90         this.loader = loader;
91     }
92
93     protected abstract QueryBuilder<E> cloneQueryAtStep(int index);
94
95     /**
96      * Gets the vertices by indexed property.
97      *
98      * @param key the key
99      * @param value the value
100      * @return the vertices by indexed property
101      */
102     public QueryBuilder<Vertex> getVerticesByIndexedProperty(String key, Object value) {
103         return this.getVerticesByProperty(key, value);
104     }
105
106     /**
107      * Gets the vertices by property.
108      *
109      * @param key the key
110      * @param value the value
111      * @return the vertices by property
112      */
113     public abstract QueryBuilder<Vertex> getVerticesByProperty(String key, Object value);
114
115     /**
116      * Gets the edges by property.
117      *
118      * @param key the key
119      * @param value the value
120      * @return the vertices by property
121      */
122     public QueryBuilder<Edge> getEdgesByProperty(String key, Object value) {
123         return this.has(key, value.toString());
124     }
125
126     /**
127      * filters by all the values for this property
128      *
129      * @param key
130      * @param values
131      * @return vertices that match these values
132      */
133     public QueryBuilder<Vertex> getVerticesByIndexedProperty(String key, List<?> values) {
134         return this.getVerticesByProperty(key, values);
135     }
136
137     /**
138      * filters by all the values for this property
139      *
140      * @param key
141      * @param values
142      * @return vertices that match these values
143      */
144     public abstract QueryBuilder<Vertex> getVerticesByProperty(String key, List<?> values);
145
146     /**
147      * filters by all the values for this property
148      *
149      * @param key
150      * @param value in comma delimited string format
151      * @return vertices that match these values
152      */
153     public abstract QueryBuilder<Vertex> getVerticesByCommaSeperatedValue(String key, String value);
154
155     /**
156      * Gets the vertices that have this property key.
157      *
158      * @param key the key
159      * @return the vertices by property
160      */
161     public abstract QueryBuilder<Vertex> getVerticesByProperty(String key);
162
163     /**
164      * Gets the vertices that do not have this property key.
165      *
166      * @param key the key
167      * @return the vertices by property
168      */
169     public abstract QueryBuilder<Vertex> getVerticesExcludeByProperty(String key);
170
171     /**
172      * filters by elements that start with the value for this property
173      *
174      * @param key
175      * @param value
176      * @return vertices that match these values
177      */
178     public abstract QueryBuilder<Vertex> getVerticesStartsWithProperty(String key, Object value);
179
180     /**
181      * Gets the vertices that are excluded by property.
182      *
183      * @param key the key
184      * @param value the value
185      * @return the vertices by property
186      */
187     public abstract QueryBuilder<Vertex> getVerticesExcludeByProperty(String key, Object value);
188
189     /**
190      * filters by all the values for this property and excludes the vertices
191      *
192      * @param key
193      * @param values
194      * @return vertices that match these values
195      */
196     public QueryBuilder<Vertex> getVerticesExcludeByIndexedProperty(String key, List<?> values) {
197         return this.getVerticesExcludeByProperty(key, values);
198     }
199
200     /**
201      * filters by all the values for this property and excludes the vertices
202      *
203      * @param key
204      * @param values
205      * @return vertices that match these values
206      */
207     public abstract QueryBuilder<Vertex> getVerticesExcludeByProperty(String key, List<?> values);
208
209     /**
210      * filters by all the values greater than for this property
211      *
212      * @param key
213      * @param value
214      * @return vertices that match these values
215      */
216     public abstract QueryBuilder<Vertex> getVerticesGreaterThanProperty(String key, Object value);
217
218     /**
219      * filters by all the values less than for this property
220      *
221      * @param key
222      * @param value
223      * @return vertices that match these values
224      */
225
226     public abstract QueryBuilder<Vertex> getVerticesLessThanProperty(String key, Object value);
227
228     /**
229      * Gets the child vertices from parent.
230      *
231      * @param parentKey the parent key
232      * @param parentValue the parent value
233      * @param childType the child type
234      * @return the child vertices from parent
235      */
236     public abstract QueryBuilder<Vertex> getChildVerticesFromParent(String parentKey, String parentValue,
237             String childType);
238
239     /**
240      * Gets the typed vertices by map.
241      *
242      * @param type the type
243      * @param map the map
244      * @return the typed vertices by map
245      */
246     public abstract QueryBuilder<Vertex> getTypedVerticesByMap(String type, Map<String, String> map);
247
248     /**
249      * Creates the DB query.
250      *
251      * @param obj the obj
252      * @return the query builder
253      */
254     public QueryBuilder<Vertex> createDBQuery(Introspector obj) {
255         this.createKeyQuery(obj);
256         this.createContainerQuery(obj);
257         return (QueryBuilder<Vertex>) this;
258     }
259
260     /**
261      * Creates the key query.
262      *
263      * @param obj the obj
264      * @return the query builder
265      */
266     public abstract QueryBuilder<Vertex> createKeyQuery(Introspector obj);
267
268     /**
269      * Creates the container query.
270      *
271      * @param obj the obj
272      * @return the query builder
273      */
274     public abstract QueryBuilder<Vertex> createContainerQuery(Introspector obj);
275
276     /**
277      * Creates the edge traversal.
278      *
279      * @param parent the parent
280      * @param child the child
281      * @return the query builder
282      */
283     public abstract QueryBuilder<Vertex> createEdgeTraversal(EdgeType type, Introspector parent, Introspector child)
284             throws AAIException;
285
286     public abstract QueryBuilder<Vertex> getVerticesByBooleanProperty(String key, Object value);
287
288     public QueryBuilder<Vertex> getVerticesByBooleanProperty(String key, MissingOptionalParameter value) {
289         return (QueryBuilder<Vertex>) this;
290     }
291
292     /**
293      * Creates the private edge traversal.
294      *
295      * @param parent the parent
296      * @param child the child
297      * @return the query builder
298      */
299     public abstract QueryBuilder<Vertex> createPrivateEdgeTraversal(EdgeType type, Introspector parent,
300             Introspector child) throws AAIException;
301
302     /**
303      * Creates the edge traversal.
304      *
305      * @param parent the parent
306      * @param child the child
307      * @return the query builder
308      */
309     public QueryBuilder<Vertex> createEdgeTraversal(EdgeType type, Vertex parent, Introspector child)
310             throws AAIException {
311         String nodeType = parent.<String>property(AAIProperties.NODE_TYPE).orElse(null);
312         this.createEdgeTraversal(type, nodeType, child.getDbName());
313         return (QueryBuilder<Vertex>) this;
314     }
315
316     /**
317      *
318      * @param type
319      * @param outNodeType
320      * @param inNodeType
321      * @return
322      * @throws AAIException
323      */
324     public QueryBuilder<Vertex> createEdgeTraversal(EdgeType type, String outNodeType, String inNodeType)
325             throws AAIException {
326         Introspector out = loader.introspectorFromName(outNodeType);
327         Introspector in = loader.introspectorFromName(inNodeType);
328
329         return createEdgeTraversal(type, out, in);
330     }
331
332     /**
333      *
334      * @param edgeType
335      * @param outNodeType
336      * @param inNodeType
337      * @return
338      * @throws AAIException
339      */
340     public QueryBuilder<Vertex> createEdgeTraversal(String edgeType, String outNodeType, String inNodeType)
341             throws AAIException {
342         /*
343          * When the optional parameter edgetype is sent it is a string that needs to be converted to Enum
344          */
345         EdgeType type = EdgeType.valueOf(edgeType);
346         Introspector out = loader.introspectorFromName(outNodeType);
347         Introspector in = loader.introspectorFromName(inNodeType);
348
349         return createEdgeTraversal(type, out, in);
350     }
351
352     /**
353      *
354      * @param edgeType
355      * @param outNodeType
356      * @param inNodeType
357      * @return
358      * @throws AAIException
359      */
360     public QueryBuilder<Vertex> createEdgeTraversal(MissingOptionalParameter edgeType, String outNodeType,
361             String inNodeType) throws AAIException {
362         /*
363          * When no optional parameter edgetype is sent get all edges between the 2 nodetypes
364          */
365         return this.createEdgeTraversal(outNodeType, inNodeType);
366     }
367
368     /**
369      *
370      * @param edgeType
371      * @param outNodeType
372      * @param inNodeType
373      * @return
374      * @throws AAIException
375      */
376     public QueryBuilder<Vertex> createEdgeTraversalWithLabels(MissingOptionalParameter edgeType, String outNodeType,
377             String inNodeType, List<String> labels) throws AAIException {
378         /*
379          * When no optional parameter edgetype is sent get all edges between the 2 nodetypes
380          */
381         return this.createEdgeTraversalWithLabels(outNodeType, inNodeType, labels);
382     }
383
384     public QueryBuilder<Vertex> createEdgeTraversal(String outNodeType, String inNodeType) throws AAIException {
385
386         Introspector out = loader.introspectorFromName(outNodeType);
387         Introspector in = loader.introspectorFromName(inNodeType);
388
389         QueryBuilder<Vertex> cousinBuilder = null;
390         QueryBuilder<Vertex> treeBuilder = null;
391         QueryBuilder<Vertex> queryBuilder = null;
392
393         try {
394             cousinBuilder = this.newInstance().createEdgeTraversal(EdgeType.COUSIN, out, in);
395         } catch (AAIException e) {
396         }
397
398         if (cousinBuilder != null) {
399             try {
400                 treeBuilder = this.newInstance().createEdgeTraversal(EdgeType.TREE, out, in);
401             } catch (AAIException e) {
402             }
403             if (treeBuilder != null) {
404                 queryBuilder = this.union(new QueryBuilder[] {cousinBuilder, treeBuilder});
405             } else {
406                 queryBuilder = this.union(new QueryBuilder[] {cousinBuilder});
407             }
408         } else {
409             treeBuilder = this.newInstance().createEdgeTraversal(EdgeType.TREE, out, in);
410             queryBuilder = this.union(new QueryBuilder[] {treeBuilder});
411         }
412
413         return queryBuilder;
414     }
415
416     public QueryBuilder<Vertex> createEdgeTraversalWithLabels(String outNodeType, String inNodeType,
417             List<String> labels) throws AAIException {
418
419         Introspector out = loader.introspectorFromName(outNodeType);
420         Introspector in = loader.introspectorFromName(inNodeType);
421
422         QueryBuilder<Vertex> cousinBuilder = null;
423         QueryBuilder<Vertex> treeBuilder = null;
424         QueryBuilder<Vertex> queryBuilder = null;
425
426         try {
427             cousinBuilder = this.newInstance().createEdgeTraversalWithLabels(EdgeType.COUSIN, out, in, labels);
428         } catch (AAIException e) {
429         }
430
431         if (cousinBuilder != null) {
432             try {
433                 treeBuilder = this.newInstance().createEdgeTraversalWithLabels(EdgeType.TREE, out, in, labels);
434             } catch (AAIException e) {
435             }
436             if (treeBuilder != null) {
437                 queryBuilder = this.union(new QueryBuilder[] {cousinBuilder, treeBuilder});
438             } else {
439                 queryBuilder = this.union(new QueryBuilder[] {cousinBuilder});
440             }
441         } else {
442             treeBuilder = this.newInstance().createEdgeTraversalWithLabels(EdgeType.TREE, out, in, labels);
443             queryBuilder = this.union(new QueryBuilder[] {treeBuilder});
444         }
445
446         return queryBuilder;
447     }
448
449     public QueryBuilder<Vertex> createPrivateEdgeTraversal(EdgeType type, String outNodeType, String inNodeType)
450             throws AAIException {
451         Introspector out = loader.introspectorFromName(outNodeType);
452         Introspector in = loader.introspectorFromName(inNodeType);
453         return createPrivateEdgeTraversal(type, out, in);
454     }
455
456     /**
457      *
458      * @param type
459      * @param outNodeType
460      * @param inNodeType
461      * @param labels
462      * @return
463      * @throws AAIException
464      */
465     public QueryBuilder<Vertex> createEdgeTraversalWithLabels(EdgeType type, String outNodeType, String inNodeType,
466             List<String> labels) throws AAIException {
467         Introspector out = loader.introspectorFromName(outNodeType);
468         Introspector in = loader.introspectorFromName(inNodeType);
469
470         return createEdgeTraversalWithLabels(type, out, in, labels);
471     }
472
473     /**
474      *
475      * @param type
476      * @param out
477      * @param in
478      * @param labels
479      * @return
480      */
481     public abstract QueryBuilder<Vertex> createEdgeTraversalWithLabels(EdgeType type, Introspector out, Introspector in,
482             List<String> labels) throws AAIException;
483
484     /**
485      * This method and it's overloaded counterpart are conditional statements.
486      * This method creates an edge traversal step if an optional property is present
487      * This is necessary in cases such as "if the Optional Property 1 is sent,
488      * find all Nodes of type A with edges to Nodes of type B with property 1,
489      * otherwise, simply find all nodes of type A".
490      * 
491      * @param type
492      * @param outNodeType
493      * @param inNodeType
494      * @param value
495      * @return
496      * @throws AAIException
497      */
498     public QueryBuilder<Vertex> createEdgeTraversalIfParameterIsPresent(EdgeType type, String outNodeType,
499             String inNodeType, Object value) throws AAIException {
500         return this.createEdgeTraversal(type, outNodeType, inNodeType);
501     }
502
503     /**
504      * This method and it's overloaded counterpart are conditional statements.
505      * This method skips an edge traversal step if there is an optional property missing.
506      * This is necessary in cases such as "if the Optional Property 1 is sent,
507      * find all Nodes of type A with edges to Nodes of type B with property 1,
508      * otherwise, simply find all nodes of type A".
509      * 
510      * @param type
511      * @param outNodeType
512      * @param inNodeType
513      * @param value
514      * @return
515      * @throws AAIException
516      */
517     public QueryBuilder<Vertex> createEdgeTraversalIfParameterIsPresent(EdgeType type, String outNodeType,
518             String inNodeType, MissingOptionalParameter value) throws AAIException {
519         return (QueryBuilder<Vertex>) this;
520     }
521
522     /**
523      *
524      * @param type
525      * @param outNodeType
526      * @param inNodeType
527      * @return
528      * @throws AAIException
529      */
530     public QueryBuilder<Edge> getEdgesBetween(EdgeType type, String outNodeType, String inNodeType)
531             throws AAIException {
532         this.getEdgesBetweenWithLabels(type, outNodeType, inNodeType, null);
533
534         return (QueryBuilder<Edge>) this;
535
536     }
537
538     /**
539      *
540      * @param type
541      * @param outNodeType
542      * @param inNodeType
543      * @param labels
544      * @return
545      * @throws AAIException
546      */
547     public abstract QueryBuilder<Edge> getEdgesBetweenWithLabels(EdgeType type, String outNodeType, String inNodeType,
548             List<String> labels) throws AAIException;
549
550     /**
551      * Creates the query from URI.
552      *
553      * @param uri the uri
554      * @return the query parser
555      * @throws UnsupportedEncodingException the unsupported encoding exception
556      * @throws AAIException the AAI exception
557      */
558     public abstract QueryParser createQueryFromURI(URI uri) throws UnsupportedEncodingException, AAIException;
559
560     /**
561      * Creates the query from URI.
562      *
563      * @param uri the uri
564      * @param queryParams the query params
565      * @return the query parser
566      * @throws UnsupportedEncodingException the unsupported encoding exception
567      * @throws AAIException the AAI exception
568      */
569     public abstract QueryParser createQueryFromURI(URI uri, MultivaluedMap<String, String> queryParams)
570             throws UnsupportedEncodingException, AAIException;
571
572     /**
573      * Creates a queryparser from a given object name.
574      *
575      * @param objName - name of the object type as it appears in the database
576      * @return
577      */
578     public abstract QueryParser createQueryFromObjectName(String objName);
579
580     /**
581      * Creates the query from relationship.
582      *
583      * @param relationship the relationship
584      * @return the query parser
585      * @throws UnsupportedEncodingException the unsupported encoding exception
586      * @throws AAIException the AAI exception
587      */
588     public abstract QueryParser createQueryFromRelationship(Introspector relationship)
589             throws UnsupportedEncodingException, AAIException;
590
591     /**
592      * Gets the parent query.
593      *
594      * @return the parent query
595      */
596     public abstract QueryBuilder<E> getParentQuery();
597
598     /**
599      * Gets the query.
600      *
601      * @return the query
602      */
603     public abstract <E2> E2 getQuery();
604
605     /**
606      * Form boundary.
607      */
608     public abstract void markParentBoundary();
609
610     public abstract QueryBuilder<E> limit(long amount);
611
612     /**
613      * New instance.
614      *
615      * @param start the start
616      * @return the query builder
617      */
618     public abstract QueryBuilder<E> newInstance(Vertex start);
619
620     /**
621      * New instance.
622      *
623      * @return the query builder
624      */
625     public abstract QueryBuilder<E> newInstance();
626
627     /**
628      * Gets the start.
629      *
630      * @return the start
631      */
632     public abstract Vertex getStart();
633
634     protected Object correctObjectType(Object obj) {
635
636         if (obj != null && obj.getClass().equals(Long.class)) {
637             return Integer.valueOf(obj.toString());
638         }
639
640         return obj;
641     }
642
643     /**
644      * uses all fields in the introspector to create a query
645      *
646      * @param obj
647      * @return
648      */
649     public abstract QueryBuilder<Vertex> exactMatchQuery(Introspector obj);
650
651     /**
652      * lets you join any number of QueryBuilders
653      * <b>be careful about starting with a union it will not use indexes</b>
654      *
655      * @param builder
656      * @return
657      */
658     public abstract QueryBuilder<E> union(QueryBuilder<E>... builder);
659
660     public abstract QueryBuilder<E> where(QueryBuilder<E>... builder);
661
662     public abstract QueryBuilder<E> or(QueryBuilder<E>... builder);
663
664     public abstract QueryBuilder<E> store(String name);
665
666     public abstract QueryBuilder<E> cap(String name);
667
668     public abstract QueryBuilder<E> unfold();
669
670     public abstract QueryBuilder<E> fold();
671
672     public abstract QueryBuilder<E> id();
673
674     public abstract QueryBuilder<E> dedup();
675
676     public abstract QueryBuilder<E> emit();
677
678     public abstract QueryBuilder<E> repeat(QueryBuilder<E> builder);
679
680     public abstract QueryBuilder<Edge> outE();
681
682     public abstract QueryBuilder<Edge> inE();
683
684     public abstract QueryBuilder<Vertex> inV();
685
686     public abstract QueryBuilder<Vertex> outV();
687
688     public abstract QueryBuilder<E> not(QueryBuilder<E> builder);
689
690     public abstract QueryBuilder<E> as(String name);
691
692     public abstract QueryBuilder<E> select(String name);
693
694     public abstract QueryBuilder<E> select(String... names);
695
696     public abstract QueryBuilder<E> until(QueryBuilder<E> builder);
697
698     public abstract QueryBuilder<E> groupCount();
699
700     public abstract QueryBuilder<E> by(String name);
701
702     public abstract QueryBuilder<E> valueMap();
703
704     public abstract QueryBuilder<E> valueMap(String... names);
705
706     public abstract QueryBuilder<E> both();
707
708     public abstract QueryBuilder<Tree> tree();
709
710     /**
711      * Used to prevent the traversal from repeating its path through the graph.
712      * See http://tinkerpop.apache.org/docs/3.0.1-incubating/#simplepath-step for more info.
713      *
714      * @return a QueryBuilder with the simplePath step appended to its traversal
715      */
716     public abstract QueryBuilder<E> simplePath();
717
718     /**
719      *
720      * @return QueryBuilder with the path step appended to its traversal
721      */
722     public abstract QueryBuilder<Path> path();
723
724     public abstract void markContainer();
725
726     public abstract QueryBuilder<E> getContainerQuery();
727
728     public abstract List<E> toList();
729
730     /**
731      * Used to skip step if there is an optional property missing.
732      *
733      * @param key
734      * @param value
735      * @return
736      */
737     public QueryBuilder<Vertex> getVerticesByProperty(String key, MissingOptionalParameter value) {
738         return (QueryBuilder<Vertex>) this;
739     }
740
741     /**
742      * TODO the edge direction is hardcoded here, make it more generic
743      * Returns the parent edge of the vertex
744      *
745      * @return
746      */
747     public QueryBuilder<Edge> getParentEdge() {
748         this.outE().has(EdgeProperty.CONTAINS.toString(), AAIDirection.IN.toString());
749         return (QueryBuilder<Edge>) this;
750     }
751
752     /**
753      * TODO the edge direction is hardcoded here, make it more generic
754      * Returns the parent vertex of the vertex
755      *
756      * @return
757      */
758     public QueryBuilder<Vertex> getParentVertex() {
759         this.getParentEdge().inV();
760         return (QueryBuilder<Vertex>) this;
761     }
762
763     protected abstract QueryBuilder<Edge> has(String key, String value);
764
765     protected void initEdgeIngestor() {
766         // TODO proper spring wiring, but that requires a lot of refactoring so for now we have this
767         ApplicationContext ctx = SpringContextAware.getApplicationContext();
768         EdgeIngestor ei = ctx.getBean(EdgeIngestor.class);
769         setEdgeIngestor(ei);
770     }
771
772     protected void setEdgeIngestor(EdgeIngestor ei) {
773         this.edgeRules = ei;
774     }
775
776     public QueryBuilder<Vertex> getVerticesByNumberProperty(String key, Object value) {
777         return getVerticesByProperty(key, value);
778     }
779
780     public QueryBuilder<Vertex> getVerticesByNumberProperty(String key) {
781         return getVerticesByProperty(key);
782     }
783
784     public QueryBuilder<Vertex> getVerticesByNumberProperty(String key, MissingOptionalParameter value) {
785         return getVerticesByProperty(key, value);
786     }
787
788     protected abstract void vertexHas(String key, Object value);
789
790     protected abstract void vertexHasNot(String key);
791
792     protected abstract void vertexHas(String key);
793
794     // TODO: This probably is not required but need to test
795     // protected abstract void vertexHas(final String key, final P<?> predicate);
796 }