2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 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
11 http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.aai.serialization.engines.query;
23 import java.util.List;
25 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
26 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
27 import org.apache.tinkerpop.gremlin.structure.Direction;
28 import org.apache.tinkerpop.gremlin.structure.Edge;
29 import org.apache.tinkerpop.gremlin.structure.Element;
30 import org.apache.tinkerpop.gremlin.structure.Vertex;
32 import org.openecomp.aai.db.props.AAIProperties;
33 import org.openecomp.aai.introspection.Loader;
35 public abstract class QueryEngine {
37 final protected GraphTraversalSource g;
40 * Instantiates a new query engine.
42 * @param graphEngine the graph engine
44 public QueryEngine (GraphTraversalSource g) {
51 * @param start the start
54 public abstract List<Vertex> findParents(Vertex start);
59 * @param start the start
62 public abstract List<Vertex> findAllChildren(Vertex start);
64 public abstract List<Vertex> findChildrenOfType(Vertex start, String type);
68 * @param start the start
71 public abstract List<Vertex> findDeletable(Vertex start);
73 public Tree<Element> findSubGraph(Vertex start) {
74 return findSubGraph(start, AAIProperties.MAXIMUM_DEPTH, false);
76 public abstract Tree<Element> findSubGraph(Vertex start, int iterations, boolean nodeOnly);
78 * Find related vertices.
80 * @param start the start
81 * @param direction the direction
82 * @param label the label
83 * @param nodeType the node type
86 public abstract List<Vertex> findRelatedVertices(Vertex start, Direction direction, String label, String nodeType);
88 public abstract List<Edge> findEdgesForVersion(Vertex start, Loader loader);
90 public abstract List<Vertex> findCousinVertices(Vertex start);