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
aa7a24a3
Commit
aa7a24a3
authored
1 year ago
by
Robert Butora
Browse files
Options
Downloads
Patches
Plain Diff
implements votable output bySurveys (Survey->RESOURCE, Species+Trans->TABLE)
parent
6894a28e
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/output/XmlSerializer.java
+140
-0
140 additions, 0 deletions
data-discovery/src/main/java/vlkb/output/XmlSerializer.java
data-discovery/src/main/java/vlkb/webapi/FormatResponseFilter.java
+8
-2
8 additions, 2 deletions
...overy/src/main/java/vlkb/webapi/FormatResponseFilter.java
with
148 additions
and
2 deletions
data-discovery/src/main/java/vlkb/output/XmlSerializer.java
+
140
−
0
View file @
aa7a24a3
...
...
@@ -9,6 +9,8 @@ import java.io.IOException;
import
java.io.OutputStreamWriter
;
import
java.io.BufferedWriter
;
import
java.util.List
;
import
java.util.ArrayList
;
final
class
XmlSerializer
...
...
@@ -135,6 +137,144 @@ final class XmlSerializer
}
public
static
void
serializeToVoTableBySurveys
(
PrintWriter
writer
,
String
charEncoding
,
SearchOutputData
searchOutputData
,
boolean
showDuration
,
long
startTime_msec
)
throws
IOException
{
BufferedWriter
out
=
new
BufferedWriter
(
writer
);
out
.
write
(
"<VOTABLE version='1.1'>"
);
out
.
write
(
"<DESCRIPTION> "
+
searchOutputData
.
versionString
+
" SUBSURVCOUNT: "
+
searchOutputData
.
subsurveyArr
.
length
+
" </DESCRIPTION>"
);
if
((
searchOutputData
.
subsurveyArr
!=
null
)
&&
(
searchOutputData
.
subsurveyArr
.
length
>
0
))
{
// assumes ORDERED subsurveyArray: by surveyname
List
<
StarTable
>
tableList
=
new
ArrayList
();
String
prevSurveyname
=
searchOutputData
.
subsurveyArr
[
0
].
surveyname
.
trim
();
for
(
Subsurvey
subsurvey
:
searchOutputData
.
subsurveyArr
)
{
if
(
prevSurveyname
.
equals
(
subsurvey
.
surveyname
.
trim
()))
{
StarTable
table
=
makeSubsurveyTable
(
subsurvey
);
tableList
.
add
(
table
);
}
else
{
out
.
write
(
"<RESOURCE>"
);
out
.
write
(
"<DESCRIPTION> "
+
prevSurveyname
+
" </DESCRIPTION>"
);
/* PLACEHOLDER FOR RESOURCE PARAM
table.setParameter(new DescribedValue(
new DefaultValueInfo("subsurveyCount",Integer.class,
"Count of subsurveys with found datacube(s)" ),
subsurveyArr.length ) );
table.setParameter(new DescribedValue(
new DefaultValueInfo( "survey", String.class,
"Survey name" ),
subsurvey.surveyname ) );
*/
StarTable
[]
tables
=
tableList
.
toArray
(
new
StarTable
[
0
]);
for
(
int
i
=
0
;
i
<
tables
.
length
;
i
++
)
{
VOSerializer
.
makeSerializer
(
DataFormat
.
TABLEDATA
,
tables
[
i
]
).
writeInlineTableElement
(
out
);
}
tableList
.
clear
();
out
.
write
(
"</RESOURCE>"
);
prevSurveyname
=
subsurvey
.
surveyname
.
trim
();
StarTable
table
=
makeSubsurveyTable
(
subsurvey
);
tableList
.
add
(
table
);
}
}
if
(!
tableList
.
isEmpty
())
{
out
.
write
(
"<RESOURCE>"
);
out
.
write
(
"<DESCRIPTION> "
+
prevSurveyname
+
" </DESCRIPTION>"
);
/* PLACEHOLDER FOR RESOURCE PARAM
table.setParameter(new DescribedValue(
new DefaultValueInfo("subsurveyCount",Integer.class,
"Count of subsurveys with found datacube(s)" ),
subsurveyArr.length ) );
table.setParameter(new DescribedValue(
new DefaultValueInfo( "survey", String.class,
"Survey name" ),
subsurvey.surveyname ) );
*/
StarTable
[]
tables
=
tableList
.
toArray
(
new
StarTable
[
0
]);
for
(
int
i
=
0
;
i
<
tables
.
length
;
i
++
)
{
VOSerializer
.
makeSerializer
(
DataFormat
.
TABLEDATA
,
tables
[
i
]
).
writeInlineTableElement
(
out
);
}
tableList
.
clear
();
out
.
write
(
"</RESOURCE>"
);
}
}
out
.
write
(
"</VOTABLE>"
);
out
.
flush
();
}
private
static
StarTable
makeSubsurveyTable
(
Subsurvey
subsurvey
)
{
RowListStarTable
table
=
new
RowListStarTable
(
ObscoreExt
.
OBSCORE_VLKB_COLINFO
);
table
.
setParameter
(
new
DescribedValue
(
new
DefaultValueInfo
(
"datacubeCount"
,
Integer
.
class
,
"Count of all datacubes from VLKB-search"
),
subsurvey
.
datasetArr
.
length
)
);
table
.
setParameter
(
new
DescribedValue
(
new
DefaultValueInfo
(
"velocity_unit"
,
String
.
class
,
"Unit of velocity in FITS header"
),
subsurvey
.
vel_unit
)
);
table
.
setParameter
(
new
DescribedValue
(
new
DefaultValueInfo
(
"survey"
,
String
.
class
,
"Survey name"
),
subsurvey
.
surveyname
)
);
table
.
setParameter
(
new
DescribedValue
(
new
DefaultValueInfo
(
"species"
,
String
.
class
,
"Species"
),
subsurvey
.
species
)
);
table
.
setParameter
(
new
DescribedValue
(
new
DefaultValueInfo
(
"transition"
,
String
.
class
,
"Transition"
),
subsurvey
.
transition
)
);
table
.
setParameter
(
new
DescribedValue
(
new
DefaultValueInfo
(
"description"
,
String
.
class
,
"Reference description"
),
subsurvey
.
description
)
);
for
(
Dataset
dataset
:
subsurvey
.
datasetArr
)
{
if
(
dataset
.
obsCore
==
null
)
continue
;
// FIXME skip mergeable datasets
table
.
addRow
(
ObscoreExt
.
obscoreVlkbRow
(
dataset
)
);
}
return
table
;
}
// legacy
public
static
void
serializeToLegacyResults
(
...
...
This diff is collapsed.
Click to expand it.
data-discovery/src/main/java/vlkb/webapi/FormatResponseFilter.java
+
8
−
2
View file @
aa7a24a3
...
...
@@ -156,9 +156,15 @@ public class FormatResponseFilter implements Filter
boolean
showDuration
=
false
;
if
(
respFormat
.
contains
(
"mode=bysubsurveys"
))
XmlSerializer
.
serializeToVoTableBySubsurveys
(
responseWriter
,
RESPONSE_ENCODING
,
searchOutputData
,
showDuration
,
startTime_msec
);
XmlSerializer
.
serializeToVoTableBySubsurveys
(
responseWriter
,
RESPONSE_ENCODING
,
searchOutputData
,
showDuration
,
startTime_msec
);
else
if
(
respFormat
.
contains
(
"mode=bysurveys"
))
XmlSerializer
.
serializeToVoTableBySurveys
(
responseWriter
,
RESPONSE_ENCODING
,
searchOutputData
,
showDuration
,
startTime_msec
);
else
XmlSerializer
.
serializeToVoTable
(
responseWriter
,
RESPONSE_ENCODING
,
searchOutputData
,
showDuration
,
startTime_msec
);
XmlSerializer
.
serializeToVoTable
(
responseWriter
,
RESPONSE_ENCODING
,
searchOutputData
,
showDuration
,
startTime_msec
);
}
else
{
...
...
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