Enhancements for the aai-common library
[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 org.apache.tinkerpop.gremlin.process.traversal.Path;
24 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
25 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
26 import org.apache.tinkerpop.gremlin.structure.Edge;
27 import org.apache.tinkerpop.gremlin.structure.Vertex;
28 import org.onap.aai.config.SpringContextAware;
29 import org.onap.aai.db.props.AAIProperties;
30 import org.onap.aai.edges.EdgeIngestor;
31 import org.onap.aai.edges.enums.AAIDirection;
32 import org.onap.aai.edges.enums.EdgeProperty;
33 import org.onap.aai.edges.enums.EdgeType;
34 import org.onap.aai.exceptions.AAIException;
35 import org.onap.aai.introspection.Introspector;
36 import org.onap.aai.introspection.Loader;
37 import org.onap.aai.parsers.query.QueryParser;
38 import org.onap.aai.parsers.query.QueryParserStrategy;
39 import org.springframework.context.ApplicationContext;
40
41 import javax.ws.rs.core.MultivaluedMap;
42 import java.io.UnsupportedEncodingException;
43 import java.net.URI;
44 import java.util.Iterator;
45 import java.util.List;
46 import java.util.Map;
47
48 /**
49  * The Class QueryBuilder.
50  */
51 public abstract class QueryBuilder<E> implements Iterator<E> {
52
53     protected final GraphTraversalSource source;
54     protected QueryParserStrategy factory = null;
55     protected Loader loader = null;
56     protected EdgeIngestor edgeRules;
57     protected boolean optimize = false;
58     protected Vertex start = null;
59
60     protected int parentStepIndex = 0;
61     protected int containerStepIndex = 0;
62     protected int stepIndex = 0;
63
64     /**
65      * Instantiates a new query builder.
66      *
67      * @param loader the loader
68      */
69     public QueryBuilder(Loader loader, GraphTraversalSource source) {
70         this.loader = loader;
71         this.source = source;
72         initEdgeIngestor();
73     }
74
75     /**
76      * Instantiates a new query builder.
77      *
78      * @param loader the loader
79      * @param start the start
80      */
81     public QueryBuilder(Loader loader, GraphTraversalSource source, Vertex start) {
82         this.loader = loader;
83         this.start = start;
84         this.source = source;
85         initEdgeIngestor();
86     }
87
88     public void changeLoader(Loader loader) {
89         this.loader = loader;
90     }
91
92     protected abstract QueryBuilder<E> cloneQueryAtStep(int index);
93
94     /**
95      * Gets the vertices by indexed property.
96      *
97      * @param key the key
98      * @param value the value
99      * @return the vertices by indexed property
100      */
101     public QueryBuilder<Vertex> getVerticesByIndexedProperty(String key, Object value) {
102         return this.getVerticesByProperty(key, value);
103     }
104
105     /**
106      * Gets the vertices by property.
107      *
108      * @param key the key
109      * @param value the value
110      * @return the vertices by property
111      */
112     public abstract QueryBuilder<Vertex> getVerticesByProperty(String key, Object value);
113
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, List<String> labels) throws AAIException {
417
418         Introspector out = loader.introspectorFromName(outNodeType);
419         Introspector in = loader.introspectorFromName(inNodeType);
420
421         QueryBuilder<Vertex> cousinBuilder = null;
422         QueryBuilder<Vertex> treeBuilder = null;
423         QueryBuilder<Vertex> queryBuilder = null;
424
425         try {
426             cousinBuilder = this.newInstance().createEdgeTraversalWithLabels(EdgeType.COUSIN, out, in, labels);
427         } catch (AAIException e) {
428         }
429
430         if (cousinBuilder != null) {
431             try {
432                 treeBuilder = this.newInstance().createEdgeTraversalWithLabels(EdgeType.TREE, out, in, labels);
433             } catch (AAIException e) {
434             }
435             if (treeBuilder != null) {
436                 queryBuilder = this.union(new QueryBuilder[] {cousinBuilder, treeBuilder});
437             } else {
438                 queryBuilder = this.union(new QueryBuilder[] {cousinBuilder});
439             }
440         } else {
441             treeBuilder = this.newInstance().createEdgeTraversalWithLabels(EdgeType.TREE, out, in, labels);
442             queryBuilder = this.union(new QueryBuilder[] {treeBuilder});
443         }
444
445         return queryBuilder;
446     }
447
448     public QueryBuilder<Vertex> createPrivateEdgeTraversal(EdgeType type, String outNodeType, String inNodeType)
449             throws AAIException {
450         Introspector out = loader.introspectorFromName(outNodeType);
451         Introspector in = loader.introspectorFromName(inNodeType);
452         return createPrivateEdgeTraversal(type, out, in);
453     }
454
455     /**
456      *
457      * @param type
458      * @param outNodeType
459      * @param inNodeType
460      * @param labels
461      * @return
462      * @throws AAIException
463      */
464     public QueryBuilder<Vertex> createEdgeTraversalWithLabels(EdgeType type, String outNodeType, String inNodeType,
465             List<String> labels) throws AAIException {
466         Introspector out = loader.introspectorFromName(outNodeType);
467         Introspector in = loader.introspectorFromName(inNodeType);
468
469         return createEdgeTraversalWithLabels(type, out, in, labels);
470     }
471
472     /**
473      *
474      * @param type
475      * @param out
476      * @param in
477      * @param labels
478      * @return
479      */
480     public abstract QueryBuilder<Vertex> createEdgeTraversalWithLabels(EdgeType type, Introspector out, Introspector in,
481             List<String> labels) throws AAIException;
482
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      * @param type
491      * @param outNodeType
492      * @param inNodeType
493      * @param value
494      * @return
495      * @throws AAIException
496      */
497     public QueryBuilder<Vertex> createEdgeTraversalIfParameterIsPresent(EdgeType type, String outNodeType, String inNodeType,
498                 Object value) throws AAIException {
499         return this.createEdgeTraversal(type, outNodeType, inNodeType);
500     }
501
502     /**
503      * This method and it's overloaded counterpart are conditional statements.
504      * This method skips an edge traversal step if there is an optional property missing.
505      * This is necessary in cases such as "if the Optional Property 1 is sent,
506      * find all Nodes of type A with edges to Nodes of type B with property 1,
507      * otherwise, simply find all nodes of type A".
508      * @param type
509      * @param outNodeType
510      * @param inNodeType
511      * @param value
512      * @return
513      * @throws AAIException
514      */
515     public QueryBuilder<Vertex> createEdgeTraversalIfParameterIsPresent(EdgeType type, String outNodeType, String inNodeType,
516                 MissingOptionalParameter value) throws AAIException {
517         return (QueryBuilder<Vertex>) this;
518     }
519
520     /**
521      *
522      * @param type
523      * @param outNodeType
524      * @param inNodeType
525      * @return
526      * @throws AAIException
527      */
528     public QueryBuilder<Edge> getEdgesBetween(EdgeType type, String outNodeType, String inNodeType)
529             throws AAIException {
530         this.getEdgesBetweenWithLabels(type, outNodeType, inNodeType, null);
531
532         return (QueryBuilder<Edge>) this;
533
534     }
535
536     /**
537      *
538      * @param type
539      * @param outNodeType
540      * @param inNodeType
541      * @param labels
542      * @return
543      * @throws AAIException
544      */
545     public abstract QueryBuilder<Edge> getEdgesBetweenWithLabels(EdgeType type, String outNodeType, String inNodeType,
546             List<String> labels) throws AAIException;
547
548     /**
549      * Creates the query from URI.
550      *
551      * @param uri the uri
552      * @return the query parser
553      * @throws UnsupportedEncodingException the unsupported encoding exception
554      * @throws AAIException the AAI exception
555      */
556     public abstract QueryParser createQueryFromURI(URI uri) throws UnsupportedEncodingException, AAIException;
557
558     /**
559      * Creates the query from URI.
560      *
561      * @param uri the uri
562      * @param queryParams the query params
563      * @return the query parser
564      * @throws UnsupportedEncodingException the unsupported encoding exception
565      * @throws AAIException the AAI exception
566      */
567     public abstract QueryParser createQueryFromURI(URI uri, MultivaluedMap<String, String> queryParams)
568             throws UnsupportedEncodingException, AAIException;
569
570     /**
571      * Creates a queryparser from a given object name.
572      *
573      * @param objName - name of the object type as it appears in the database
574      * @return
575      */
576     public abstract QueryParser createQueryFromObjectName(String objName);
577
578     /**
579      * Creates the query from relationship.
580      *
581      * @param relationship the relationship
582      * @return the query parser
583      * @throws UnsupportedEncodingException the unsupported encoding exception
584      * @throws AAIException the AAI exception
585      */
586     public abstract QueryParser createQueryFromRelationship(Introspector relationship)
587             throws UnsupportedEncodingException, AAIException;
588
589     /**
590      * Gets the parent query.
591      *
592      * @return the parent query
593      */
594     public abstract QueryBuilder<E> getParentQuery();
595
596     /**
597      * Gets the query.
598      *
599      * @return the query
600      */
601     public abstract <E2> E2 getQuery();
602
603     /**
604      * Form boundary.
605      */
606     public abstract void markParentBoundary();
607
608     public abstract QueryBuilder<E> limit(long amount);
609
610     /**
611      * New instance.
612      *
613      * @param start the start
614      * @return the query builder
615      */
616     public abstract QueryBuilder<E> newInstance(Vertex start);
617
618     /**
619      * New instance.
620      *
621      * @return the query builder
622      */
623     public abstract QueryBuilder<E> newInstance();
624
625     /**
626      * Gets the start.
627      *
628      * @return the start
629      */
630     public abstract Vertex getStart();
631
632     protected Object correctObjectType(Object obj) {
633
634         if (obj != null && obj.getClass().equals(Long.class)) {
635             return new Integer(obj.toString());
636         }
637
638         return obj;
639     }
640
641     /**
642      * uses all fields in the introspector to create a query
643      *
644      * @param obj
645      * @return
646      */
647     public abstract QueryBuilder<Vertex> exactMatchQuery(Introspector obj);
648
649     /**
650      * lets you join any number of QueryBuilders
651      * <b>be careful about starting with a union it will not use indexes</b>
652      *
653      * @param builder
654      * @return
655      */
656     public abstract QueryBuilder<E> union(QueryBuilder<E>... builder);
657
658     public abstract QueryBuilder<E> where(QueryBuilder<E>... builder);
659
660     public abstract QueryBuilder<E> or(QueryBuilder<E>... builder);
661
662     public abstract QueryBuilder<E> store(String name);
663
664     public abstract QueryBuilder<E> cap(String name);
665
666     public abstract QueryBuilder<E> unfold();
667
668     public abstract QueryBuilder<E> fold();
669
670     public abstract QueryBuilder<E> id();
671
672     public abstract QueryBuilder<E> dedup();
673
674     public abstract QueryBuilder<E> emit();
675
676     public abstract QueryBuilder<E> repeat(QueryBuilder<E> builder);
677
678     public abstract QueryBuilder<Edge> outE();
679
680     public abstract QueryBuilder<Edge> inE();
681
682     public abstract QueryBuilder<Vertex> inV();
683
684     public abstract QueryBuilder<Vertex> outV();
685
686     public abstract QueryBuilder<E> not(QueryBuilder<E> builder);
687
688     public abstract QueryBuilder<E> as(String name);
689
690     public abstract QueryBuilder<E> select(String name);
691
692     public abstract QueryBuilder<E> select(String... names);
693
694     public abstract QueryBuilder<E> until(QueryBuilder<E> builder);
695
696     public abstract QueryBuilder<E> groupCount();
697
698     public abstract QueryBuilder<E> by(String name);
699
700     public abstract QueryBuilder<E> valueMap();
701
702     public abstract QueryBuilder<E> valueMap(String... names);
703
704     public abstract QueryBuilder<E> both();
705
706     public abstract QueryBuilder<Tree> tree();
707
708     /**
709      * Used to prevent the traversal from repeating its path through the graph.
710      * See http://tinkerpop.apache.org/docs/3.0.1-incubating/#simplepath-step for more info.
711      *
712      * @return a QueryBuilder with the simplePath step appended to its traversal
713      */
714     public abstract QueryBuilder<E> simplePath();
715
716     /**
717      *
718      * @return QueryBuilder with the path step appended to its traversal
719      */
720     public abstract QueryBuilder<Path> path();
721
722     public abstract void markContainer();
723
724     public abstract QueryBuilder<E> getContainerQuery();
725
726     public abstract List<E> toList();
727
728     /**
729      * Used to skip step if there is an optional property missing.
730      *
731      * @param key
732      * @param value
733      * @return
734      */
735     public QueryBuilder<Vertex> getVerticesByProperty(String key, MissingOptionalParameter value) {
736         return (QueryBuilder<Vertex>) this;
737     }
738
739     /**
740      * TODO the edge direction is hardcoded here, make it more generic
741      * Returns the parent edge of the vertex
742      *
743      * @return
744      */
745     public QueryBuilder<Edge> getParentEdge() {
746         this.outE().has(EdgeProperty.CONTAINS.toString(), AAIDirection.IN.toString());
747         return (QueryBuilder<Edge>) this;
748     }
749
750     /**
751      * TODO the edge direction is hardcoded here, make it more generic
752      * Returns the parent vertex of the vertex
753      *
754      * @return
755      */
756     public QueryBuilder<Vertex> getParentVertex() {
757         this.getParentEdge().inV();
758         return (QueryBuilder<Vertex>) this;
759     }
760
761     protected abstract QueryBuilder<Edge> has(String key, String value);
762
763     protected void initEdgeIngestor() {
764         // TODO proper spring wiring, but that requires a lot of refactoring so for now we have this
765         ApplicationContext ctx = SpringContextAware.getApplicationContext();
766         EdgeIngestor ei = ctx.getBean(EdgeIngestor.class);
767         setEdgeIngestor(ei);
768     }
769
770     protected void setEdgeIngestor(EdgeIngestor ei) {
771         this.edgeRules = ei;
772     }
773
774     public QueryBuilder<Vertex> getVerticesByNumberProperty(String key, Object value) {
775         return getVerticesByProperty(key, value);
776     }
777
778     public QueryBuilder<Vertex> getVerticesByNumberProperty(String key) {
779         return getVerticesByProperty(key);
780     }
781
782     public QueryBuilder<Vertex> getVerticesByNumberProperty(String key, MissingOptionalParameter value) {
783         return getVerticesByProperty(key, value);
784     }
785
786     protected abstract void vertexHas(String key, Object value) ;
787
788     protected abstract void vertexHasNot(String key);
789
790     protected abstract void vertexHas(String key);
791
792    //TODO: This probably is not required but need to test
793     // protected abstract void vertexHas(final String key, final P<?> predicate);
794 }