Skip to content

Commit

Permalink
bump to v0.46.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gmella committed Nov 28, 2023
1 parent 642b595 commit 5e01f83
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
32 changes: 18 additions & 14 deletions content/jmmc-simbad.xql
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,19 @@ declare %private function jmmc-simbad:tap-adql-query($uri as xs:string, $query a
(:~
: Return a target description from the VOTable row.
:
: The description is made from the oid, ra and dec coordinates and the main
: name.
:
: The description is made from the main_name, ra, dec, pmra, pmdec coordinates and the oid.
: Empty proper motion values are replaced by -0 values
: @param $row a VOTable row
: @return a target description as sequence
:)
declare %private function jmmc-simbad:target($row as element(votable:TR)) as element(target) {
<target> {
for $f at $i in $row/ancestor::votable:TABLE/votable:FIELD
let $name := $f/@name
let $value := $row/votable:TD[position() = $i]/text()
let $value := if ($name=("pmra", "pmdec")) then
try{xs:double($row/votable:TD[position() = $i])} catch * {"-0"}
else
$row/votable:TD[position() = $i]/text()
return element { $name } { $value }
} </target>
};
Expand Down Expand Up @@ -109,7 +111,7 @@ declare %private function jmmc-simbad:escape($str as xs:string) as xs:string {
declare function jmmc-simbad:votable4identifiers($identifiers as xs:string*){
let $table :=
<table>
<tr><th>identifier</th></tr>
<tr><th>user_identifier</th></tr>
{
for $identifier in $identifiers
return <tr><td>{$identifier}</td></tr>
Expand All @@ -119,13 +121,14 @@ declare function jmmc-simbad:votable4identifiers($identifiers as xs:string*){
let $votable := jmmc-tap:table2votable($table, $name)

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

(:~
: Try to identify somes targets from the given identifiers on CDS Simbad.
: Empty proper motion values are replaced by -0 values
:
: @param $identifiers the target names
: @return a map of identifiers / targets (same format as resolve-by-name) value is empty if identifier is unknown on Simbad.
Expand All @@ -134,22 +137,23 @@ declare function jmmc-simbad:resolve-by-names($identifiers as xs:string*) as ite
let $votable := jmmc-simbad:votable4identifiers($identifiers)
let $map := map:merge(
for $tr in $votable//*:TR
let $my_identifier := data($tr/*:TD[1])
let $user_identifier := data($tr/*:TD[1])
let $id := data($tr/*:TD[7])
let $target := if (exists($id)) then
<target>
{
element {"name"} {data($tr/*:TD[2])}
,element {"ra"} {data($tr/*:TD[3])}
,element {"dec"} {data($tr/*:TD[4])}
,element {"pmra"} {data($tr/*:TD[5])}
,element {"pmdec"} {data($tr/*:TD[6])}
,element {"id"} {data($tr/*:TD[7])}
element {"user_identifier"} {$user_identifier}
,element {"name"} {data($tr/*:TD[2])}
,element {"ra"} {data($tr/*:TD[3])}
,element {"dec"} {data($tr/*:TD[4])}
,element {"pmra"} {try{xs:double($tr/*:TD[5])} catch * {"-0"}}
,element {"pmdec"} {try{xs:double($tr/*:TD[6])} catch * {"-0"}}
,element {"id"} {$id}
}
</target>
else
()
return map:entry($my_identifier, $target)
return map:entry($user_identifier, $target)
)
return $map
};
Expand Down
2 changes: 1 addition & 1 deletion expath-pkg.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://expath.org/ns/pkg" name="http://exist.jmmc.fr/jmmc-resources" abbrev="jmmc-resources" version="0.46.0" spec="1.0">
<package xmlns="http://expath.org/ns/pkg" name="http://exist.jmmc.fr/jmmc-resources" abbrev="jmmc-resources" version="0.46.1" spec="1.0">
<title>JMMC Commons module</title>
<dependency processor="http://exist-db.org" semver-min="6.0.0"/>
<!--
Expand Down
1 change: 1 addition & 0 deletions post-install.xql
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ let $op := sm:chmod( xs:anyURI("/ads/records"), "rwxrwxrwx")


(:
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")
TODO:
- copy data/collection.xconf into /db/ads so we index bibcode elements
- apply xmldb:reindex on /db/ads
Expand Down
3 changes: 2 additions & 1 deletion repo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
<prepare/>
<finish>post-install.xql</finish>
<changelog>
<change version="0.46.0">
<change version="0.46.1">
<ul xmlns="">
<li>jmmc-tap : tap-adql-query() support optional votable-name for tap-upload.</li>
<li>jmmc-tap : add table2votable() as helper for tap-upload.</li>
<li>jmmc-simbad : add resolve-by-names() to scale-up name resolution (few seconds for one thousand of identifiers).</li>
<li>jmmc-simbad : change resolve-target : always set -0 for missing pmra or pmdec and add user_identifier to store user input.</li>
</ul>
</change>
<change version="0.45.0">
Expand Down

0 comments on commit 5e01f83

Please sign in to comment.