Skip to content

Commit 5e01f83

Browse files
committed
bump to v0.46.1
1 parent 642b595 commit 5e01f83

File tree

4 files changed

+22
-16
lines changed

4 files changed

+22
-16
lines changed

content/jmmc-simbad.xql

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,19 @@ declare %private function jmmc-simbad:tap-adql-query($uri as xs:string, $query a
5858
(:~
5959
: Return a target description from the VOTable row.
6060
:
61-
: The description is made from the oid, ra and dec coordinates and the main
62-
: name.
63-
:
61+
: The description is made from the main_name, ra, dec, pmra, pmdec coordinates and the oid.
62+
: Empty proper motion values are replaced by -0 values
6463
: @param $row a VOTable row
6564
: @return a target description as sequence
6665
:)
6766
declare %private function jmmc-simbad:target($row as element(votable:TR)) as element(target) {
6867
<target> {
6968
for $f at $i in $row/ancestor::votable:TABLE/votable:FIELD
7069
let $name := $f/@name
71-
let $value := $row/votable:TD[position() = $i]/text()
70+
let $value := if ($name=("pmra", "pmdec")) then
71+
try{xs:double($row/votable:TD[position() = $i])} catch * {"-0"}
72+
else
73+
$row/votable:TD[position() = $i]/text()
7274
return element { $name } { $value }
7375
} </target>
7476
};
@@ -109,7 +111,7 @@ declare %private function jmmc-simbad:escape($str as xs:string) as xs:string {
109111
declare function jmmc-simbad:votable4identifiers($identifiers as xs:string*){
110112
let $table :=
111113
<table>
112-
<tr><th>identifier</th></tr>
114+
<tr><th>user_identifier</th></tr>
113115
{
114116
for $identifier in $identifiers
115117
return <tr><td>{$identifier}</td></tr>
@@ -119,13 +121,14 @@ declare function jmmc-simbad:votable4identifiers($identifiers as xs:string*){
119121
let $votable := jmmc-tap:table2votable($table, $name)
120122

121123
let $query := "SELECT whynot.*, main_id AS name, ra, dec, pmra, pmdec, oid AS id " ||
122-
"FROM basic JOIN ident ON oidref=oid RIGHT JOIN TAP_UPLOAD.whynot as whynot ON id=my_identifier"
124+
"FROM basic JOIN ident ON oidref=oid RIGHT JOIN TAP_UPLOAD.whynot as whynot ON id=my_user_identifier"
123125
return
124126
jmmc-tap:tap-adql-query($jmmc-simbad:TAP-SYNC, $query, $votable, count($identifiers), "votable/td")
125127
};
126128

127129
(:~
128130
: Try to identify somes targets from the given identifiers on CDS Simbad.
131+
: Empty proper motion values are replaced by -0 values
129132
:
130133
: @param $identifiers the target names
131134
: @return a map of identifiers / targets (same format as resolve-by-name) value is empty if identifier is unknown on Simbad.
@@ -134,22 +137,23 @@ declare function jmmc-simbad:resolve-by-names($identifiers as xs:string*) as ite
134137
let $votable := jmmc-simbad:votable4identifiers($identifiers)
135138
let $map := map:merge(
136139
for $tr in $votable//*:TR
137-
let $my_identifier := data($tr/*:TD[1])
140+
let $user_identifier := data($tr/*:TD[1])
138141
let $id := data($tr/*:TD[7])
139142
let $target := if (exists($id)) then
140143
<target>
141144
{
142-
element {"name"} {data($tr/*:TD[2])}
143-
,element {"ra"} {data($tr/*:TD[3])}
144-
,element {"dec"} {data($tr/*:TD[4])}
145-
,element {"pmra"} {data($tr/*:TD[5])}
146-
,element {"pmdec"} {data($tr/*:TD[6])}
147-
,element {"id"} {data($tr/*:TD[7])}
145+
element {"user_identifier"} {$user_identifier}
146+
,element {"name"} {data($tr/*:TD[2])}
147+
,element {"ra"} {data($tr/*:TD[3])}
148+
,element {"dec"} {data($tr/*:TD[4])}
149+
,element {"pmra"} {try{xs:double($tr/*:TD[5])} catch * {"-0"}}
150+
,element {"pmdec"} {try{xs:double($tr/*:TD[6])} catch * {"-0"}}
151+
,element {"id"} {$id}
148152
}
149153
</target>
150154
else
151155
()
152-
return map:entry($my_identifier, $target)
156+
return map:entry($user_identifier, $target)
153157
)
154158
return $map
155159
};

expath-pkg.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<package xmlns="http://expath.org/ns/pkg" name="http://exist.jmmc.fr/jmmc-resources" abbrev="jmmc-resources" version="0.46.0" spec="1.0">
2+
<package xmlns="http://expath.org/ns/pkg" name="http://exist.jmmc.fr/jmmc-resources" abbrev="jmmc-resources" version="0.46.1" spec="1.0">
33
<title>JMMC Commons module</title>
44
<dependency processor="http://exist-db.org" semver-min="6.0.0"/>
55
<!--

post-install.xql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ let $op := sm:chmod( xs:anyURI("/ads/records"), "rwxrwxrwx")
2222

2323

2424
(:
25+
let $install := repo:install-and-deploy("http://expath.org/ns/ft-client", "1.2.0", "http://demo.exist-db.org/exist/apps/public-repo/modules/find.xql")
2526
TODO:
2627
- copy data/collection.xconf into /db/ads so we index bibcode elements
2728
- apply xmldb:reindex on /db/ads

repo.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111
<prepare/>
1212
<finish>post-install.xql</finish>
1313
<changelog>
14-
<change version="0.46.0">
14+
<change version="0.46.1">
1515
<ul xmlns="">
1616
<li>jmmc-tap : tap-adql-query() support optional votable-name for tap-upload.</li>
1717
<li>jmmc-tap : add table2votable() as helper for tap-upload.</li>
1818
<li>jmmc-simbad : add resolve-by-names() to scale-up name resolution (few seconds for one thousand of identifiers).</li>
19+
<li>jmmc-simbad : change resolve-target : always set -0 for missing pmra or pmdec and add user_identifier to store user input.</li>
1920
</ul>
2021
</change>
2122
<change version="0.45.0">

0 commit comments

Comments
 (0)