Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vlkb-siav2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ViaLactea
vlkb-siav2
Commits
e293dad4
Commit
e293dad4
authored
1 year ago
by
Robert Butora
Browse files
Options
Downloads
Patches
Plain Diff
adds Interval-param and SingleString-param constraints to SQL-query
parent
d9d55530
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
data-discovery/src/main/java/vlkb/search/DbPSearch.java
+42
-1
42 additions, 1 deletion
data-discovery/src/main/java/vlkb/search/DbPSearch.java
with
42 additions
and
1 deletion
data-discovery/src/main/java/vlkb/search/DbPSearch.java
+
42
−
1
View file @
e293dad4
...
...
@@ -51,7 +51,7 @@ public class DbPSearch
=
"((em_min > "
+
Double
.
toString
(
coord
.
band
.
getMax
())
+
") OR (em_max < "
+
Double
.
toString
(
coord
.
band
.
getMin
())
+
"))"
;
theQuery
+=
" AND (
(NOT "
+
vel_no_overlap
+
") OR
(em_min is null) OR (em_max is null))"
;
theQuery
+=
" AND ( (em_min is null) OR (em_max is null)
OR (NOT "
+
vel_no_overlap
+
")
)"
;
/* NOTE '... OR (em_min is null)' statement causes to include 2D datasets if they overlap in sky
* It is the legacy-search behaviour - however is that useful ?
*/
...
...
@@ -79,6 +79,20 @@ public class DbPSearch
if
(
addSS
.
length
()
>
0
)
theQuery
+=
" AND ("
+
addSS
+
")"
;
}
theQuery
+=
appendIntervalConstraint
(
coord
.
fov
,
"s_fov"
);
theQuery
+=
appendIntervalConstraint
(
coord
.
spatres
,
"s_resolution"
);
theQuery
+=
appendIntervalConstraint
(
coord
.
specrp
,
"em_res_power"
);
theQuery
+=
appendIntervalConstraint
(
coord
.
exptime
,
"t_exptime"
);
theQuery
+=
appendIntervalConstraint
(
coord
.
timeres
,
"t_resolution"
);
theQuery
+=
appendStringMatchConstraint
(
coord
.
id
,
"obs_publisher_did"
);
theQuery
+=
appendStringMatchConstraint
(
coord
.
facility
,
"facility_name"
);
theQuery
+=
appendStringMatchConstraint
(
coord
.
instrument
,
"instrument_name"
);
theQuery
+=
appendStringMatchConstraint
(
coord
.
dptype
,
"dataproduct_type"
);
theQuery
+=
appendStringMatchConstraint
(
coord
.
target
,
"target_name"
);
theQuery
+=
appendStringMatchConstraint
(
coord
.
format
,
"access_format"
);
//theQuery += " ORDER BY obs_collection";
LOGGER
.
info
(
theQuery
);
...
...
@@ -112,6 +126,33 @@ public class DbPSearch
return
pubdidArr
;
}
private
String
appendIntervalConstraint
(
Interval
interval
,
String
colName
)
{
if
(
interval
!=
null
)
{
String
no_overlap
=
"(("
+
colName
+
" > "
+
Double
.
toString
(
interval
.
getMax
())
+
") OR ("
+
colName
+
" < "
+
Double
.
toString
(
interval
.
getMin
())
+
"))"
;
return
" AND ( ("
+
colName
+
" is null) OR (NOT "
+
no_overlap
+
"))"
;
}
else
{
return
""
;
}
}
private
String
appendStringMatchConstraint
(
String
str
,
String
colName
)
{
if
(
str
!=
null
)
{
return
" AND ( ("
+
colName
+
" is null) OR ('"
+
str
.
trim
()
+
"' = "
+
colName
+
"))"
;
}
else
{
return
""
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment