[ASTERIXDB-2979][MTD][GRAPH] Implement CREATE / DROP GRAPH

Initial commit. This supports CREATE GRAPH, DROP GRAPH, and prevents
dropping views / functions / datasets / synonyms / dataverses that a
graph depends on.

Change-Id: Ibaf4dc7066b85d8ea3b58c6b90fd83af3a700506
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb-graph/+/14644
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Ian Maxon <imaxon@uci.edu>
diff --git a/asterix-graphix/src/test/resources/runtimets/only.xml b/asterix-graphix/src/test/resources/runtimets/only.xml
new file mode 100644
index 0000000..9cb8228
--- /dev/null
+++ b/asterix-graphix/src/test/resources/runtimets/only.xml
@@ -0,0 +1,25 @@
+<!--
+ ! 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.
+ !-->
+<test-suite xmlns="urn:xml.testframework.asterix.apache.org"
+            ResultOffsetPath="results"
+            QueryOffsetPath="queries"
+            QueryFileExtension=".sqlpp">
+  <test-group name="failed">
+  </test-group>
+</test-suite>
diff --git a/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.1.ddl.sqlpp b/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.1.ddl.sqlpp
new file mode 100644
index 0000000..ff47a77
--- /dev/null
+++ b/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.1.ddl.sqlpp
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+// Verify that a dataset that a graph is dependent on cannot be dropped.
+
+DROP DATAVERSE    TestDataverse IF EXISTS;
+CREATE DATAVERSE  TestDataverse;
+USE               TestDataverse;
+
+CREATE TYPE       GenericType
+AS                { _id: uuid };
+
+CREATE DATASET    GenericDataset (GenericType)
+PRIMARY KEY       _id AUTOGENERATED;
+
+CREATE GRAPH      TestGraph AS
+VERTEX            (:Vertex1)
+                  PRIMARY KEY (_id)
+                  AS GenericDataset,
+VERTEX            (:Vertex2)
+                  PRIMARY KEY (_id)
+                  AS GenericDataset,
+EDGE              (:Vertex1)-[:EDGE_1]->(:Vertex2)
+                  DESTINATION KEY (_foreign_id);
+
+DROP DATASET      GenericDataset;
diff --git a/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.10.ddl.sqlpp b/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.10.ddl.sqlpp
new file mode 100644
index 0000000..fe00035
--- /dev/null
+++ b/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.10.ddl.sqlpp
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ */
+
+// Verify that we cannot create a graph in the same dataverse with the same name.
+
+DROP DATAVERSE    TestDataverse1 IF EXISTS;
+DROP DATAVERSE    TestDataverse2 IF EXISTS;
+CREATE DATAVERSE  TestDataverse1;
+CREATE DATAVERSE  TestDataverse2;
+
+USE               TestDataverse1;
+CREATE TYPE       GenericType
+AS                { _id: uuid };
+
+CREATE DATASET    GenericDataset (GenericType)
+PRIMARY KEY       _id AUTOGENERATED;
+
+CREATE GRAPH      TestGraph AS
+VERTEX            (:Vertex1)
+                  PRIMARY KEY (_id)
+                  AS GenericDataset,
+VERTEX            (:Vertex2)
+                  PRIMARY KEY (_id)
+                  AS GenericDataset,
+EDGE              (:Vertex1)-[:EDGE_1]->(:Vertex2)
+                  DESTINATION KEY (_foreign_id);
+
+USE               TestDataverse2;
+CREATE TYPE       GenericType
+AS                { _id: uuid };
+
+CREATE DATASET    GenericDataset (GenericType)
+PRIMARY KEY       _id AUTOGENERATED;
+
+CREATE GRAPH      TestGraph AS
+VERTEX            (:Vertex1)
+                  PRIMARY KEY (_id)
+                  AS GenericDataset,
+VERTEX            (:Vertex2)
+                  PRIMARY KEY (_id)
+                  AS GenericDataset,
+EDGE              (:Vertex1)-[:EDGE_1]->(:Vertex2)
+                  DESTINATION KEY (_foreign_id);
+
+USE               TestDataverse1;
+CREATE GRAPH      TestGraph IF NOT EXISTS AS
+VERTEX            (:Vertex1)
+                  PRIMARY KEY (_id)
+                  AS GenericDataset;
+
+USE               TestDataverse2;
+CREATE GRAPH      TestGraph AS
+VERTEX            (:Vertex1)
+                  PRIMARY KEY (_id)
+                  AS GenericDataset;
diff --git a/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.11.ddl.sqlpp b/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.11.ddl.sqlpp
new file mode 100644
index 0000000..ff0f01e
--- /dev/null
+++ b/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.11.ddl.sqlpp
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+// Verify that we cannot drop a graph that doesn't exist.
+
+DROP DATAVERSE    TestDataverse IF EXISTS;
+CREATE DATAVERSE  TestDataverse;
+USE               TestDataverse;
+
+CREATE TYPE       GenericType
+AS                { _id: uuid };
+
+CREATE DATASET    GenericDataset (GenericType)
+PRIMARY KEY       _id AUTOGENERATED;
+
+CREATE GRAPH      TestGraph AS
+VERTEX            (:Vertex1)
+                  PRIMARY KEY (_id)
+                  AS GenericDataset,
+VERTEX            (:Vertex2)
+                  PRIMARY KEY (_id)
+                  AS GenericDataset,
+EDGE              (:Vertex1)-[:EDGE_1]->(:Vertex2)
+                  DESTINATION KEY (_foreign_id);
+
+DROP GRAPH        GraphThatDoesntExist1 IF EXISTS;
+DROP GRAPH        GraphThatDoesntExist2;
diff --git a/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.2.ddl.sqlpp b/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.2.ddl.sqlpp
new file mode 100644
index 0000000..09693af
--- /dev/null
+++ b/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.2.ddl.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+// Verify that a function that a graph is dependent on cannot be dropped.
+
+DROP DATAVERSE    TestDataverse IF EXISTS;
+CREATE DATAVERSE  TestDataverse;
+USE               TestDataverse;
+
+CREATE TYPE       GenericType
+AS                { _id: uuid };
+
+CREATE DATASET    GenericDataset (GenericType)
+PRIMARY KEY       _id AUTOGENERATED;
+
+CREATE FUNCTION   TestFunction () { SELECT VALUE { "a": 1, "b": 1 } };
+
+CREATE GRAPH      TestGraph AS
+VERTEX            (:Vertex1)
+                  PRIMARY KEY (_id)
+                  AS GenericDataset,
+VERTEX            (:Vertex2)
+                  PRIMARY KEY (_id)
+                  AS GenericDataset,
+EDGE              (:Vertex1)-[:EDGE_1]->(:Vertex2)
+                  PRIMARY KEY (a, b)
+                  SOURCE KEY (a)
+                  DESTINATION KEY (b)
+                  AS ( FROM TestFunction() T
+                       SELECT T.* );
+
+DROP FUNCTION     TestFunction();
diff --git a/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.3.ddl.sqlpp b/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.3.ddl.sqlpp
new file mode 100644
index 0000000..a812ea1
--- /dev/null
+++ b/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.3.ddl.sqlpp
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+// Verify that a view that a graph is dependent on cannot be dropped.
+
+DROP DATAVERSE    TestDataverse IF EXISTS;
+CREATE DATAVERSE  TestDataverse;
+USE               TestDataverse;
+
+CREATE TYPE       GenericType
+AS                { _id: uuid };
+
+CREATE DATASET    GenericDataset (GenericType)
+PRIMARY KEY       _id AUTOGENERATED;
+
+CREATE VIEW       TestView AS SELECT VALUE { "a": 1, "b": 1 };
+
+CREATE GRAPH      TestGraph AS
+VERTEX            (:Vertex1)
+                  PRIMARY KEY (_id)
+                  AS GenericDataset,
+VERTEX            (:Vertex2)
+                  PRIMARY KEY (_id)
+                  AS GenericDataset,
+EDGE              (:Vertex1)-[:EDGE_1]->(:Vertex2)
+                  PRIMARY KEY (a, b)
+                  SOURCE KEY (a)
+                  DESTINATION KEY (b)
+                  AS ( FROM TestView T
+                       SELECT T.* );
+
+DROP VIEW        TestView;
diff --git a/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.4.ddl.sqlpp b/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.4.ddl.sqlpp
new file mode 100644
index 0000000..0cdec73
--- /dev/null
+++ b/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.4.ddl.sqlpp
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+// Verify that a synonym that a graph is dependent on cannot be dropped.
+
+DROP DATAVERSE    TestDataverse IF EXISTS;
+CREATE DATAVERSE  TestDataverse;
+USE               TestDataverse;
+
+CREATE TYPE       GenericType
+AS                { _id: uuid };
+
+CREATE DATASET    GenericDataset (GenericType)
+PRIMARY KEY       _id AUTOGENERATED;
+
+CREATE SYNONYM    DatasetSynonym FOR GenericDataset;
+
+CREATE GRAPH      TestGraph AS
+VERTEX            (:Vertex1)
+                  PRIMARY KEY (_id)
+                  AS GenericDataset,
+VERTEX            (:Vertex2)
+                  PRIMARY KEY (_id)
+                  AS DatasetSynonym,
+EDGE              (:Vertex1)-[:EDGE_1]->(:Vertex2)
+                  DESTINATION KEY (_foreign_id);
+
+DROP SYNONYM      DatasetSynonym;
diff --git a/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.5.ddl.sqlpp b/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.5.ddl.sqlpp
new file mode 100644
index 0000000..844389f
--- /dev/null
+++ b/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.5.ddl.sqlpp
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+
+// Verify that a dataverse that a graph is dependent on cannot be dropped.
+
+DROP DATAVERSE    TestDataverse IF EXISTS;
+DROP DATAVERSE    TestDataverse2 IF EXISTS;
+CREATE DATAVERSE  TestDataverse;
+CREATE DATAVERSE  TestDataverse2;
+
+USE               TestDataverse;
+CREATE TYPE       GenericType
+AS                { _id: uuid };
+
+USE               TestDataverse2;
+CREATE TYPE       GenericType
+AS                { _id: uuid };
+
+USE               TestDataverse;
+CREATE DATASET    GenericDataset (GenericType)
+PRIMARY KEY       _id AUTOGENERATED;
+
+USE               TestDataverse2;
+CREATE DATASET    GenericDataset (GenericType)
+PRIMARY KEY       _id AUTOGENERATED;
+
+USE               TestDataverse;
+CREATE GRAPH      TestGraph AS
+VERTEX            (:Vertex1)
+                  PRIMARY KEY (_id)
+                  AS GenericDataset,
+VERTEX            (:Vertex2)
+                  PRIMARY KEY (_id)
+                  AS TestDataverse2.GenericDataset,
+EDGE              (:Vertex1)-[:EDGE_1]->(:Vertex2)
+                  DESTINATION KEY (_foreign_id);
+
+DROP DATAVERSE    TestDataverse2;
diff --git a/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.6.ddl.sqlpp b/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.6.ddl.sqlpp
new file mode 100644
index 0000000..f6173aa
--- /dev/null
+++ b/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.6.ddl.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+// Verify that a dataset variable as an element definition is a valid dataset.
+
+DROP DATAVERSE    TestDataverse IF EXISTS;
+CREATE DATAVERSE  TestDataverse;
+USE               TestDataverse;
+
+CREATE TYPE       GenericType
+AS                { _id: uuid };
+
+CREATE DATASET    GenericDataset (GenericType)
+PRIMARY KEY       _id AUTOGENERATED;
+
+CREATE GRAPH      TestGraph AS
+VERTEX            (:Vertex1)
+                  PRIMARY KEY (_id)
+                  AS DatasetThatDoesNotExist,
+VERTEX            (:Vertex2)
+                  PRIMARY KEY (_id)
+                  AS GenericDataset,
+EDGE              (:Vertex1)-[:EDGE_1]->(:Vertex2)
+                  DESTINATION KEY (_foreign_id);
diff --git a/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.7.ddl.sqlpp b/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.7.ddl.sqlpp
new file mode 100644
index 0000000..5191339
--- /dev/null
+++ b/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.7.ddl.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+// Verify that a subquery as an element definition is a valid query.
+
+DROP DATAVERSE    TestDataverse IF EXISTS;
+CREATE DATAVERSE  TestDataverse;
+USE               TestDataverse;
+
+CREATE TYPE       GenericType
+AS                { _id: uuid };
+
+CREATE DATASET    GenericDataset (GenericType)
+PRIMARY KEY       _id AUTOGENERATED;
+
+CREATE GRAPH      TestGraph AS
+VERTEX            (:Vertex1)
+                  PRIMARY KEY (_id)
+                  AS GenericDataset,
+VERTEX            (:Vertex2)
+                  PRIMARY KEY (_id)
+                  AS GenericDataset,
+EDGE              (:Vertex1)-[:EDGE_1]->(:Vertex2)
+                  PRIMARY KEY (_id, _foreign_id)
+                  SOURCE KEY (_id)
+                  DESTINATION KEY (_foreign_id)
+                  AS ( FROM GenericDataset G,
+                            GenericDataset G2
+                       SELECT V );
diff --git a/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.8.ddl.sqlpp b/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.8.ddl.sqlpp
new file mode 100644
index 0000000..eb0fa47
--- /dev/null
+++ b/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.8.ddl.sqlpp
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+
+// Verify that vertices w/ the same label cannot have conflicting primary keys.
+
+DROP DATAVERSE    TestDataverse IF EXISTS;
+CREATE DATAVERSE  TestDataverse;
+USE               TestDataverse;
+
+CREATE TYPE       GenericType
+AS                { _id: uuid };
+
+CREATE DATASET    GenericDataset (GenericType)
+PRIMARY KEY       _id AUTOGENERATED;
+
+CREATE GRAPH      TestGraph AS
+VERTEX            (:Vertex1)
+                  PRIMARY KEY (_id)
+                  AS GenericDataset,
+VERTEX            (:Vertex1)
+                  PRIMARY KEY (_other_id)
+                  AS ( FROM GenericDataset
+                       SELECT VALUE { "_other_id": _other_id } );
diff --git a/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.9.ddl.sqlpp b/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.9.ddl.sqlpp
new file mode 100644
index 0000000..7c5269e
--- /dev/null
+++ b/asterix-graphix/src/test/resources/runtimets/queries/graphix/error-handling/error-handling.9.ddl.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+// Verify that edges do not reference a vertex label that does not exist.
+
+DROP DATAVERSE    TestDataverse IF EXISTS;
+CREATE DATAVERSE  TestDataverse;
+USE               TestDataverse;
+
+CREATE TYPE       GenericType
+AS                { _id: uuid };
+
+CREATE DATASET    GenericDataset (GenericType)
+PRIMARY KEY       _id AUTOGENERATED;
+
+CREATE GRAPH      TestGraph AS
+VERTEX            (:Vertex1)
+                  PRIMARY KEY (_id)
+                  AS GenericDataset,
+VERTEX            (:Vertex2)
+                  PRIMARY KEY (_id)
+                  AS GenericDataset,
+EDGE              (:Vertex1)-[:EDGE_1]->(:Vertex3)
+                  DESTINATION KEY (_foreign_id);
diff --git a/asterix-graphix/src/test/resources/runtimets/testsuite.xml b/asterix-graphix/src/test/resources/runtimets/testsuite.xml
new file mode 100644
index 0000000..ea6db85
--- /dev/null
+++ b/asterix-graphix/src/test/resources/runtimets/testsuite.xml
@@ -0,0 +1,41 @@
+<!--
+ ! 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.
+ !-->
+<test-suite xmlns="urn:xml.testframework.asterix.apache.org"
+            ResultOffsetPath="results"
+            QueryOffsetPath="queries"
+            QueryFileExtension=".sqlpp">
+  <test-group name="error-handling">
+    <test-case FilePath="graphix">
+      <compilation-unit name="error-handling">
+        <output-dir compare="Text">error-handling</output-dir>
+        <expected-error>Cannot drop dataset (or view) TestDataverse.GenericDataset being used by graph TestGraph</expected-error>
+        <expected-error>Cannot drop function TestDataverse.TestFunction() being used by graph TestGraph</expected-error>
+        <expected-error>Cannot drop dataset (or view) TestDataverse.TestView being used by graph TestGraph</expected-error>
+        <expected-error>Cannot drop synonym TestDataverse.DatasetSynonym being used by graph TestGraph</expected-error>
+        <expected-error>Cannot drop dataverse: dataset (or view) TestDataverse2.GenericDataset being used by graph TestGraph</expected-error>
+        <expected-error>Bad definition for a graph element(.)*Cannot find dataset DatasetThatDoesNotExist in dataverse TestDataverse nor an alias with name DatasetThatDoesNotExist</expected-error>
+        <expected-error>Bad definition for a graph element(.)*Cannot resolve ambiguous alias reference for identifier V</expected-error>
+        <expected-error>Conflicting primary keys for vertices with label Vertex1</expected-error>
+        <expected-error>Destination vertex Vertex3 not found in the edge EDGE_1.</expected-error>
+        <expected-error>Graph TestGraph already exists.</expected-error>
+        <expected-error>Graph GraphThatDoesntExist2 does not exist.</expected-error>
+      </compilation-unit>
+    </test-case>
+  </test-group>
+</test-suite>
\ No newline at end of file