diff --git a/sparqlGraphLibrary/src/test/java/com/ge/research/semtk/belmont/test/QueryGenTest_IT.java b/sparqlGraphLibrary/src/test/java/com/ge/research/semtk/belmont/test/QueryGenTest_IT.java
index 05f3c653b..e767b2e43 100644
--- a/sparqlGraphLibrary/src/test/java/com/ge/research/semtk/belmont/test/QueryGenTest_IT.java
+++ b/sparqlGraphLibrary/src/test/java/com/ge/research/semtk/belmont/test/QueryGenTest_IT.java
@@ -86,6 +86,8 @@ public static void setup() throws Exception {
// load Batttery
sgJsonBattery = TestGraph.addModelAndData(QueryGenTest_IT.class, "sampleBattery");
+ // load RangeTest (owl contains model and a little data)
+ TestGraph.uploadOwlContents(Utility.getResourceAsString(QueryGenTest_IT.class, "RangeTest.owl"));
}
// TODO : all tests should have corresponding CONSTRUCT
@@ -812,6 +814,16 @@ public void test_createConstructAllConnectedBattery() throws Exception {
assertTrue("Results are missing: " + lookup, res.contains(lookup));
}
}
+
+ @Test
+ public void testComplexRangeQuery() throws Exception {
+ // WeirdBird has two children, and hasChild has a complex range {Bird, Unusual}
+ // A query for just the bird should return just the bird
+ SparqlGraphJson sgjson = TestGraph.getSparqlGraphJsonFromResource(this.getClass(), "rangeTestComplexRangeQuery.json");
+ Table res = TestGraph.execTableSelect(sgjson);
+ assertEquals("Complex range query returned the wrong number of rows", 1, res.getNumRows());
+ }
+
/**
* Count the number of attributes of items in a Graph where key.contains(keyContains) and value.contains(valContains)
* Not recursive, checks each element in the graph array.
diff --git a/sparqlGraphLibrary/src/test/resources/RangeTest.owl b/sparqlGraphLibrary/src/test/resources/RangeTest.owl
index e6830907e..ea17f22b7 100644
--- a/sparqlGraphLibrary/src/test/resources/RangeTest.owl
+++ b/sparqlGraphLibrary/src/test/resources/RangeTest.owl
@@ -124,17 +124,21 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/sparqlGraphLibrary/src/test/resources/RangeTest.sadl b/sparqlGraphLibrary/src/test/resources/RangeTest.sadl
index 0996e24cb..26c51d997 100644
--- a/sparqlGraphLibrary/src/test/resources/RangeTest.sadl
+++ b/sparqlGraphLibrary/src/test/resources/RangeTest.sadl
@@ -50,6 +50,8 @@ duc is a Duck.
rab is a Rabbit.
wei is a WeirdBird.
+wei hasChild duc.
+wei hasChild unu.
// Sadl warns. Semtk says this is fine
wei hasAnotherEgg egg.
diff --git a/sparqlGraphLibrary/src/test/resources/rangeTestComplexRangeQuery.json b/sparqlGraphLibrary/src/test/resources/rangeTestComplexRangeQuery.json
new file mode 100644
index 000000000..126f8fb7f
--- /dev/null
+++ b/sparqlGraphLibrary/src/test/resources/rangeTestComplexRangeQuery.json
@@ -0,0 +1,100 @@
+{
+ "version": 3,
+ "sparqlConn": {
+ "name": "Junit fuseki",
+ "domain": "",
+ "enableOwlImports": true,
+ "model": [
+ {
+ "type": "fuseki",
+ "url": "http://localhost:3030/JUNIT",
+ "graph": "http://junit/GG2NQYY2E/200001934/both"
+ }
+ ],
+ "data": [
+ {
+ "type": "fuseki",
+ "url": "http://localhost:3030/JUNIT",
+ "graph": "http://junit/GG2NQYY2E/200001934/both"
+ }
+ ]
+ },
+ "sNodeGroup": {
+ "version": 19,
+ "limit": 0,
+ "offset": 0,
+ "sNodeList": [
+ {
+ "propList": [],
+ "nodeList": [],
+ "fullURIName": "http://rangetest#Duck",
+ "SparqlID": "?Duck",
+ "isReturned": true,
+ "isRuntimeConstrained": false,
+ "valueConstraint": "",
+ "instanceValue": null,
+ "deletionMode": "NO_DELETE"
+ },
+ {
+ "propList": [],
+ "nodeList": [
+ {
+ "SnodeSparqlIDs": [
+ "?Duck"
+ ],
+ "OptionalMinus": [
+ 0
+ ],
+ "Qualifiers": [
+ ""
+ ],
+ "DeletionMarkers": [
+ false
+ ],
+ "range": [
+ "http://rangetest#Duck",
+ "http://rangetest#Unusual"
+ ],
+ "ConnectBy": "hasChild",
+ "Connected": true,
+ "UriConnectBy": "http://rangetest#hasChild"
+ }
+ ],
+ "fullURIName": "http://rangetest#WeirdBird",
+ "SparqlID": "?WeirdBird",
+ "isReturned": true,
+ "isRuntimeConstrained": false,
+ "valueConstraint": "",
+ "instanceValue": null,
+ "deletionMode": "NO_DELETE"
+ }
+ ],
+ "orderBy": [],
+ "groupBy": [],
+ "unionHash": {},
+ "columnOrder": []
+ },
+ "importSpec": {
+ "version": "1",
+ "baseURI": "",
+ "columns": [],
+ "dataValidator": [],
+ "texts": [],
+ "transforms": [],
+ "nodes": [
+ {
+ "sparqlID": "?WeirdBird",
+ "type": "http://rangetest#WeirdBird",
+ "mapping": [],
+ "props": []
+ },
+ {
+ "sparqlID": "?Duck",
+ "type": "http://rangetest#Duck",
+ "mapping": [],
+ "props": []
+ }
+ ]
+ },
+ "plotSpecs": null
+}
\ No newline at end of file