Subgraph subgraph = graph.getSubgraphOfDepth(10).at("/");
assertThat(subgraph, is(notNullValue()));
//String value = subgraph.toString();
//System.out.println(value);
SubgraphNode rootNode = subgraph.getNode(".");
assertThat(rootNode.getChildren().size(), is(1));
SubgraphNode statementsNode = rootNode.getNode(path("ddl:statements"));
assertNotNull(statementsNode);
assertThat(statementsNode.getChildren().size(), is(50));
assertThat(verifyPrimaryType(statementsNode, "nt:unstructured"), is(true));
assertThat(verifyProperty(statementsNode, "ddl:parserId", "ORACLE"), is(true));
// <name = "CREATE OR REPLACE DIRECTORY" startLineNumber = "164" primaryType = "nt:unstructured" uuid = "c45eb2bb-1b85-469d-9dfc-0012fdfd8ac4" startColumnNumber = "1" mixinTypes = "oracleddl:createDirectoryStatement" expression = "CREATE OR REPLACE DIRECTORY bfile_dir AS '/private1/LOB/files';" startCharIndex = "3887">
SubgraphNode createOrReplDirNode = statementsNode.getNode(path("CREATE OR REPLACE DIRECTORY"));
assertNotNull(createOrReplDirNode);
verifyBaseProperties(createOrReplDirNode, "nt:unstructured", "164", "1", "3886", 0);
assertThat(verifyMixinType(createOrReplDirNode, "oracleddl:createDirectoryStatement"), is(true));
// <name = "countries" startLineNumber = "9" primaryType = "nt:unstructured" uuid = "70f45acc-57b0-41c9-b166-bcba4f8c75b8" startColumnNumber = "1" mixinTypes = "ddl:alterTableStatement" expression = "ALTER TABLE countries
// ADD (duty_pct NUMBER(2,2) CHECK (duty_pct < 10.5),
// visa_needed VARCHAR2(3));" startCharIndex = "89">
// <name = "duty_pct" datatypeName = "NUMBER" primaryType = "nt:unstructured" uuid = "20079cae-5de1-425c-925e-df230410ea69" datatypePrecision = "2" mixinTypes = "ddl:columnDefinition" datatypeScale = "2">
// <name = "CHECK_1" primaryType = "nt:unstructured" name = "CHECK_1" uuid = "210039d7-ebe7-47a8-94be-c3adb70b2885" mixinTypes = "ddl:addTableConstraintDefinition" constraintType = "3" searchCondition = "( duty_pct < 10 . 5 )">
// <name = "visa_needed" datatypeName = "VARCHAR2" datatypeLength = "3" primaryType = "nt:unstructured" uuid = "b7b6bf1d-6a2b-411a-aa63-974d13ba20e8" mixinTypes = "ddl:columnDefinition">
SubgraphNode countriesNode = statementsNode.getNode(path("countries"));
assertNotNull(countriesNode);
verifyBaseProperties(countriesNode, "nt:unstructured", "9", "1", "89", 3);
assertThat(verifyMixinType(countriesNode, "ddl:alterTableStatement"), is(true));
SubgraphNode duty_pct_node = countriesNode.getNode(path("duty_pct"));
assertNotNull(duty_pct_node);
assertThat(verifyPrimaryType(duty_pct_node, "nt:unstructured"), is(true));
assertThat(verifyProperty(duty_pct_node, "ddl:datatypeName", "NUMBER"), is(true));
assertThat(verifyProperty(duty_pct_node, "ddl:datatypePrecision", "2"), is(true));
assertThat(verifyProperty(duty_pct_node, "ddl:datatypeScale", "2"), is(true));
assertThat(verifyHasProperty(duty_pct_node, "ddl:datatypeLength"), is(false));
assertThat(verifyMixinType(duty_pct_node, "ddl:columnDefinition"), is(true));
SubgraphNode check_1_node = countriesNode.getNode(path("CHECK_1"));
assertNotNull(check_1_node);
assertThat(verifyPrimaryType(check_1_node, "nt:unstructured"), is(true));
assertThat(verifyProperty(check_1_node, "ddl:constraintType", "CHECK"), is(true));
assertThat(verifyMixinType(check_1_node, "ddl:addTableConstraintDefinition"), is(true));
assertThat(verifyProperty(check_1_node, "ddl:searchCondition", "( duty_pct < 10 . 5 )"), is(true));
SubgraphNode visa_needed_node = countriesNode.getNode(path("visa_needed"));
assertNotNull(visa_needed_node);
assertThat(verifyPrimaryType(visa_needed_node, "nt:unstructured"), is(true));
assertThat(verifyProperty(visa_needed_node, "ddl:datatypeName", "VARCHAR2"), is(true));
assertThat(verifyProperty(visa_needed_node, "ddl:datatypeLength", "3"), is(true));
assertThat(verifyMixinType(visa_needed_node, "ddl:columnDefinition"), is(true));
// <name = "app_user1" startLineNumber = "33" primaryType = "nt:unstructured" uuid = "8c660ae8-2078-4263-a0e7-8f517cefd3a0" startColumnNumber = "1" mixinTypes = "oracleddl:alterUserStatement" expression = "ALTER USER app_user1
// GRANT CONNECT THROUGH sh
// WITH ROLE warehouse_user;" startCharIndex = "624">
SubgraphNode app_user1Node = statementsNode.getNode(path("app_user1"));
assertNotNull(app_user1Node);
verifyBaseProperties(app_user1Node, "nt:unstructured", "33", "1", "624", 0);
assertThat(verifyMixinType(app_user1Node, "oracleddl:alterUserStatement"), is(true));
}