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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ViaLactea
vlkb-siav2
Commits
820f7bc5
Commit
820f7bc5
authored
1 year ago
by
Robert Butora
Browse files
Options
Downloads
Patches
Plain Diff
output: renames existing obsDataset fields to match naimng from ObsCore
parent
51ff7986
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
data-discovery/src/main/java/vlkb/search/DbPSearch.java
+56
-65
56 additions, 65 deletions
data-discovery/src/main/java/vlkb/search/DbPSearch.java
data-discovery/src/main/java/vlkb/webapi/FormatResponseFilter.java
+12
-10
12 additions, 10 deletions
...overy/src/main/java/vlkb/webapi/FormatResponseFilter.java
with
68 additions
and
75 deletions
data-discovery/src/main/java/vlkb/search/DbPSearch.java
+
56
−
65
View file @
820f7bc5
...
...
@@ -27,57 +27,6 @@ public class DbPSearch
private
static
final
String
DB_DRIVER
=
"org.postgresql.Driver"
;
public
Subsurvey
[]
getSurveyTable
()
{
List
<
Subsurvey
>
survList
=
new
ArrayList
<
Subsurvey
>();
String
theQuery
=
"SELECT name,species,transition,rest_frequency,restf_fits_unit,velocity_fits_unit,description FROM surveys"
;
LOGGER
.
info
(
"Connecting to: "
+
dbConn
.
uri
()
+
" with optional user/pwd: "
+
dbConn
.
userName
()
+
" / "
+
dbConn
.
password
()
);
try
(
Connection
conn
=
DriverManager
.
getConnection
(
dbConn
.
uri
(),
dbConn
.
userName
(),
dbConn
.
password
());
Statement
st
=
conn
.
createStatement
();
ResultSet
res
=
st
.
executeQuery
(
theQuery
);)
{
//ResultSet res = doQuery(theQuery);
if
(
res
==
null
)
{
LOGGER
.
info
(
"Query yielded no resuls: "
+
theQuery
);
}
else
{
while
(
res
.
next
())
{
Subsurvey
surv
=
new
Subsurvey
();
surv
.
rf
=
res
.
getDouble
(
"rest_frequency"
);
surv
.
surveyname
=
res
.
getString
(
"name"
);
surv
.
species
=
res
.
getString
(
"species"
);
surv
.
transition
=
res
.
getString
(
"transition"
);
surv
.
rf_unit
=
res
.
getString
(
"restf_fits_unit"
);
surv
.
vel_unit
=
res
.
getString
(
"velocity_fits_unit"
);
surv
.
description
=
res
.
getString
(
"description"
);
survList
.
add
(
surv
);
}
}
}
catch
(
SQLException
se
)
{
logSqlExInfo
(
se
);
se
.
printStackTrace
();
}
/* catch (ClassNotFoundException e)
{
LOGGER.info("DB driver "+ DB_DRIVER +" not found: " + e.getMessage());
e.printStackTrace();
}
*/
return
survList
.
toArray
(
new
Subsurvey
[
0
]);
}
public
String
[]
queryOverlapingPubdid
(
Coord
coord
,
SubsurveyId
subsurveyId
)
{
LOGGER
.
info
(
"trace"
);
...
...
@@ -251,7 +200,8 @@ public class DbPSearch
}
String
commaSepPubdids
=
String
.
join
(
"\',\'"
,
pubdidArr
);
String
theQuery
=
"SELECT dataproduct_type,obs_publisher_did,obs_collection,polygon_region_galactic,access_url,em_min,em_max,"
//String theQuery ="SELECT dataproduct_type,obs_publisher_did,obs_collection,polygon_region_galactic,access_url,em_min,em_max,"
String
theQuery
=
"SELECT *,"
+
inputRegion
+
" <@ polygon_region_galactic AS inputInsideDb, "
+
inputRegion
+
" @> polygon_region_galactic AS dbInsideInput FROM obscore WHERE (obs_publisher_did IN (\'"
+
commaSepPubdids
+
"\'))"
;
...
...
@@ -273,13 +223,11 @@ public class DbPSearch
while
(
res
.
next
())
{
FormatResponseFilter
.
ObsDataset
obsDataset
=
new
FormatResponseFilter
.
ObsDataset
();
obsDataset
.
data_type
=
res
.
getString
(
"dataproduct_type"
);
obsDataset
.
pubdid_str
=
res
.
getString
(
"
obs_publisher_did
"
);
obsDataset
.
subsurvey_
id
=
res
.
getString
(
"obs_
collection
"
);
obsDataset
.
vertices_str
=
res
.
getString
(
"
polygon_region_gala
cti
c
"
);
obsDataset
.
dataproduct_type
=
res
.
getString
(
"
dataproduct_type
"
);
obsDataset
.
obs_publisher_d
id
=
res
.
getString
(
"obs_
publisher_did
"
);
obsDataset
.
obs_collection
=
res
.
getString
(
"
obs_colle
cti
on
"
);
obsDataset
.
access_url
=
res
.
getString
(
"access_url"
);
obsDataset
.
inputInsideDb
=
res
.
getBoolean
(
"inputInsideDb"
);
obsDataset
.
dbInsideInput
=
res
.
getBoolean
(
"dbInsideInput"
);
obsDataset
.
em_min
=
res
.
getDouble
(
"em_min"
);
boolean
em_min_valid
=
!
res
.
wasNull
();
...
...
@@ -287,6 +235,10 @@ public class DbPSearch
boolean
em_max_valid
=
!
res
.
wasNull
();
obsDataset
.
em_valid
=
em_min_valid
&&
em_max_valid
;;
obsDataset
.
vertices_str
=
res
.
getString
(
"polygon_region_galactic"
);
obsDataset
.
inputInsideDb
=
res
.
getBoolean
(
"inputInsideDb"
);
obsDataset
.
dbInsideInput
=
res
.
getBoolean
(
"dbInsideInput"
);
obsDatasetList
.
add
(
obsDataset
);
}
...
...
@@ -297,12 +249,6 @@ public class DbPSearch
logSqlExInfo
(
se
);
se
.
printStackTrace
();
}
/* catch (ClassNotFoundException e)
{
LOGGER.info("DB driver "+ DB_DRIVER +" not found: " + e.getMessage());
e.printStackTrace();
}
*/
FormatResponseFilter
.
ObsDataset
[]
cubes
=
obsDatasetList
.
toArray
(
new
FormatResponseFilter
.
ObsDataset
[
0
]);
...
...
@@ -358,6 +304,51 @@ public class DbPSearch
return res;
}
*/
/* public Subsurvey[] getSurveyTable()
{
List<Subsurvey> survList = new ArrayList<Subsurvey>();
String theQuery = "SELECT name,species,transition,rest_frequency,restf_fits_unit,velocity_fits_unit,description FROM surveys";
LOGGER.info("Connecting to: " + dbConn.uri() + " with optional user/pwd: " + dbConn.userName() +" / "+ dbConn.password() );
try(
Connection conn = DriverManager.getConnection(dbConn.uri(), dbConn.userName(), dbConn.password());
Statement st = conn.createStatement();
ResultSet res = st.executeQuery(theQuery);)
{
//ResultSet res = doQuery(theQuery);
if(res == null)
{
LOGGER.info("Query yielded no resuls: " + theQuery);
}
else
{
while (res.next())
{
Subsurvey surv = new Subsurvey();
surv.rf = res.getDouble("rest_frequency");
surv.surveyname = res.getString("name");
surv.species = res.getString("species");
surv.transition = res.getString("transition");
surv.rf_unit = res.getString("restf_fits_unit");
surv.vel_unit = res.getString("velocity_fits_unit");
surv.description = res.getString("description");
survList.add(surv);
}
}
}
catch (SQLException se)
{
logSqlExInfo(se);
se.printStackTrace();
}
return survList.toArray(new Subsurvey[0]);
}
*/
...
...
This diff is collapsed.
Click to expand it.
data-discovery/src/main/java/vlkb/webapi/FormatResponseFilter.java
+
12
−
10
View file @
820f7bc5
...
...
@@ -154,17 +154,19 @@ public class FormatResponseFilter implements Filter
/* FIXME type needed in DbPSearch */
static
class
ObsDataset
{
String
data_type
;
String
pubdid_str
;
String
subsurvey_id
;
String
vertices_str
;
String
dataproduct_type
;
String
obs_publisher_did
;
String
obs_collection
;
String
access_url
;
boolean
inputInsideDb
;
boolean
dbInsideInput
;
boolean
em_valid
;
double
em_min
;
double
em_max
;
boolean
em_valid
;
String
vertices_str
;
boolean
inputInsideDb
;
boolean
dbInsideInput
;
}
...
...
@@ -195,12 +197,12 @@ public class FormatResponseFilter implements Filter
{
Dataset
dataset
=
new
Dataset
();
dataset
.
subsurvey_id
=
obsDataset
.
subsurvey_id
;
dataset
.
subsurvey_id
=
obsDataset
.
obs_collection
;
dataset
.
overlapCodeSky
=
convertToOverlapCodeSky
(
obsDataset
.
inputInsideDb
,
obsDataset
.
dbInsideInput
);
dataset
.
overlapCodeVel
=
convertToOverlapCodeVel
(
coord
,
obsDataset
.
em_valid
,
obsDataset
.
em_min
,
obsDataset
.
em_max
);
dataset
.
overlapCode
=
convertToOverlapCode
(
dataset
.
overlapCodeSky
,
dataset
.
overlapCodeVel
);
dataset
.
dataType
=
obsDataset
.
data_type
;
dataset
.
publisherDid
=
obsDataset
.
pubdid_str
;
dataset
.
dataType
=
obsDataset
.
data
product
_type
;
dataset
.
publisherDid
=
obsDataset
.
obs_publisher_did
;
dataset
.
access
.
accessFileUrl
=
obsDataset
.
access_url
;
dataset
.
access
.
accessCutoutUrl
=
fitsRemotePath
+
"?ID="
+
dataset
.
publisherDid
+
"&"
+
queryString
;
...
...
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