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 org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
24 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
25 import org.apache.tinkerpop.gremlin.structure.Direction;
26 import org.apache.tinkerpop.gremlin.structure.Edge;
27 import org.apache.tinkerpop.gremlin.structure.Element;
28 import org.apache.tinkerpop.gremlin.structure.Vertex;
29 import org.openecomp.aai.db.props.AAIProperties;
30 import org.openecomp.aai.introspection.Loader;
32 import java.util.List;
34 public abstract class QueryEngine {
36 final protected GraphTraversalSource g;
39 * Instantiates a new query engine.
41 * @param graphEngine the graph engine
43 public QueryEngine (GraphTraversalSource g) {
50 * @param start the start
53 public abstract List<Vertex> findParents(Vertex start);
58 * @param start the start
61 public abstract List<Vertex> findAllChildren(Vertex start);
63 public abstract List<Vertex> findChildrenOfType(Vertex start, String type);
65 public abstract List<Vertex> findChildren(Vertex start);
69 * @param start the start
72 public abstract List<Vertex> findDeletable(Vertex start);
74 public Tree<Element> findSubGraph(Vertex start) {
75 return findSubGraph(start, AAIProperties.MAXIMUM_DEPTH, false);
77 public abstract Tree<Element> findSubGraph(Vertex start, int iterations, boolean nodeOnly);
79 * Find related vertices.
81 * @param start the start
82 * @param direction the direction
83 * @param label the label
84 * @param nodeType the node type
87 public abstract List<Vertex> findRelatedVertices(Vertex start, Direction direction, String label, String nodeType);
89 public abstract List<Edge> findEdgesForVersion(Vertex start, Loader loader);
91 public abstract List<Vertex> findCousinVertices(Vertex start);