From 12559083e79075767145ed04911011f998164b8f Mon Sep 17 00:00:00 2001 From: Clemens Zagler Date: Thu, 18 Jul 2024 15:47:11 +0200 Subject: [PATCH] wip experiements with merging metadata and provenance object --- .../java/it/bz/idm/bdp/ninja/DataFetcher.java | 6 +++--- .../ninja/config/SelectExpansionConfig.java | 20 ++++++++++++++++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/main/java/it/bz/idm/bdp/ninja/DataFetcher.java b/src/main/java/it/bz/idm/bdp/ninja/DataFetcher.java index ac2a5124..3e66cd74 100644 --- a/src/main/java/it/bz/idm/bdp/ninja/DataFetcher.java +++ b/src/main/java/it/bz/idm/bdp/ninja/DataFetcher.java @@ -184,7 +184,7 @@ public List> fetchStationsTypesAndMeasurementHistory(String SelectExpansion se = new SelectExpansionConfig().getSelectExpansion(); QueryBuilder query = QueryBuilder .init(se, select, where, distinct, "station", "parent", "measurementdouble", "measurement", "datatype", - "provenance"); + "provenance", "metadata", "metaProvenance"); int measurementType = checkMeasurementType(query); @@ -228,7 +228,7 @@ public List> fetchStationsTypesAndMeasurementHistory(String if (hasFlag(measurementType, MEASUREMENT_TYPE_STRING)) { query.reset(select, where, distinct, "station", "parent", "measurementstring", "measurement", "datatype", - "provenance") + "provenance", "metadata", "metaProvenance") .addSql("select") .addSqlIf("distinct", distinct) .addSqlIf("s.stationtype as _stationtype, s.stationcode as _stationcode, t.cname as _datatypename", @@ -267,7 +267,7 @@ && hasFlag(measurementType, MEASUREMENT_TYPE_JSON)) { if (hasFlag(measurementType, MEASUREMENT_TYPE_JSON)) { query.reset(select, where, distinct, "station", "parent", "measurementjson", "measurement", "datatype", - "provenance") + "provenance", "metadata", "metaProvenance") .addSql("select") .addSqlIf("distinct", distinct) .addSqlIf("s.stationtype as _stationtype, s.stationcode as _stationcode, t.cname as _datatypename", diff --git a/src/main/java/it/bz/idm/bdp/ninja/config/SelectExpansionConfig.java b/src/main/java/it/bz/idm/bdp/ninja/config/SelectExpansionConfig.java index 01a16d85..606b81db 100644 --- a/src/main/java/it/bz/idm/bdp/ninja/config/SelectExpansionConfig.java +++ b/src/main/java/it/bz/idm/bdp/ninja/config/SelectExpansionConfig.java @@ -107,6 +107,23 @@ public SelectExpansionConfig() { schema.add(parent); + TargetDefList metaProvenance = TargetDefList + .init("metaProvenance") + .setLookUp(new LookUp(LookUpType.MERGE, "metadata", "mpprovenance", null)) + .add(new TargetDef("mprname", "s.name")) + .add(new TargetDef("mprversion", "pr.data_collector_version")) + .add(new TargetDef("mprlineage", "pr.lineage")); + + schema.add(metaProvenance); + + TargetDefList metadata = TargetDefList + .init("metadata") + .setLookUp(new LookUp(LookUpType.INLINE, "station", "smetadata", null)) + .add(new TargetDef("mpprovenance", metaProvenance)) + .add(new TargetDef("mpmetadata", "m.json")); + + schema.add(metadata); + TargetDefList station = TargetDefList .init("station") .setLookUp(new LookUp(LookUpType.MAP, "stationtype", "stations", "_stationcode")) @@ -117,13 +134,14 @@ public SelectExpansionConfig() { .add(new TargetDef("sactive", "s.active")) .add(new TargetDef("savailable", "s.available")) .add(new TargetDef("scoordinate", "s.pointprojection")) - .add(new TargetDef("smetadata", "m.json")) + .add(new TargetDef("smetadata",metadata)) .add(new TargetDef("sparent", parent)) .add(new TargetDef("sdatatypes", datatype)) .add(new TargetDef("smetadatahistory", metadatahistory)); schema.add(station); + TargetDefList stationBegin = TargetDefList .init("stationbegin") .setLookUp(new LookUp(LookUpType.INLINE, "edge", "ebegin", null))