diff --git a/skeleton/test/lightweight-tests/src/test/java/it/unibz/inf/ontop/docker/lightweight/{lowername}/Cast{pascalname}Test.java b/skeleton/test/lightweight-tests/src/test/java/it/unibz/inf/ontop/docker/lightweight/{lowername}/Cast{pascalname}Test.java new file mode 100644 index 0000000..765659d --- /dev/null +++ b/skeleton/test/lightweight-tests/src/test/java/it/unibz/inf/ontop/docker/lightweight/{lowername}/Cast{pascalname}Test.java @@ -0,0 +1,30 @@ +package it.unibz.inf.ontop.docker.lightweight.{lowername}; + +import com.google.common.collect.ImmutableMultiset; +import com.google.common.collect.ImmutableSet; +import it.unibz.inf.ontop.docker.lightweight.AbstractCastFunctionsTest; +import it.unibz.inf.ontop.docker.lightweight.{pascalname}SQLLightweightTest; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.sql.SQLException; + +@{pascalname}SQLLightweightTest +public class Cast{pascalname}SQLTest extends AbstractCastFunctionsTest { + + private static final String PROPERTIES_FILE = "/books/{lowername}/books-{lowername}.properties"; + + @BeforeAll + public static void before() throws IOException, SQLException { + initOBDA(OBDA_FILE, OWL_FILE, PROPERTIES_FILE); + } + + @AfterAll + public static void after() throws SQLException { + release(); + } + +} diff --git a/skeleton/test/lightweight-tests/src/test/java/it/unibz/inf/ontop/docker/lightweight/{lowername}/NestedData{pascalname}Test.java b/skeleton/test/lightweight-tests/src/test/java/it/unibz/inf/ontop/docker/lightweight/{lowername}/NestedData{pascalname}Test.java new file mode 100644 index 0000000..d80e87f --- /dev/null +++ b/skeleton/test/lightweight-tests/src/test/java/it/unibz/inf/ontop/docker/lightweight/{lowername}/NestedData{pascalname}Test.java @@ -0,0 +1,31 @@ +package it.unibz.inf.ontop.docker.lightweight.{lowername}; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMultiset; +import com.google.common.collect.ImmutableSet; +import it.unibz.inf.ontop.docker.lightweight.AbstractNestedDataTest; +import it.unibz.inf.ontop.docker.lightweight.{pascalname}LightweightTest; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; + +import java.io.IOException; +import java.sql.SQLException; + +@{pascalname}LightweightTest +public class NestedData{pascalname}Test extends AbstractNestedDataTest { + + private static final String PROPERTIES_FILE = "/nested/{lowername}/nested-{lowername}.properties"; + private static final String OBDA_FILE = "/nested/nested.obda"; + private static final String LENS_FILE = "/nested/{lowername}/nested-lenses.json"; + + @BeforeAll + public static void before() throws IOException, SQLException { + initOBDA(OBDA_FILE, OWL_FILE, PROPERTIES_FILE, LENS_FILE); + } + + @AfterAll + public static void after() throws SQLException { + release(); + } + +} diff --git a/skeleton/test/lightweight-tests/src/test/resources/nested/{lowername}/nested-lenses.json b/skeleton/test/lightweight-tests/src/test/resources/nested/{lowername}/nested-lenses.json new file mode 100644 index 0000000..5a8f02d --- /dev/null +++ b/skeleton/test/lightweight-tests/src/test/resources/nested/{lowername}/nested-lenses.json @@ -0,0 +1,123 @@ +{ + "relations": [ + { + "name": [ "lenses", "company_data_arrays" ], + "baseRelation": [ "company_data_arrays" ], + "uniqueConstraints": { + "added": [ + { + "name": "uc", + "determinants": [ "id" ] + } + ] + }, + "type": "BasicLens" + }, + { + "name": ["lenses","flattened_dates"], + "baseRelation": ["lenses", "company_data_arrays"], + "flattenedColumn": { + "name": "days", + "datatype": "array" + }, + "columns": { + "kept": [ + "id" + ], + "new": "invoice_date", + "position": "index" + }, + "type": "FlattenLens" + }, + { + "name": ["lenses","flattened_income"], + "baseRelation": ["lenses", "company_data_arrays"], + "flattenedColumn": { + "name": "income", + "datatype": "array" + }, + "columns": { + "kept": [ + "id" + ], + "new": "period_income", + "position": "index" + }, + "type": "FlattenLens" + }, + { + "name": ["lenses","flattened_workers_mid"], + "baseRelation": ["lenses", "company_data_arrays"], + "flattenedColumn": { + "name": "workers", + "datatype": "array>" + }, + "columns": { + "kept": [ + "id" + ], + "new": "worker_list", + "position": "index" + }, + "type": "FlattenLens" + }, + { + "name": ["lenses","flattened_workers"], + "baseRelation": ["lenses","flattened_workers_mid"], + "flattenedColumn": { + "name": "worker_list", + "datatype": "array" + }, + "columns": { + "kept": [ + "id", + "index" + ], + "new": "name" + }, + "type": "FlattenLens" + }, + { + "name": ["lenses","flattened_managers"], + "baseRelation": ["lenses", "company_data_arrays"], + "flattenedColumn": { + "name": "managers", + "datatype": "array" + }, + "columns": { + "kept": [ + "id" + ], + "new": "manager", + "position": "index" + }, + "type": "FlattenLens" + }, + { + "name": ["lenses","managers"], + "baseRelation": ["lenses","flattened_managers"], + "columns": { + "added": [ + { + "name": "firstname", + "expression": "CAST(GET_JSON_OBJECT(manager, '$.firstName') AS string)" + }, + { + "name": "lastname", + "expression": "CAST(GET_JSON_OBJECT(manager, '$.lastName') AS string)" + }, + { + "name": "age", + "expression": "CAST(GET_JSON_OBJECT(manager, '$.age') AS integer)" + } + ], + "hidden": [ + "manager" + ] + }, + "type": "BasicLens" + } + ] + } + + \ No newline at end of file diff --git a/skeleton/test/lightweight-tests/src/test/resources/nested/{lowername}/nested-{lowername}.properties b/skeleton/test/lightweight-tests/src/test/resources/nested/{lowername}/nested-{lowername}.properties new file mode 100644 index 0000000..f53a5f8 --- /dev/null +++ b/skeleton/test/lightweight-tests/src/test/resources/nested/{lowername}/nested-{lowername}.properties @@ -0,0 +1,4 @@ +jdbc.url = {url} +jdbc.user = {user} +jdbc.password = {password} +jdbc.driver = {classname} \ No newline at end of file