Skip to content

Commit

Permalink
wip experiements with merging metadata and provenance object
Browse files Browse the repository at this point in the history
  • Loading branch information
clezag committed Jul 18, 2024
1 parent 384847f commit 1255908
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/main/java/it/bz/idm/bdp/ninja/DataFetcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public List<Map<String, Object>> 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);

Expand Down Expand Up @@ -228,7 +228,7 @@ public List<Map<String, Object>> 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",
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand All @@ -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))
Expand Down

0 comments on commit 1255908

Please sign in to comment.