atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From suma...@apache.org
Subject [8/8] incubator-atlas git commit: ATLAS-694 Update Atlas code to use graph abstraction layer (jnhagelb via sumasai)
Date Mon, 10 Oct 2016 22:37:56 GMT
ATLAS-694  Update Atlas code to use graph abstraction layer (jnhagelb via sumasai)


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/d2d6ff7d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/d2d6ff7d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/d2d6ff7d

Branch: refs/heads/master
Commit: d2d6ff7d18bf6f6165feaa440359b5a7fc5c2723
Parents: 3e4f28f
Author: Suma Shivaprasad <sumasai.shivaprasad@gmail.com>
Authored: Mon Oct 10 15:37:30 2016 -0700
Committer: Suma Shivaprasad <sumasai.shivaprasad@gmail.com>
Committed: Mon Oct 10 15:37:30 2016 -0700

----------------------------------------------------------------------
 .gitignore                                      |   2 +-
 addons/falcon-bridge/pom.xml                    |   7 +
 addons/hdfs-model/pom.xml                       |   7 +
 .../apache/atlas/fs/model/HDFSModelTest.java    |  25 +-
 addons/hive-bridge/pom.xml                      |   7 +
 .../atlas/hive/bridge/HiveMetaStoreBridge.java  |  11 +-
 addons/sqoop-bridge/pom.xml                     |   7 +
 addons/storm-bridge/pom.xml                     |   8 +
 catalog/pom.xml                                 |  12 +
 .../apache/atlas/catalog/query/BaseQuery.java   |  25 +-
 distro/src/conf/atlas-application.properties    |   6 +
 .../repository/graphdb/AtlasCardinality.java    |  36 ++
 .../atlas/repository/graphdb/AtlasEdge.java     |   8 +-
 .../atlas/repository/graphdb/AtlasElement.java  |   7 +-
 .../atlas/repository/graphdb/AtlasGraph.java    | 102 ++---
 .../repository/graphdb/AtlasGraphIndex.java     |   6 +-
 .../graphdb/AtlasGraphManagement.java           |  71 ++-
 .../repository/graphdb/AtlasGraphQuery.java     |  25 +-
 .../repository/graphdb/AtlasIndexQuery.java     |   2 +-
 .../repository/graphdb/AtlasPropertyKey.java    |   6 +-
 .../atlas/repository/graphdb/AtlasVertex.java   |   2 +-
 .../repository/graphdb/AtlasVertexQuery.java    |   2 +-
 .../atlas/repository/graphdb/GraphDatabase.java |  10 +-
 .../repository/graphdb/GremlinVersion.java      |   2 +-
 .../titan/query/NativeTitanGraphQuery.java      |  10 +-
 .../titan/query/NativeTitanQueryFactory.java    |   6 +-
 .../graphdb/titan/query/TitanGraphQuery.java    |  54 +--
 .../graphdb/titan/query/expr/AndCondition.java  |  24 +-
 .../graphdb/titan/query/expr/HasPredicate.java  |  19 +-
 .../graphdb/titan/query/expr/InPredicate.java   |  14 +-
 .../graphdb/titan/query/expr/OrCondition.java   |  30 +-
 .../titan/query/expr/QueryPredicate.java        |   4 +-
 graphdb/graphdb-impls/pom.xml                   |  57 +++
 graphdb/pom.xml                                 |   4 +
 .../query/graph/GraphCentricQueryBuilder.java   |  62 ++-
 .../graphdb/titan0/GraphDbObjectFactory.java    |  35 +-
 .../graphdb/titan0/Titan0Database.java          | 204 ---------
 .../graphdb/titan0/Titan0DatabaseManager.java   | 170 -------
 .../graphdb/titan0/Titan0Element.java           |  45 +-
 .../repository/graphdb/titan0/Titan0Graph.java  | 104 ++++-
 .../graphdb/titan0/Titan0GraphDatabase.java     | 204 +++++++++
 .../graphdb/titan0/Titan0GraphManagement.java   | 167 +++++++
 .../graphdb/titan0/Titan0IndexQuery.java        |   2 +-
 .../graphdb/titan0/Titan0PropertyKey.java       |  13 +
 .../repository/graphdb/titan0/Titan0Vertex.java |   5 +-
 .../graphdb/titan0/TitanObjectFactory.java      |  15 +-
 .../titan0/query/NativeTitan0GraphQuery.java    |  24 +-
 .../graphdb/titan0/query/Titan0GraphQuery.java  |   9 +-
 .../titan0/AbstractGraphDatabaseTest.java       | 161 +++----
 .../graphdb/titan0/GraphQueryTest.java          | 152 +++---
 .../graphdb/titan0/Titan0DatabaseTest.java      |  11 +-
 .../titan0/Titan0DatabaseValidationTest.java    |   8 +-
 .../test/resources/atlas-application.properties |   2 +-
 pom.xml                                         |  73 ++-
 release-log.txt                                 |   3 +-
 repository/pom.xml                              |   8 +-
 .../atlas/GraphTransactionInterceptor.java      |  20 +-
 .../apache/atlas/RepositoryMetadataModule.java  |  65 +--
 .../atlas/discovery/DataSetLineageService.java  |  21 +-
 .../graph/DefaultGraphPersistenceStrategy.java  |  65 ++-
 .../graph/GraphBackedDiscoveryService.java      | 121 +++--
 .../repository/graph/AtlasGraphProvider.java    |  72 +++
 .../atlas/repository/graph/DeleteHandler.java   |  93 ++--
 .../atlas/repository/graph/FullTextMapper.java  |   6 +-
 .../graph/GraphBackedMetadataRepository.java    |  60 +--
 .../graph/GraphBackedSearchIndexer.java         | 280 +++++------
 .../atlas/repository/graph/GraphHelper.java     | 425 +++++++++++------
 .../atlas/repository/graph/GraphProvider.java   |  27 --
 .../graph/GraphSchemaInitializer.java           |   4 +-
 .../graph/GraphToTypedInstanceMapper.java       | 165 +++----
 .../repository/graph/HardDeleteHandler.java     |   8 +-
 .../repository/graph/IAtlasGraphProvider.java   |  32 ++
 .../repository/graph/SoftDeleteHandler.java     |   8 +-
 .../repository/graph/TitanGraphProvider.java    |  50 --
 .../graph/TypedInstanceToGraphMapper.java       | 266 +++++------
 .../typestore/GraphBackedTypeStore.java         | 147 +++---
 .../atlas/services/DefaultMetadataService.java  |  77 ++--
 .../util/AtlasRepositoryConfiguration.java      |  98 ++++
 .../org/apache/atlas/query/ClosureQuery.scala   |  15 +-
 .../query/GraphPersistenceStrategies.scala      | 200 +++++---
 .../apache/atlas/query/GremlinEvaluator.scala   | 119 +++--
 .../org/apache/atlas/query/GremlinQuery.scala   | 431 +++++++++++------
 .../org/apache/atlas/query/QueryProcessor.scala |  14 +-
 .../org/apache/atlas/BaseRepositoryTest.java    |  44 +-
 .../atlas/RepositoryServiceLoadingTest.java     |  11 +-
 .../test/java/org/apache/atlas/TestUtils.java   | 115 ++++-
 .../GraphBackedDiscoveryServiceTest.java        |  43 +-
 ...hBackedMetadataRepositoryDeleteTestBase.java | 150 +++---
 .../GraphBackedMetadataRepositoryTest.java      | 122 +++--
 .../GraphBackedRepositoryHardDeleteTest.java    |  10 +-
 .../GraphBackedRepositorySoftDeleteTest.java    |   8 +-
 .../graph/GraphBackedSearchIndexerMockTest.java |  56 +--
 .../graph/GraphBackedSearchIndexerTest.java     | 188 ++++----
 .../repository/graph/GraphHelperMockTest.java   |  64 +--
 .../atlas/repository/graph/GraphHelperTest.java |  46 +-
 .../graph/GraphRepoMapperScaleTest.java         |  77 ++--
 .../typestore/GraphBackedTypeStoreTest.java     |  67 ++-
 .../typestore/StoreBackedTypeCacheTest.java     |  44 +-
 .../StoreBackedTypeCacheTestModule.java         |   3 +-
 .../service/DefaultMetadataServiceTest.java     | 131 ++----
 ...StoreBackedTypeCacheMetadataServiceTest.java |  25 +-
 .../java/org/apache/atlas/utils/HiveModel.java  | 303 ++++++++++++
 .../org/apache/atlas/query/GremlinTest.scala    |  51 ++-
 .../org/apache/atlas/query/GremlinTest2.scala   |  52 ++-
 .../apache/atlas/query/HiveTitanSample.scala    | 459 +++++++------------
 .../apache/atlas/query/LineageQueryTest.scala   |  56 ++-
 .../apache/atlas/query/QueryTestsUtils.scala    |  70 +--
 .../atlas/typesystem/types/Multiplicity.java    |   5 +
 .../test/resources/atlas-application.properties |   9 +
 webapp/pom.xml                                  |  26 +-
 .../atlas/web/listeners/GuiceServletConfig.java |  38 +-
 .../apache/atlas/web/resources/BaseService.java |  33 +-
 .../NotificationHookConsumerKafkaTest.java      |  85 ++--
 .../web/listeners/TestGuiceServletConfig.java   |  20 +-
 114 files changed, 4184 insertions(+), 3211 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index e10adbc..d2fbdc0 100755
--- a/.gitignore
+++ b/.gitignore
@@ -18,7 +18,7 @@
 target
 dependency-reduced-pom.xml
 core*.dmp
-
+pom.xml.releaseBackup
 
 # IntelliJ
 *.iml

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/addons/falcon-bridge/pom.xml
----------------------------------------------------------------------
diff --git a/addons/falcon-bridge/pom.xml b/addons/falcon-bridge/pom.xml
index 44dacb8..de3e810 100644
--- a/addons/falcon-bridge/pom.xml
+++ b/addons/falcon-bridge/pom.xml
@@ -93,6 +93,13 @@
             <artifactId>jetty-server</artifactId>
             <scope>test</scope>
         </dependency>
+	
+        <dependency>
+            <groupId>org.apache.atlas</groupId>
+            <artifactId>atlas-graphdb-impls</artifactId>
+            <type>pom</type>
+            <scope>test</scope>
+        </dependency>
 
         <dependency>
             <groupId>org.apache.atlas</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/addons/hdfs-model/pom.xml
----------------------------------------------------------------------
diff --git a/addons/hdfs-model/pom.xml b/addons/hdfs-model/pom.xml
index bd1debe..e2ab029 100644
--- a/addons/hdfs-model/pom.xml
+++ b/addons/hdfs-model/pom.xml
@@ -73,6 +73,13 @@
 
         <dependency>
             <groupId>org.apache.atlas</groupId>
+            <artifactId>atlas-graphdb-impls</artifactId>
+            <type>pom</type>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.atlas</groupId>
             <artifactId>atlas-repository</artifactId>
             <scope>test</scope>
         </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/addons/hdfs-model/src/test/java/org/apache/atlas/fs/model/HDFSModelTest.java
----------------------------------------------------------------------
diff --git a/addons/hdfs-model/src/test/java/org/apache/atlas/fs/model/HDFSModelTest.java b/addons/hdfs-model/src/test/java/org/apache/atlas/fs/model/HDFSModelTest.java
index ac60294..5944da8 100644
--- a/addons/hdfs-model/src/test/java/org/apache/atlas/fs/model/HDFSModelTest.java
+++ b/addons/hdfs-model/src/test/java/org/apache/atlas/fs/model/HDFSModelTest.java
@@ -18,10 +18,11 @@
 
 package org.apache.atlas.fs.model;
 
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.util.TitanCleanup;
+import javax.inject.Inject;
+
 import org.apache.atlas.RepositoryMetadataModule;
-import org.apache.atlas.repository.graph.GraphProvider;
+import org.apache.atlas.repository.graph.AtlasGraphProvider;
+import org.apache.atlas.repository.graphdb.AtlasGraph;
 import org.apache.atlas.services.MetadataService;
 import org.apache.atlas.typesystem.TypesDef;
 import org.apache.atlas.typesystem.json.TypesSerialization;
@@ -33,11 +34,10 @@ import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
+
 import scala.Enumeration;
 import scala.collection.Iterator;
 
-import javax.inject.Inject;
-
 @Test
 @Guice(modules = RepositoryMetadataModule.class)
 public class HDFSModelTest {
@@ -48,9 +48,6 @@ public class HDFSModelTest {
     @Inject
     private MetadataService metadataService;
 
-    @Inject
-    private GraphProvider<TitanGraph> graphProvider;
-
     @BeforeClass
     public void setUp() throws Exception {
     }
@@ -58,17 +55,7 @@ public class HDFSModelTest {
     @AfterClass
     public void tearDown() throws Exception {
         TypeSystem.getInstance().reset();
-        try {
-            //TODO - Fix failure during shutdown while using BDB
-            graphProvider.get().shutdown();
-        } catch(Exception e) {
-            e.printStackTrace();
-        }
-        try {
-            TitanCleanup.clear(graphProvider.get());
-        } catch(Exception e) {
-            e.printStackTrace();
-        }
+        AtlasGraphProvider.cleanup();
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/addons/hive-bridge/pom.xml
----------------------------------------------------------------------
diff --git a/addons/hive-bridge/pom.xml b/addons/hive-bridge/pom.xml
index 3b8f576..884791d 100755
--- a/addons/hive-bridge/pom.xml
+++ b/addons/hive-bridge/pom.xml
@@ -149,6 +149,13 @@
 
         <dependency>
             <groupId>org.apache.atlas</groupId>
+            <artifactId>atlas-graphdb-impls</artifactId>
+            <type>pom</type>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.atlas</groupId>
             <artifactId>atlas-typesystem</artifactId>
             <classifier>tests</classifier>
             <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
----------------------------------------------------------------------
diff --git a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
index ad7a4a5..31ce140 100755
--- a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
+++ b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
@@ -18,8 +18,10 @@
 
 package org.apache.atlas.hive.bridge;
 
-import com.google.common.annotations.VisibleForTesting;
-import com.sun.jersey.api.client.ClientResponse;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
 import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasConstants;
@@ -57,9 +59,8 @@ import org.apache.hadoop.security.UserGroupInformation;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+import com.google.common.annotations.VisibleForTesting;
+import com.sun.jersey.api.client.ClientResponse;
 
 /**
  * A Bridge Utility that imports metadata from the Hive Meta Store

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/addons/sqoop-bridge/pom.xml
----------------------------------------------------------------------
diff --git a/addons/sqoop-bridge/pom.xml b/addons/sqoop-bridge/pom.xml
index fa5bd8f..9ac411e 100644
--- a/addons/sqoop-bridge/pom.xml
+++ b/addons/sqoop-bridge/pom.xml
@@ -151,6 +151,13 @@
 
         <dependency>
             <groupId>org.apache.atlas</groupId>
+            <artifactId>atlas-graphdb-impls</artifactId>
+            <type>pom</type>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.atlas</groupId>
             <artifactId>atlas-typesystem</artifactId>
             <classifier>tests</classifier>
             <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/addons/storm-bridge/pom.xml
----------------------------------------------------------------------
diff --git a/addons/storm-bridge/pom.xml b/addons/storm-bridge/pom.xml
index 4b3816f..fcb6e01 100644
--- a/addons/storm-bridge/pom.xml
+++ b/addons/storm-bridge/pom.xml
@@ -117,6 +117,14 @@
         </dependency>
 
         <!-- to bring up atlas server for integration tests -->
+
+        <dependency>
+            <groupId>org.apache.atlas</groupId>
+            <artifactId>atlas-graphdb-impls</artifactId>
+            <type>pom</type>
+            <scope>test</scope>
+        </dependency>
+
         <dependency>
             <groupId>org.apache.atlas</groupId>
             <artifactId>atlas-webapp</artifactId>

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/catalog/pom.xml
----------------------------------------------------------------------
diff --git a/catalog/pom.xml b/catalog/pom.xml
index 2f58a8f..00e56dc 100755
--- a/catalog/pom.xml
+++ b/catalog/pom.xml
@@ -60,6 +60,18 @@
         </dependency>
 
         <dependency>
+            <groupId>org.apache.atlas</groupId>
+            <artifactId>atlas-graphdb-api</artifactId>
+        </dependency>
+
+	<!-- for now, catalog can only be used with Titan 0.5.4 -->
+	<dependency>
+            <groupId>org.apache.atlas</groupId>
+            <artifactId>atlas-graphdb-titan0</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
             <groupId>joda-time</groupId>
             <artifactId>joda-time</artifactId>
         </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/catalog/src/main/java/org/apache/atlas/catalog/query/BaseQuery.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/atlas/catalog/query/BaseQuery.java b/catalog/src/main/java/org/apache/atlas/catalog/query/BaseQuery.java
index e7bb505..6a2ba53 100644
--- a/catalog/src/main/java/org/apache/atlas/catalog/query/BaseQuery.java
+++ b/catalog/src/main/java/org/apache/atlas/catalog/query/BaseQuery.java
@@ -18,12 +18,11 @@
 
 package org.apache.atlas.catalog.query;
 
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.tinkerpop.blueprints.Compare;
-import com.tinkerpop.blueprints.Vertex;
-import com.tinkerpop.gremlin.java.GremlinPipeline;
-import com.tinkerpop.pipes.Pipe;
-import com.tinkerpop.pipes.filter.PropertyFilterPipe;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
 import org.apache.atlas.catalog.Request;
 import org.apache.atlas.catalog.VertexWrapper;
 import org.apache.atlas.catalog.definition.ResourceDefinition;
@@ -31,13 +30,15 @@ import org.apache.atlas.catalog.exception.ResourceNotFoundException;
 import org.apache.atlas.catalog.projection.Projection;
 import org.apache.atlas.catalog.projection.ProjectionResult;
 import org.apache.atlas.repository.Constants;
-import org.apache.atlas.repository.graph.TitanGraphProvider;
+import org.apache.atlas.repository.graphdb.titan0.Titan0GraphDatabase;
 import org.apache.atlas.typesystem.persistence.Id;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
+import com.thinkaurelius.titan.core.TitanGraph;
+import com.tinkerpop.blueprints.Compare;
+import com.tinkerpop.blueprints.Vertex;
+import com.tinkerpop.gremlin.java.GremlinPipeline;
+import com.tinkerpop.pipes.Pipe;
+import com.tinkerpop.pipes.filter.PropertyFilterPipe;
 
 /**
  * Base Query implementation.
@@ -167,7 +168,7 @@ public abstract class BaseQuery implements AtlasQuery {
     //todo: abstract
     // Underlying method is synchronized and caches the graph in a static field
     protected TitanGraph getGraph() {
-        return TitanGraphProvider.getGraphInstance();
+        return Titan0GraphDatabase.getGraphInstance();
     }
 
     protected VertexWrapper wrapVertex(Vertex v) {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/distro/src/conf/atlas-application.properties
----------------------------------------------------------------------
diff --git a/distro/src/conf/atlas-application.properties b/distro/src/conf/atlas-application.properties
index d334600..0349ccc 100755
--- a/distro/src/conf/atlas-application.properties
+++ b/distro/src/conf/atlas-application.properties
@@ -17,6 +17,12 @@
 #
 
 #########  Graph Database Configs  #########
+
+# Graph Database
+
+#Configures the graph database to use.  Defaults to Titan 0.5.4.
+#atlas.graphdb.backend=org.apache.atlas.repository.graphdb.titan0.Titan0GraphDatabase
+
 # Graph Storage
 atlas.graph.storage.backend=${titan.storage.backend}
 atlas.graph.storage.hbase.table=apache_atlas_titan

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasCardinality.java
----------------------------------------------------------------------
diff --git a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasCardinality.java b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasCardinality.java
new file mode 100644
index 0000000..996a226
--- /dev/null
+++ b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasCardinality.java
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.repository.graphdb;
+
+/**
+ * Enumeration of vertex property cardinalities.
+ *
+ */
+public enum AtlasCardinality {
+    SINGLE(false),
+    LIST(true),
+    SET(true);
+
+    private boolean isMany;
+    AtlasCardinality(boolean isMany) {
+        this.isMany = isMany;
+    }
+    public boolean isMany() {
+        return isMany;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasEdge.java
----------------------------------------------------------------------
diff --git a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasEdge.java b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasEdge.java
index dd4b7e6..b1cffb9 100644
--- a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasEdge.java
+++ b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasEdge.java
@@ -19,7 +19,7 @@
 package org.apache.atlas.repository.graphdb;
 
 /**
- * Represent an edge in the graph
+ * Represent an edge in the graph.
  *
  * @param <V> vertex class used by the graph
  * @param <E> edge class used by the graph
@@ -27,14 +27,14 @@ package org.apache.atlas.repository.graphdb;
 public interface AtlasEdge<V, E> extends AtlasElement {
 
     /**
-     * Gets the incoming vertex for this edge
+     * Gets the incoming vertex for this edge.
      * @param in
      * @return
      */
     AtlasVertex<V, E> getInVertex();
 
     /**
-     * Gets the outgoing vertex for this edge
+     * Gets the outgoing vertex for this edge.
      *
      * @param in
      * @return
@@ -55,6 +55,6 @@ public interface AtlasEdge<V, E> extends AtlasElement {
      *
      * @return
      */
-    public E getE();
+    E getE();
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasElement.java
----------------------------------------------------------------------
diff --git a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasElement.java b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasElement.java
index 1bc0fc3..24f7a7d 100644
--- a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasElement.java
+++ b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasElement.java
@@ -123,9 +123,10 @@ public interface AtlasElement {
 
 
     /**
-     * Creates a Jettison JSONObject from this Element
+     * Creates a Jettison JSONObject from this Element.
      *
-     * @param propertyKeys The property keys at the root of the element to serialize.  If null, then all keys are serialized.
+     * @param propertyKeys The property keys at the root of the element to serialize.
+     *  If null, then all keys are serialized.
      */
     JSONObject toJson(Set<String> propertyKeys) throws JSONException;
 
@@ -156,7 +157,7 @@ public interface AtlasElement {
      *
      * @return
      */
-    public String getIdForDisplay();
+    String getIdForDisplay();
 
     /**
      * Whether or not an id has been assigned yet for this Element.  This can happen if the element has been created

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraph.java
----------------------------------------------------------------------
diff --git a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraph.java b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraph.java
index 995c545..22280d5 100644
--- a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraph.java
+++ b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraph.java
@@ -19,7 +19,6 @@ package org.apache.atlas.repository.graphdb;
 
 import java.io.IOException;
 import java.io.OutputStream;
-import java.util.List;
 import java.util.Set;
 
 import javax.script.ScriptException;
@@ -27,7 +26,7 @@ import javax.script.ScriptException;
 import org.apache.atlas.typesystem.types.IDataType;
 
 /**
- * Represents a graph
+ * Represents a graph.
  *
  * @param <V> vertex implementation class
  * @param <E> edge implementation class
@@ -35,7 +34,7 @@ import org.apache.atlas.typesystem.types.IDataType;
 public interface AtlasGraph<V, E> {
 
     /**
-     * Adds an edge to the graph
+     * Adds an edge to the graph.
      *
      * @param outVertex
      * @param inVertex
@@ -45,14 +44,14 @@ public interface AtlasGraph<V, E> {
     AtlasEdge<V, E> addEdge(AtlasVertex<V, E> outVertex, AtlasVertex<V, E> inVertex, String label);
 
     /**
-     * Adds a vertex to the graph
+     * Adds a vertex to the graph.
      *
      * @return
      */
     AtlasVertex<V, E> addVertex();
 
     /**
-     * Removes the specified edge from the graph
+     * Removes the specified edge from the graph.
      *
      * @param edge
      */
@@ -136,18 +135,21 @@ public interface AtlasGraph<V, E> {
     Iterable<AtlasVertex<V, E>> getVertices(String key, Object value);
 
     /**
-     * Creates a graph query
+     * Creates a graph query.
+     *
      * @return
      */
     AtlasGraphQuery<V, E> query();
 
     /**
-     * Creates an index query
+     * Creates an index query.
      *
      * @param indexName index name
      * @param queryString the query
      *
-     * @see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html">Elastic Search Reference</a> for query syntax
+     * @see <a
+     * href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html">
+     * Elastic Search Reference</a> for query syntax
      */
     AtlasIndexQuery<V, E> indexQuery(String indexName, String queryString);
 
@@ -176,14 +178,14 @@ public interface AtlasGraph<V, E> {
     /**
      * Deletes all data in the graph.  May or may not delete
      * the indices, depending on the what the underlying graph supports.
-     * 
+     *
      * For testing only.
-     * 
+     *
      */
     void clear();
 
     /**
-     * Converts the graph to gson and writes it to the specified stream
+     * Converts the graph to gson and writes it to the specified stream.
      *
      * @param os
      * @throws IOException
@@ -193,59 +195,6 @@ public interface AtlasGraph<V, E> {
     //the following methods insulate Atlas from the details
     //of the interaction with Gremlin
 
-
-    /**
-     *
-     * When we construct Gremlin select queries, the information we request
-     * is grouped by the vertex the information is coming from.  Each vertex
-     * is assigned a column name which uniquely identifies it.  The queries
-     * are specially formatted so that the value associated with each of
-     * these column names is an array with the various things we need
-     * about that particular vertex.  The query evaluator creates a mapping
-     * that knows what index each bit of information is stored at within
-     * this array.
-     * <p/>
-     * When we execute a Gremlin query, the exact java objects we get
-     * back vary depending on whether Gremlin 2 or Gremlin 3 is being used.
-     * This method takes as input a raw row result that was obtained by
-     * executing a Gremlin query and extracts the value that was found
-     * at the given index in the array for the given column name.
-     * <p/>
-     * If the value found is a vertex or edge, it is automatically converted
-     * to an AtlasVertex/AtlasEdge.
-     *
-     * @param rowValue the raw row value that was returned by Gremin
-     * @param colName the column name to use
-     * @param idx the index of the value within the column to retrieve.
-     *
-     */
-    Object getGremlinColumnValue(Object rowValue, String colName, int idx);
-
-    /**
-     * When Gremlin queries are executed, they return
-     * Vertex and Edge objects that are specific to the underlying
-     * graph database.  This method provides a way to convert these
-     * objects back into the AtlasVertex/AtlasEdge objects that
-     * Atlas requires.
-     *
-     * @param rawValue the value that was obtained from Gremlin
-     * @return either an AtlasEdge, an AtlasVertex, or the original
-     * value depending on whether the rawValue represents an edge,
-     * vertex, or something else.
-     *
-     */
-    Object convertGremlinValue(Object rawValue);
-
-    /**
-     * Gremlin 2 and Gremlin 3 represent the results of "path"
-     * queries differently.  This method takes as input the
-     * path from Gremlin and returns the list of objects in the path.
-     *
-     * @param rawValue
-     * @return
-     */
-    List<Object> convertPathQueryResultToList(Object rawValue);
-
     /**
      * This method is used in the generation of queries.  It is used to
      * convert property values from the value that is stored in the graph
@@ -256,7 +205,7 @@ public interface AtlasGraph<V, E> {
      * @return
      */
     String generatePersisentToLogicalConversionExpression(String valueExpr, IDataType<?> type);
-     
+
     /**
      * Indicates whether or not stored values with the specified type need to be converted
      * within generated gremlin queries before they can be compared with literal values.
@@ -292,7 +241,7 @@ public interface AtlasGraph<V, E> {
      * @return
      */
     String getInitialIndexedPredicate();
-    
+
     /**
      * As an optimization, a graph database implementation may want to retrieve additional
      * information about the query results.  For example, in the IBM Graph implementation,
@@ -303,12 +252,25 @@ public interface AtlasGraph<V, E> {
     String getOutputTransformationPredicate(boolean isSelect, boolean isPath);
 
     /**
-     * Executes a gremlin query, returns an object with the raw
-     * result.
+     * Executes a Gremlin script, returns an object with the result.
      *
      * @param gremlinQuery
+     * @param isPath whether this is a path query
+     *
+     * @return the result from executing the script
+     *
+     * @throws ScriptException
+     */
+    Object executeGremlinScript(String query, boolean isPath) throws ScriptException;
+
+    /**
+     * Convenience method to check whether the given property is
+     * a multi-property.
+     *
+     * @param name
      * @return
      */
-    Object executeGremlinScript(String gremlinQuery) throws ScriptException;
+    boolean isMultiProperty(String name);
+
 
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraphIndex.java
----------------------------------------------------------------------
diff --git a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraphIndex.java b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraphIndex.java
index 41194d3..cb2d701 100644
--- a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraphIndex.java
+++ b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraphIndex.java
@@ -21,7 +21,7 @@ package org.apache.atlas.repository.graphdb;
 import java.util.Set;
 
 /**
- * Represents a graph index on the database
+ * Represents a graph index on the database.
  */
 public interface AtlasGraphIndex {
 
@@ -39,14 +39,14 @@ public interface AtlasGraphIndex {
     boolean isCompositeIndex();
 
     /**
-     * Indicates if the index applies to edges
+     * Indicates if the index applies to edges.
      *
      * @return
      */
     boolean isEdgeIndex();
 
     /**
-     * Indicates if the index applies to vertices
+     * Indicates if the index applies to vertices.
      *
      * @return
      */

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraphManagement.java
----------------------------------------------------------------------
diff --git a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraphManagement.java b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraphManagement.java
index c8cd284..5efd7c0 100644
--- a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraphManagement.java
+++ b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraphManagement.java
@@ -18,28 +18,14 @@
 
 package org.apache.atlas.repository.graphdb;
 
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.atlas.AtlasException;
-import org.apache.atlas.repository.Constants;
-import org.apache.atlas.typesystem.types.Multiplicity;
+import java.util.List;
 
 /**
- * Management interface for a graph
+ * Management interface for a graph.
  *
  */
 public interface AtlasGraphManagement {
 
-    public static final Set<String> MULTIPLICITY_MANY_PROPERTY_KEYS =
-            Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(
-                    Constants.SUPER_TYPES_PROPERTY_KEY,
-                    Constants.TRAIT_NAMES_PROPERTY_KEY )));
-
-
     /**
      * Checks whether a property with the given key has been defined in the graph schema.
      *
@@ -49,25 +35,7 @@ public interface AtlasGraphManagement {
     boolean containsPropertyKey(String key);
 
     /**
-     * Creates a mixed Vertex index for the graph
-     *
-     * @param index the name of the index to create
-     * @param backingIndex the name of the backing index to use
-     */
-    void buildMixedVertexIndex(String index, String backingIndex);
-
-
-    /**
-     * Creates a mixed Edge index for the graph
-     *
-     * @param index the name of the index to create
-     * @param backingIndex the name of the backing index to use
-     */
-    void buildMixedEdgeIndex(String index, String backingIndex);
-
-
-    /**
-     * Creates a full text index for the given property
+     * Creates a full text index for the given property.
      *
      * @param  indexName the name of the index to create
      * @param propertyKey full text property to index
@@ -92,7 +60,7 @@ public interface AtlasGraphManagement {
      * @param cardinality
      * @return
      */
-    AtlasPropertyKey makePropertyKey(String propertyName, Class propertyClass, Multiplicity multiplicity);
+    AtlasPropertyKey makePropertyKey(String propertyName, Class propertyClass, AtlasCardinality cardinality);
 
     /**
      * @param propertyKey
@@ -107,7 +75,24 @@ public interface AtlasGraphManagement {
      * @param propertyKey
      * @param isUnique
      */
-    void createCompositeIndex(String propertyName, AtlasPropertyKey propertyKey, boolean isUnique);
+    void createExactMatchIndex(String propertyName, boolean isUnique, List<AtlasPropertyKey> propertyKeys);
+
+    /**
+     * Looks up the index with the specified name in the graph.  Returns null if
+     * there is no index with the given name.
+     *
+     * @param edgeIndex
+     * @return
+     */
+    AtlasGraphIndex getGraphIndex(String indexName);
+
+    /**
+     * Creates a mixed Vertex index for the graph.
+     *
+     * @param index the name of the index to create
+     * @param backingIndex the name of the backing index to use
+     */
+    void createVertexIndex(String name, String backingIndex, List<AtlasPropertyKey> propertyKeys);
 
     /**
      * Adds a property key to the given index in the graph.
@@ -115,16 +100,14 @@ public interface AtlasGraphManagement {
      * @param vertexIndex
      * @param propertyKey
      */
-    void addIndexKey(String vertexIndex, AtlasPropertyKey propertyKey);
+    void addVertexIndexKey(String vertexIndex, AtlasPropertyKey propertyKey);
 
     /**
-     * Looks up the index with the specified name in the graph.  Returns null if
-     * there is no index with the given name.
+     * Creates a mixed Edge index for the graph.
      *
-     * @param edgeIndex
-     * @return
+     * @param index the name of the index to create
+     * @param backingIndex the name of the backing index to use
      */
-    AtlasGraphIndex getGraphIndex(String indexName);
-
+    void createEdgeIndex(String index, String backingIndex);
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraphQuery.java
----------------------------------------------------------------------
diff --git a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraphQuery.java b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraphQuery.java
index 9344749..5d60c67 100644
--- a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraphQuery.java
+++ b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraphQuery.java
@@ -21,8 +21,6 @@ package org.apache.atlas.repository.graphdb;
 import java.util.Collection;
 import java.util.List;
 
-import org.apache.atlas.AtlasException;
-
 /**
  * Represents a query against the graph within the context of the
  * current transaction.
@@ -30,7 +28,7 @@ import org.apache.atlas.AtlasException;
  * @param <V> vertex class used by the graph
  * @param <E> edge class used by the graph
  */
-public interface AtlasGraphQuery<V,E> {
+public interface AtlasGraphQuery<V, E> {
 
     /**
      * Adds a predicate that the returned vertices must have the specified
@@ -41,7 +39,7 @@ public interface AtlasGraphQuery<V,E> {
      * @param value
      * @return
      */
-    AtlasGraphQuery<V,E> has(String propertyKey, Object value);
+    AtlasGraphQuery<V, E> has(String propertyKey, Object value);
 
     /**
      * Adds a predicate that the returned vertices must have the specified
@@ -52,7 +50,7 @@ public interface AtlasGraphQuery<V,E> {
      * @param value
      * @return
      */
-    AtlasGraphQuery<V,E> in(String propertyKey, Collection<? extends Object> values);
+    AtlasGraphQuery<V, E> in(String propertyKey, Collection<? extends Object> values);
 
 
     /**
@@ -71,7 +69,7 @@ public interface AtlasGraphQuery<V,E> {
      * @param value
      * @return
      */
-    AtlasGraphQuery<V,E> has(String propertyKey, ComparisionOperator compMethod, Object values);
+    AtlasGraphQuery<V, E> has(String propertyKey, ComparisionOperator compMethod, Object values);
 
     /**
      * Adds a predicate that the vertices returned must satisfy the
@@ -80,17 +78,20 @@ public interface AtlasGraphQuery<V,E> {
      * @param childQueries
      * @return
      */
-    AtlasGraphQuery<V,E> or(List<AtlasGraphQuery<V,E>> childQueries);
+    AtlasGraphQuery<V, E> or(List<AtlasGraphQuery<V, E>> childQueries);
 
     /**
-     * Creates a child query that can be used to add "or" conditions
+     * Creates a child query that can be used to add "or" conditions.
      *
      * @return
      */
-    AtlasGraphQuery<V,E> createChildQuery();
+    AtlasGraphQuery<V, E> createChildQuery();
 
 
-    public static enum ComparisionOperator {
+    /**
+     * Comparison operators that can be used in an AtlasGraphQuery.
+     */
+    enum ComparisionOperator {
         GREATER_THAN_EQUAL,
         EQUAL,
         LESS_THAN_EQUAL,
@@ -106,8 +107,8 @@ public interface AtlasGraphQuery<V,E> {
     AtlasGraphQuery<V, E> addConditionsFrom(AtlasGraphQuery<V, E> otherQuery);
 
     /**
-     * Whether or not this is a child query
-     * 
+     * Whether or not this is a child query.
+     *
      * @return
      */
     boolean isChildQuery();

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasIndexQuery.java
----------------------------------------------------------------------
diff --git a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasIndexQuery.java b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasIndexQuery.java
index e719d30..f2e0f9d 100644
--- a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasIndexQuery.java
+++ b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasIndexQuery.java
@@ -44,7 +44,7 @@ public interface AtlasIndexQuery<V, E> {
     public interface Result<V, E> {
 
         /**
-         * Gets the vertex for this result
+         * Gets the vertex for this result.
          */
         AtlasVertex<V, E> getVertex();
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasPropertyKey.java
----------------------------------------------------------------------
diff --git a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasPropertyKey.java b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasPropertyKey.java
index 315ecdd..88979c2 100644
--- a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasPropertyKey.java
+++ b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasPropertyKey.java
@@ -19,12 +19,12 @@
 package org.apache.atlas.repository.graphdb;
 
 /**
- * Represent a property key
+ * Represent a property key.
  *
- * @param <V> vertex class used by the graph
- * @param <E> edge class used by the graph
  */
 public interface AtlasPropertyKey {
 
     String getName();
+
+    AtlasCardinality getCardinality();
 }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasVertex.java
----------------------------------------------------------------------
diff --git a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasVertex.java b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasVertex.java
index fff6fb7..a68d8eb 100644
--- a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasVertex.java
+++ b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasVertex.java
@@ -18,7 +18,7 @@
 package org.apache.atlas.repository.graphdb;
 
 /**
- * Represents a Vertex
+ * Represents a Vertex.
  *
  * @param <V> vertex class used by the graph
  * @param <E> edge class used by the graph

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasVertexQuery.java
----------------------------------------------------------------------
diff --git a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasVertexQuery.java b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasVertexQuery.java
index 366cfe1..53f490f 100644
--- a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasVertexQuery.java
+++ b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasVertexQuery.java
@@ -27,7 +27,7 @@ package org.apache.atlas.repository.graphdb;
 public interface AtlasVertexQuery<V, E> {
 
     /**
-     * Specifies the edge direction that should be query
+     * Specifies the edge direction that should be query.
      *
      * @param queryDirection
      * @return

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/GraphDatabase.java
----------------------------------------------------------------------
diff --git a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/GraphDatabase.java b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/GraphDatabase.java
index 37acda5..3dfc6e8 100644
--- a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/GraphDatabase.java
+++ b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/GraphDatabase.java
@@ -18,7 +18,7 @@
 package org.apache.atlas.repository.graphdb;
 
 /**
- * Represents a graph database
+ * Represents a graph database.
  *
  * @param <V> vertex class used by the graph database
  * @param <E> edge class used by the graph database
@@ -32,13 +32,13 @@ public interface GraphDatabase<V, E> {
     boolean isGraphLoaded();
 
     /**
-     * Gets the graph, loading it if it has not been loaded already
+     * Gets the graph, loading it if it has not been loaded already.
      * @return
      */
     AtlasGraph<V, E> getGraph();
 
     /**
-     * Sets things up so that getGraph() will return a graph that can be used for running 
+     * Sets things up so that getGraph() will return a graph that can be used for running
      * tests.
      */
     void initializeTestGraph();
@@ -46,5 +46,5 @@ public interface GraphDatabase<V, E> {
     /**
      * Removes the test graph that was created.
      */
-    void removeTestGraph();
-}
\ No newline at end of file
+    void cleanup();
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/GremlinVersion.java
----------------------------------------------------------------------
diff --git a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/GremlinVersion.java b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/GremlinVersion.java
index f328d3c..b80e067 100644
--- a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/GremlinVersion.java
+++ b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/GremlinVersion.java
@@ -19,7 +19,7 @@
 package org.apache.atlas.repository.graphdb;
 
 /**
- * Enumeration of the supported versions of Gremlin
+ * Enumeration of the supported versions of Gremlin.
  *
  *
  */

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/NativeTitanGraphQuery.java
----------------------------------------------------------------------
diff --git a/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/NativeTitanGraphQuery.java b/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/NativeTitanGraphQuery.java
index b79bf79..39c309d 100644
--- a/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/NativeTitanGraphQuery.java
+++ b/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/NativeTitanGraphQuery.java
@@ -31,17 +31,17 @@ import org.apache.atlas.repository.graphdb.AtlasVertex;
  * @param <V>
  * @param <E>
  */
-public interface NativeTitanGraphQuery<V,E> {
+public interface NativeTitanGraphQuery<V, E> {
 
     /**
-     * Executes the graph query
+     * Executes the graph query.
      * @return
      */
-    Iterable<AtlasVertex<V,E>> vertices();
+    Iterable<AtlasVertex<V, E>> vertices();
 
 
     /**
-     * Adds an in condition to the query
+     * Adds an in condition to the query.
      *
      * @param propertyName
      * @param values
@@ -49,7 +49,7 @@ public interface NativeTitanGraphQuery<V,E> {
     void in(String propertyName, Collection<? extends Object> values);
 
     /**
-     * Adds a has condition to the query
+     * Adds a has condition to the query.
      *
      * @param propertyName
      * @param op

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/NativeTitanQueryFactory.java
----------------------------------------------------------------------
diff --git a/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/NativeTitanQueryFactory.java b/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/NativeTitanQueryFactory.java
index 5c65411..ac7ff9e 100644
--- a/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/NativeTitanQueryFactory.java
+++ b/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/NativeTitanQueryFactory.java
@@ -24,11 +24,11 @@ package org.apache.atlas.repository.graphdb.titan.query;
  * @param <V>
  * @param <E>
  */
-public interface NativeTitanQueryFactory<V,E> {
+public interface NativeTitanQueryFactory<V, E> {
 
     /**
-     * Creates a NativeTitanGraphQuery
+     * Creates a NativeTitanGraphQuery.
      * @return
      */
-    NativeTitanGraphQuery<V,E> createNativeTitanQuery();
+    NativeTitanGraphQuery<V, E> createNativeTitanQuery();
 }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/TitanGraphQuery.java
----------------------------------------------------------------------
diff --git a/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/TitanGraphQuery.java b/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/TitanGraphQuery.java
index f23847a..c205b97 100644
--- a/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/TitanGraphQuery.java
+++ b/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/TitanGraphQuery.java
@@ -84,51 +84,51 @@ import org.slf4j.LoggerFactory;
  *
  *
  */
-public abstract class TitanGraphQuery<V,E> implements AtlasGraphQuery<V, E> {
+public abstract class TitanGraphQuery<V, E> implements AtlasGraphQuery<V, E> {
 
-    private final Logger LOG = LoggerFactory.getLogger(TitanGraphQuery.class);
-    protected final AtlasGraph<V,E> graph_;
-    private final OrCondition queryCondition_ = new OrCondition();
-    private final boolean isChildQuery_;
+    private static final Logger LOG = LoggerFactory.getLogger(TitanGraphQuery.class);
+    protected final AtlasGraph<V, E> graph;
+    private final OrCondition queryCondition = new OrCondition();
+    private final boolean isChildQuery;
     protected abstract NativeTitanQueryFactory<V, E> getQueryFactory();
 
     /**
-     * Creates a TitanGraphQuery
+     * Creates a TitanGraphQuery.
      *
      * @param graph
      */
-    public TitanGraphQuery(AtlasGraph<V,E> graph) {
-        graph_ = graph;
-        isChildQuery_ = false;
+    public TitanGraphQuery(AtlasGraph<V, E> graph) {
+        this.graph = graph;
+        this.isChildQuery = false;
     }
 
     /**
-     * Creates a TitanGraphQuery
+     * Creates a TitanGraphQuery.
      *
      * @param graph
      * @param isChildQuery
      */
-    public TitanGraphQuery(AtlasGraph<V,E> graph, boolean isChildQuery) {
-        graph_ = graph;
-        isChildQuery_ = isChildQuery;
+    public TitanGraphQuery(AtlasGraph<V, E> graph, boolean isChildQuery) {
+        this.graph = graph;
+        this.isChildQuery = isChildQuery;
     }
 
     @Override
     public AtlasGraphQuery<V, E> has(String propertyKey, Object value) {
-        queryCondition_.andWith(new HasPredicate(propertyKey, ComparisionOperator.EQUAL, value));
+        queryCondition.andWith(new HasPredicate(propertyKey, ComparisionOperator.EQUAL, value));
         return this;
     }
 
     @Override
     public Iterable<AtlasVertex<V, E>> vertices() {
-        LOG.debug("Executing: " );
-        LOG.debug(queryCondition_.toString());
+        LOG.debug("Executing: ");
+        LOG.debug(queryCondition.toString());
         //compute the overall result by unioning the results from all of the
         //AndConditions together.
         Set<AtlasVertex<V, E>> result = new HashSet<>();
-        for(AndCondition andExpr : queryCondition_.getAndTerms()) {
-            NativeTitanGraphQuery<V,E> andQuery = andExpr.create(getQueryFactory());
-            for(AtlasVertex<V,E> vertex : andQuery.vertices()) {
+        for(AndCondition andExpr : queryCondition.getAndTerms()) {
+            NativeTitanGraphQuery<V, E> andQuery = andExpr.create(getQueryFactory());
+            for(AtlasVertex<V, E> vertex : andQuery.vertices()) {
                 result.add(vertex);
             }
         }
@@ -138,14 +138,14 @@ public abstract class TitanGraphQuery<V,E> implements AtlasGraphQuery<V, E> {
     @Override
     public AtlasGraphQuery<V, E> has(String propertyKey, ComparisionOperator operator,
             Object value) {
-        queryCondition_.andWith(new HasPredicate(propertyKey, operator, value));
+        queryCondition.andWith(new HasPredicate(propertyKey, operator, value));
         return this;
     }
 
 
     @Override
     public AtlasGraphQuery<V, E> in(String propertyKey, Collection<? extends Object> values) {
-        queryCondition_.andWith(new InPredicate(propertyKey, values));
+        queryCondition.andWith(new InPredicate(propertyKey, values));
         return this;
     }
 
@@ -159,31 +159,31 @@ public abstract class TitanGraphQuery<V,E> implements AtlasGraphQuery<V, E> {
         OrCondition overallChildQuery = new OrCondition(false);
 
         for(AtlasGraphQuery<V, E> atlasChildQuery : childQueries) {
-            if(! atlasChildQuery.isChildQuery()) {
+            if (!atlasChildQuery.isChildQuery()) {
                 throw new IllegalArgumentException(atlasChildQuery + " is not a child query");
             }
-            TitanGraphQuery<V,E> childQuery = (TitanGraphQuery<V,E>)atlasChildQuery;
+            TitanGraphQuery<V, E> childQuery = (TitanGraphQuery<V, E>)atlasChildQuery;
             overallChildQuery.orWith(childQuery.getOrCondition());
         }
 
-        queryCondition_.andWith(overallChildQuery);
+        queryCondition.andWith(overallChildQuery);
         return this;
     }
 
     private OrCondition getOrCondition() {
-        return queryCondition_;
+        return queryCondition;
     }
 
     @Override
     public AtlasGraphQuery<V, E> addConditionsFrom(AtlasGraphQuery<V, E> otherQuery) {
 
         TitanGraphQuery<V, E> childQuery = (TitanGraphQuery<V, E>)otherQuery;
-        queryCondition_.andWith(childQuery.getOrCondition());
+        queryCondition.andWith(childQuery.getOrCondition());
         return this;
     }
 
     @Override
     public boolean isChildQuery() {
-        return isChildQuery_;
+        return isChildQuery;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/AndCondition.java
----------------------------------------------------------------------
diff --git a/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/AndCondition.java b/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/AndCondition.java
index f3996d9..68f0eb2 100644
--- a/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/AndCondition.java
+++ b/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/AndCondition.java
@@ -32,27 +32,27 @@ import org.apache.atlas.repository.graphdb.titan.query.NativeTitanQueryFactory;
  */
 public class AndCondition {
 
-    private List<QueryPredicate> children_ = new ArrayList<>();
+    private List<QueryPredicate> children = new ArrayList<>();
 
     public AndCondition() {
 
     }
 
     /**
-     * Adds a query predicate that must be met by vertices
+     * Adds a query predicate that must be met by vertices.
      * @param predicate
      */
     public void andWith(QueryPredicate predicate) {
-        children_.add(predicate);
+        children.add(predicate);
     }
 
     /**
-     * Adds multiple predicates that much be met by the vertices
+     * Adds multiple predicates that much be met by the vertices.
      *
      * @param predicates
      */
     public void andWith(List<QueryPredicate> predicates) {
-        children_.addAll(predicates);
+        children.addAll(predicates);
     }
 
     /**
@@ -62,17 +62,17 @@ public class AndCondition {
      */
     public AndCondition copy() {
         AndCondition builder = new AndCondition();
-        builder.children_.addAll(children_);
+        builder.children.addAll(children);
         return builder;
     }
 
     /**
-     * Gets the query predicates
+     * Gets the query predicates.
      *
      * @return
      */
     public List<QueryPredicate> getTerms() {
-        return children_;
+        return children;
     }
 
     /**
@@ -81,9 +81,9 @@ public class AndCondition {
      * @param graph
      * @return
      */
-    public <V,E> NativeTitanGraphQuery<V, E> create(NativeTitanQueryFactory<V,E> factory) {
+    public <V, E> NativeTitanGraphQuery<V, E> create(NativeTitanQueryFactory<V, E> factory) {
         NativeTitanGraphQuery<V, E> query = factory.createNativeTitanQuery();
-        for (QueryPredicate predicate : children_) {
+        for (QueryPredicate predicate : children) {
             predicate.addTo(query);
         }
         return query;
@@ -91,6 +91,6 @@ public class AndCondition {
 
     @Override
     public String toString() {
-        return "AndExpr [predicates=" + children_ + "]";
+        return "AndExpr [predicates=" + children + "]";
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/HasPredicate.java
----------------------------------------------------------------------
diff --git a/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/HasPredicate.java b/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/HasPredicate.java
index 8d7bc15..24e4f5b 100644
--- a/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/HasPredicate.java
+++ b/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/HasPredicate.java
@@ -26,25 +26,24 @@ import org.apache.atlas.repository.graphdb.titan.query.NativeTitanGraphQuery;
  */
 public class HasPredicate implements QueryPredicate {
 
-    private String propertyName_;
-    private ComparisionOperator op_;
-    private Object value_;
+    private String propertyName;
+    private ComparisionOperator op;
+    private Object value;
 
     public HasPredicate(String propertyName, ComparisionOperator op, Object value) {
         super();
-        propertyName_ = propertyName;
-        op_ = op;
-        value_ = value;
+        this.propertyName = propertyName;
+        this.op = op;
+        this.value = value;
     }
 
     @Override
     public void addTo(NativeTitanGraphQuery query) {
-        query.has(propertyName_, op_, value_);
+        query.has(propertyName, op, value);
     }
 
     @Override
     public String toString() {
-        return "HasTerm [propertyName_=" + propertyName_ + ", op_=" + op_ + ", value_=" + value_ + "]";
+        return "HasTerm [propertyName=" + propertyName + ", op=" + op + ", value=" + value + "]";
     }
-
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/InPredicate.java
----------------------------------------------------------------------
diff --git a/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/InPredicate.java b/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/InPredicate.java
index 5a43a6a..46831a5 100644
--- a/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/InPredicate.java
+++ b/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/InPredicate.java
@@ -27,23 +27,23 @@ import org.apache.atlas.repository.graphdb.titan.query.NativeTitanGraphQuery;
  */
 public class InPredicate implements QueryPredicate {
 
-    private String propertyName_;
-    private Collection<? extends Object> values_;
+    private String propertyName;
+    private Collection<? extends Object> values;
 
     public InPredicate(String propertyName, Collection<? extends Object> values) {
         super();
-        propertyName_ = propertyName;
-        values_ = values;
+        this.propertyName = propertyName;
+        this.values = values;
     }
 
     @Override
     public void addTo(NativeTitanGraphQuery query) {
-        query.in(propertyName_, values_);
+        query.in(propertyName, values);
     }
 
     @Override
     public String toString() {
-        return "InPredicate [propertyName_=" + propertyName_ + ", values_=" + values_ + "]";
+        return "InPredicate [propertyName=" + propertyName + ", values=" + values + "]";
     }
 
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/OrCondition.java
----------------------------------------------------------------------
diff --git a/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/OrCondition.java b/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/OrCondition.java
index 9de4655..80033b4 100644
--- a/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/OrCondition.java
+++ b/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/OrCondition.java
@@ -32,20 +32,20 @@ import java.util.List;
  */
 public class OrCondition {
 
-    private List<AndCondition> children_;
+    private List<AndCondition> children;
 
     public OrCondition() {
         this(true);
     }
 
     private OrCondition(List<AndCondition> children) {
-        children_ = children;
+        this.children = children;
     }
 
     public OrCondition(boolean addInitialTerm) {
-        children_ = new ArrayList<AndCondition>();
+        this.children = new ArrayList<AndCondition>();
         if (addInitialTerm) {
-            children_.add(new AndCondition());
+            children.add(new AndCondition());
         }
     }
 
@@ -58,18 +58,18 @@ public class OrCondition {
      */
     public void andWith(QueryPredicate predicate) {
 
-        for (AndCondition child : children_) {
+        for (AndCondition child : children) {
             child.andWith(predicate);
         }
     }
 
     public List<AndCondition> getAndTerms() {
-        return children_;
+        return children;
     }
 
     /**
-     * Updates this OrCondition in place so that it  matches vertices that satisfy the current
-     * OrCondition AND that satisfy the provided OrCondition
+     * Updates this OrCondition in place so that it matches vertices that satisfy the current
+     * OrCondition AND that satisfy the provided OrCondition.
      *
      * @param other
      */
@@ -98,30 +98,30 @@ public class OrCondition {
 
         List<AndCondition> expandedExpressionChildren = new ArrayList<AndCondition>();
         for (AndCondition otherExprTerm : other.getAndTerms()) {
-            for (AndCondition currentExpr : children_) {
+            for (AndCondition currentExpr : children) {
                 AndCondition currentAndConditionCopy = currentExpr.copy();
                 currentAndConditionCopy.andWith(otherExprTerm.getTerms());
                 expandedExpressionChildren.add(currentAndConditionCopy);
             }
         }
-        children_ = expandedExpressionChildren;
+        children = expandedExpressionChildren;
     }
 
     /**
-     * Updates this OrCondition in place so that it  matches vertices that satisfy the current
-     * OrCondition OR that satisfy the provided OrCondition
+     * Updates this OrCondition in place so that it matches vertices that satisfy the current
+     * OrCondition OR that satisfy the provided OrCondition.
      *
      * @param other
      */
     public void orWith(OrCondition other) {
-        children_.addAll(other.getAndTerms());
+        children.addAll(other.getAndTerms());
     }
 
     @Override
     public String toString() {
         StringBuilder builder = new StringBuilder();
         builder.append("OrCondition [andExprs=");
-        Iterator<AndCondition> it = children_.iterator();
+        Iterator<AndCondition> it = children.iterator();
         while (it.hasNext()) {
             AndCondition andExpr = it.next();
             builder.append(andExpr.toString());
@@ -133,4 +133,4 @@ public class OrCondition {
         return builder.toString();
     }
 
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/QueryPredicate.java
----------------------------------------------------------------------
diff --git a/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/QueryPredicate.java b/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/QueryPredicate.java
index 61c692f..a80522b 100644
--- a/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/QueryPredicate.java
+++ b/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/QueryPredicate.java
@@ -20,7 +20,7 @@ package org.apache.atlas.repository.graphdb.titan.query.expr;
 import org.apache.atlas.repository.graphdb.titan.query.NativeTitanGraphQuery;
 
 /**
- * Represents a predicate in an AndExpression
+ * Represents a predicate in an AndExpression.
  */
 public interface QueryPredicate {
 
@@ -30,4 +30,4 @@ public interface QueryPredicate {
      * @param query
      */
     void addTo(NativeTitanGraphQuery query);
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/graphdb/graphdb-impls/pom.xml
----------------------------------------------------------------------
diff --git a/graphdb/graphdb-impls/pom.xml b/graphdb/graphdb-impls/pom.xml
new file mode 100644
index 0000000..57b5137
--- /dev/null
+++ b/graphdb/graphdb-impls/pom.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+~ Licensed to the Apache Software Foundation (ASF) under one
+~ or more contributor license agreements.  See the NOTICE file
+~ distributed with this work for additional information
+~ regarding copyright ownership.  The ASF licenses this file
+~ to you under the Apache License, Version 2.0 (the
+~ "License"); you may not use this file except in compliance
+~ with the License.  You may obtain a copy of the License at
+~
+~     http://www.apache.org/licenses/LICENSE-2.0
+~
+~ Unless required by applicable law or agreed to in writing, software
+~ distributed under the License is distributed on an "AS IS" BASIS,
+~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+~ See the License for the specific language governing permissions and
+~ limitations under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.atlas</groupId>
+        <artifactId>atlas-graphdb</artifactId>
+        <version>0.8-incubating-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <artifactId>atlas-graphdb-impls</artifactId>
+    <!-- Convenience dependency project that allows
+    the dependency on the correct implementation class
+    to be configured through profiles.  In implementation
+    specific profiles, the dependency on this project
+    should be configured to exclude all but the
+    proper dependency
+    -->
+    
+    <description>Apache Atlas Graph Database Implementation Dependencies</description>
+    <name>Apache Atlas Graph Database Implementation Dependencies</name>
+    <packaging>pom</packaging>
+
+    <dependencies>
+      
+        <dependency>
+            <groupId>org.apache.atlas</groupId>
+            <artifactId>atlas-graphdb-titan0</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+	<!-- Additional dependencies should be added here
+	as more implementations are introduced.  In the
+	profile corresponding to the implementation in 
+	the root pom.xml, all dependencies except for
+	that one should be excluded. -->
+
+    </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/graphdb/pom.xml
----------------------------------------------------------------------
diff --git a/graphdb/pom.xml b/graphdb/pom.xml
index ad34617..2fc1f15 100644
--- a/graphdb/pom.xml
+++ b/graphdb/pom.xml
@@ -29,10 +29,14 @@
     <description>Apache Atlas Graph Database Projects</description>
     <name>Apache Atlas Graph Database Projects</name>
     <packaging>pom</packaging>
+    <properties>
+        <checkstyle.failOnViolation>true</checkstyle.failOnViolation>
+    </properties>
 
     <modules>
         <module>api</module>
         <module>titan0</module>
         <module>common</module>
+        <module>graphdb-impls</module>
     </modules>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/graphdb/titan0/src/main/java/com/thinkaurelius/titan/graphdb/query/graph/GraphCentricQueryBuilder.java
----------------------------------------------------------------------
diff --git a/graphdb/titan0/src/main/java/com/thinkaurelius/titan/graphdb/query/graph/GraphCentricQueryBuilder.java b/graphdb/titan0/src/main/java/com/thinkaurelius/titan/graphdb/query/graph/GraphCentricQueryBuilder.java
index c1a983b..89c02c8 100644
--- a/graphdb/titan0/src/main/java/com/thinkaurelius/titan/graphdb/query/graph/GraphCentricQueryBuilder.java
+++ b/graphdb/titan0/src/main/java/com/thinkaurelius/titan/graphdb/query/graph/GraphCentricQueryBuilder.java
@@ -31,8 +31,6 @@ import com.thinkaurelius.titan.graphdb.query.condition.*;
 import com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx;
 import com.thinkaurelius.titan.graphdb.types.*;
 import com.thinkaurelius.titan.graphdb.types.system.ImplicitKey;
-import com.thinkaurelius.titan.util.datastructures.Interval;
-import com.thinkaurelius.titan.util.datastructures.PointInterval;
 import com.tinkerpop.blueprints.Edge;
 import com.tinkerpop.blueprints.Vertex;
 import org.slf4j.Logger;
@@ -151,14 +149,14 @@ public class GraphCentricQueryBuilder implements TitanGraphQuery<GraphCentricQue
 
     @Override
     public GraphCentricQueryBuilder orderBy(String key, Order order) {
-        Preconditions.checkArgument(tx.containsPropertyKey(key),"Provided key does not exist: %s",key);
+        Preconditions.checkArgument(tx.containsPropertyKey(key), "Provided key does not exist: %s", key);
         return orderBy(tx.getPropertyKey(key), order);
     }
 
     @Override
     public GraphCentricQueryBuilder orderBy(PropertyKey key, Order order) {
-        Preconditions.checkArgument(key!=null && order!=null,"Need to specify and key and an order");
-        Preconditions.checkArgument(Comparable.class.isAssignableFrom(key.getDataType()),
+        Preconditions.checkArgument(key!=null && order!=null, "Need to specify and key and an order");
+        Preconditions.checkArgument(Comparable.class.isAssignableFrom(key.getDataType()), 
             "Can only order on keys with comparable data type. [%s] has datatype [%s]", key.getName(), key.getDataType());
         Preconditions.checkArgument(key.getCardinality()== Cardinality.SINGLE, "Ordering is undefined on multi-valued key [%s]", key.getName());
         Preconditions.checkArgument(!orders.containsKey(key));
@@ -190,7 +188,7 @@ public class GraphCentricQueryBuilder implements TitanGraphQuery<GraphCentricQue
     }
 
     private QueryDescription describe(ElementCategory category) {
-        return new StandardQueryDescription(1,constructQuery(category));
+        return new StandardQueryDescription(1, constructQuery(category));
     }
 
     public QueryDescription describeForVertices() {
@@ -235,13 +233,13 @@ public class GraphCentricQueryBuilder implements TitanGraphQuery<GraphCentricQue
 
         //Compile all indexes that cover at least one of the query conditions
         final Set<IndexType> indexCandidates = new HashSet<IndexType>();
-        ConditionUtil.traversal(conditions,new Predicate<Condition<TitanElement>>() {
+        ConditionUtil.traversal(conditions, new Predicate<Condition<TitanElement>>() {
             @Override
             public boolean apply(@Nullable Condition<TitanElement> condition) {
                 if (condition instanceof PredicateCondition) {
-                    RelationType type = ((PredicateCondition<RelationType,TitanElement>)condition).getKey();
+                    RelationType type = ((PredicateCondition<RelationType, TitanElement>)condition).getKey();
                     Preconditions.checkArgument(type!=null && type.isPropertyKey());
-                    Iterables.addAll(indexCandidates,Iterables.filter(((InternalRelationType) type).getKeyIndexes(), new Predicate<IndexType>() {
+                    Iterables.addAll(indexCandidates, Iterables.filter(((InternalRelationType) type).getKeyIndexes(), new Predicate<IndexType>() {
                         @Override
                         public boolean apply(@Nullable IndexType indexType) {
                             return indexType.getElement()==resultType;
@@ -275,12 +273,12 @@ public class GraphCentricQueryBuilder implements TitanGraphQuery<GraphCentricQue
                 //Check that this index actually applies in case of a schema constraint
                 if (index.hasSchemaTypeConstraint()) {
                     TitanSchemaType type = index.getSchemaTypeConstraint();
-                    Map.Entry<Condition,Collection<Object>> equalCon = getEqualityConditionValues(conditions,ImplicitKey.LABEL);
+                    Map.Entry<Condition, Collection<Object>> equalCon = getEqualityConditionValues(conditions, ImplicitKey.LABEL);
                     if (equalCon==null) continue;
                     Collection<Object> labels = equalCon.getValue();
                     assert labels.size()>=1;
                     if (labels.size()>1) {
-                        log.warn("The query optimizer currently does not support multiple label constraints in query: {}",this);
+                        log.warn("The query optimizer currently does not support multiple label constraints in query: {}", this);
                         continue;
                     }
                     if (!type.getName().equals((String)Iterables.getOnlyElement(labels))) continue;
@@ -288,11 +286,11 @@ public class GraphCentricQueryBuilder implements TitanGraphQuery<GraphCentricQue
                 }
 
                 if (index.isCompositeIndex()) {
-                    subcondition = indexCover((CompositeIndexType) index,conditions,subcover);
+                    subcondition = indexCover((CompositeIndexType) index, conditions, subcover);
                 } else {
-                    subcondition = indexCover((MixedIndexType) index,conditions,serializer,subcover);
+                    subcondition = indexCover((MixedIndexType) index, conditions, serializer, subcover);
                     if (coveredClauses.isEmpty() && !supportsSort
-                        && indexCoversOrder((MixedIndexType)index,orders)) supportsSort=true;
+                        && indexCoversOrder((MixedIndexType)index, orders)) supportsSort=true;
                 }
                 if (subcondition==null) continue;
                 assert !subcover.isEmpty();
@@ -323,11 +321,11 @@ public class GraphCentricQueryBuilder implements TitanGraphQuery<GraphCentricQue
 
                 log.debug("Index chosen for query {} {} " , bestCandidate.isCompositeIndex() ? "COMPOSITE" : "MIXED", coveredClauses);
                 if (bestCandidate.isCompositeIndex()) {
-                    jointQuery.add((CompositeIndexType)bestCandidate,
-                        serializer.getQuery((CompositeIndexType)bestCandidate,(List<Object[]>)candidateSubcondition));
+                    jointQuery.add((CompositeIndexType)bestCandidate, 
+                        serializer.getQuery((CompositeIndexType)bestCandidate, (List<Object[]>)candidateSubcondition));
                 } else {
-                    jointQuery.add((MixedIndexType)bestCandidate,
-                        serializer.getQuery((MixedIndexType)bestCandidate,(Condition)candidateSubcondition,orders));
+                    jointQuery.add((MixedIndexType)bestCandidate, 
+                        serializer.getQuery((MixedIndexType)bestCandidate, (Condition)candidateSubcondition, orders));
                 }
             } else {
                 break;
@@ -371,45 +369,45 @@ public class GraphCentricQueryBuilder implements TitanGraphQuery<GraphCentricQue
         Set<Condition> coveredClauses = new HashSet<Condition>(fields.length);
         List<Object[]> indexCovers = new ArrayList<Object[]>(4);
 
-        constructIndexCover(indexValues,0,fields,condition,indexCovers,coveredClauses);
+        constructIndexCover(indexValues, 0, fields, condition, indexCovers, coveredClauses);
         if (!indexCovers.isEmpty()) {
             covered.addAll(coveredClauses);
             return indexCovers;
         } else return null;
     }
 
-    private static void constructIndexCover(Object[] indexValues, int position, IndexField[] fields,
-        Condition<TitanElement> condition,
+    private static void constructIndexCover(Object[] indexValues, int position, IndexField[] fields, 
+        Condition<TitanElement> condition, 
         List<Object[]> indexCovers, Set<Condition> coveredClauses) {
         if (position>=fields.length) {
             indexCovers.add(indexValues);
         } else {
             IndexField field = fields[position];
-            Map.Entry<Condition,Collection<Object>> equalCon = getEqualityConditionValues(condition,field.getFieldKey());
+            Map.Entry<Condition, Collection<Object>> equalCon = getEqualityConditionValues(condition, field.getFieldKey());
             if (equalCon!=null) {
                 coveredClauses.add(equalCon.getKey());
                 assert equalCon.getValue().size()>0;
                 for (Object value : equalCon.getValue()) {
-                    Object[] newValues = Arrays.copyOf(indexValues,fields.length);
+                    Object[] newValues = Arrays.copyOf(indexValues, fields.length);
                     newValues[position]=value;
-                    constructIndexCover(newValues,position+1,fields,condition,indexCovers,coveredClauses);
+                    constructIndexCover(newValues, position+1, fields, condition, indexCovers, coveredClauses);
                 }
             } else return;
         }
 
     }
 
-    private static final Map.Entry<Condition,Collection<Object>> getEqualityConditionValues(Condition<TitanElement> condition, RelationType type) {
+    private static final Map.Entry<Condition, Collection<Object>> getEqualityConditionValues(Condition<TitanElement> condition, RelationType type) {
         for (Condition c : condition.getChildren()) {
             if (c instanceof Or) {
-                Map.Entry<RelationType,Collection> orEqual = QueryUtil.extractOrCondition((Or)c);
+                Map.Entry<RelationType, Collection> orEqual = QueryUtil.extractOrCondition((Or)c);
                 if (orEqual!=null && orEqual.getKey().equals(type) && !orEqual.getValue().isEmpty()) {
-                    return new AbstractMap.SimpleImmutableEntry(c,orEqual.getValue());
+                    return new AbstractMap.SimpleImmutableEntry(c, orEqual.getValue());
                 }
             } else if (c instanceof PredicateCondition) {
                 PredicateCondition<RelationType, TitanRelation> atom = (PredicateCondition)c;
                 if (atom.getKey().equals(type) && atom.getPredicate()==Cmp.EQUAL && atom.getValue()!=null) {
-                    return new AbstractMap.SimpleImmutableEntry(c,ImmutableList.of(atom.getValue()));
+                    return new AbstractMap.SimpleImmutableEntry(c, ImmutableList.of(atom.getValue()));
                 }
             }
 
@@ -417,13 +415,13 @@ public class GraphCentricQueryBuilder implements TitanGraphQuery<GraphCentricQue
         return null;
     }
 
-    public static final Condition<TitanElement> indexCover(final MixedIndexType index, Condition<TitanElement> condition,
+    public static final Condition<TitanElement> indexCover(final MixedIndexType index, Condition<TitanElement> condition, 
         final IndexSerializer indexInfo, final Set<Condition> covered) {
         assert QueryUtil.isQueryNormalForm(condition);
         assert condition instanceof And;
         And<TitanElement> subcondition = new And<TitanElement>(condition.numChildren());
         for (Condition<TitanElement> subclause : condition.getChildren()) {
-            if (coversAll(index,subclause,indexInfo)) {
+            if (coversAll(index, subclause, indexInfo)) {
                 subcondition.add(subclause);
                 covered.add(subclause);
             }
@@ -446,10 +444,10 @@ public class GraphCentricQueryBuilder implements TitanGraphQuery<GraphCentricQue
                 if (fields[i].getFieldKey().equals(key)) match = fields[i];
             }
             if (match==null) return false;
-            return indexInfo.supports(index,match,atom.getPredicate());
+            return indexInfo.supports(index, match, atom.getPredicate());
         } else {
             for (Condition<TitanElement> child : condition.getChildren()) {
-                if (!coversAll(index,child,indexInfo)) return false;
+                if (!coversAll(index, child, indexInfo)) return false;
             }
             return true;
         }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d2d6ff7d/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/GraphDbObjectFactory.java
----------------------------------------------------------------------
diff --git a/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/GraphDbObjectFactory.java b/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/GraphDbObjectFactory.java
index 89de23d..0e8519e 100644
--- a/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/GraphDbObjectFactory.java
+++ b/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/GraphDbObjectFactory.java
@@ -18,9 +18,11 @@
 
 package org.apache.atlas.repository.graphdb.titan0;
 
+import org.apache.atlas.repository.graphdb.AtlasCardinality;
 import org.apache.atlas.repository.graphdb.AtlasGraphIndex;
 import org.apache.atlas.repository.graphdb.titan0.query.Titan0GraphQuery;
 
+import com.thinkaurelius.titan.core.Cardinality;
 import com.thinkaurelius.titan.core.PropertyKey;
 import com.thinkaurelius.titan.core.schema.TitanGraphIndex;
 import com.tinkerpop.blueprints.Edge;
@@ -39,8 +41,8 @@ public final class GraphDbObjectFactory {
     /**
      * Creates a Titan0Edge that corresponds to the given Gremlin Edge.
      *
-     * @param source
-     * @return
+     * @param graph The graph the edge should be created in
+     * @param source The gremlin edge
      */
     public static Titan0Edge createEdge(Titan0Graph graph, Edge source) {
 
@@ -52,9 +54,8 @@ public final class GraphDbObjectFactory {
 
     /**
      * Creates a Titan0GraphQuery that corresponds to the given GraphQuery.
-     * @param source
      *
-     * @return
+     * @param graph the graph that is being quried
      */
     public static Titan0GraphQuery createQuery(Titan0Graph graph) {
 
@@ -64,8 +65,8 @@ public final class GraphDbObjectFactory {
     /**
      * Creates a Titan0Vertex that corresponds to the given Gremlin Vertex.
      *
-     * @param source
-     * @return
+     * @param graph The graph that contains the vertex
+     * @param source the Gremlin vertex
      */
     public static Titan0Vertex createVertex(Titan0Graph graph, Vertex source) {
 
@@ -76,8 +77,8 @@ public final class GraphDbObjectFactory {
     }
 
     /**
-     * @param propertyKey
-     * @return
+     * @param propertyKey The Gremlin propertyKey.
+     *
      */
     public static Titan0PropertyKey createPropertyKey(PropertyKey propertyKey) {
         if (propertyKey == null) {
@@ -87,7 +88,7 @@ public final class GraphDbObjectFactory {
     }
 
     /**
-     * @param index
+     * @param index The gremlin index.
      * @return
      */
     public static AtlasGraphIndex createGraphIndex(TitanGraphIndex index) {
@@ -97,4 +98,20 @@ public final class GraphDbObjectFactory {
         return new Titan0GraphIndex(index);
     }
 
+    /**
+     * Converts a Multiplicity to a Cardinality.
+     *
+     * @param cardinality
+     * @return
+     */
+    public static AtlasCardinality createCardinality(Cardinality cardinality) {
+
+        if (cardinality == Cardinality.SINGLE) {
+            return AtlasCardinality.SINGLE;
+        } else if (cardinality == Cardinality.LIST) {
+            return AtlasCardinality.LIST;
+        }
+        return AtlasCardinality.SET;
+    }
+
 }


Mime
View raw message