| 1 |
<!-- A template for a simple DaCHS cone search service metadata; |
| 2 |
To fill it out, search and replace %.*% |
| 3 |
|
| 4 |
Note that this doesn't expose all features of DaCHS. For advanced |
| 5 |
projects, you'll still have to read documentation... --> |
| 6 |
\tpldesc{Catalogs via SCS and TAP} |
| 7 |
|
| 8 |
<resource schema="\resdir" resdir="."> |
| 9 |
<meta name="creationDate">\now</meta> |
| 10 |
|
| 11 |
\commonmeta |
| 12 |
<table id="main" onDisk="True" mixin="//scs#q3cindex" adql="True"> |
| 13 |
<!-- if you don't have a unique identifier, create one; SCS requires |
| 14 |
that no two rows have the same id --> |
| 15 |
<primary>id</primary> |
| 16 |
|
| 17 |
<!-- Add more STC information as appropriate. For instance: |
| 18 |
Position ICRS Epoch J2015.0 "ra" "dec" Error "ra_error" "dec_error" |
| 19 |
|
| 20 |
See also http://docs.g-vo.org/DaCHS/tutorial.html#stc |
| 21 |
--> |
| 22 |
<stc> |
| 23 |
Position ICRS "ra" "dec" |
| 24 |
</stc> |
| 25 |
|
| 26 |
<!-- id is mandatory for SCS; you can use a different type if you |
| 27 |
want, DaCHS will turn it into string on output (as required by |
| 28 |
by SCS --> |
| 29 |
<column name="id" type="integer" |
| 30 |
ucd="meta.id;meta.main" |
| 31 |
tablehead="Id" |
| 32 |
description="Main identifier for this object." |
| 33 |
verbLevel="1"/> |
| 34 |
<column name="ra" type="double precision" |
| 35 |
unit="deg" ucd="pos.eq.ra;meta.main" |
| 36 |
tablehead="RA" |
| 37 |
description="ICRS right ascension for this object. |
| 38 |
%add more info, like epoch and such%" |
| 39 |
verbLevel="1"/> |
| 40 |
<column name="dec" type="double precision" |
| 41 |
unit="deg" ucd="pos.eq.dec;meta.main" |
| 42 |
tablehead="Dec" |
| 43 |
description="ICRS declination for this object. |
| 44 |
%add more info, like epoch and such%" |
| 45 |
verbLevel="1"/> |
| 46 |
%add further columns% |
| 47 |
</table> |
| 48 |
|
| 49 |
<coverage> |
| 50 |
<updater sourceTable="main"/> |
| 51 |
</coverage> |
| 52 |
|
| 53 |
<data id="import"> |
| 54 |
<sources pattern="%resdir-relative pattern, like data/*.txt%"/> |
| 55 |
|
| 56 |
<!-- the grammar really depends on your input material. See |
| 57 |
http://docs.g-vo.org/DaCHS/ref.html#grammars-available, |
| 58 |
in particular columnGrammar, csvGrammar, fitsTableGrammar, |
| 59 |
and reGrammar; if nothing else helps see embeddedGrammar |
| 60 |
or customGrammar --> |
| 61 |
<csvGrammar names="identifier ra dec mag"/> |
| 62 |
|
| 63 |
<make table="main"> |
| 64 |
<rowmaker idmaps="*"> |
| 65 |
<!-- the following example assumes you'll have to |
| 66 |
cut off the first two chars from what's in the source |
| 67 |
to get the identifier for your table --> |
| 68 |
<map dest="id">int(@identifier[2:])</map> |
| 69 |
</rowmaker> |
| 70 |
</make> |
| 71 |
</data> |
| 72 |
|
| 73 |
<service id="cone" allowed="form,scs.xml"> |
| 74 |
<meta name="shortName">%max. 16 characters%</meta> |
| 75 |
<meta name="testQuery"> |
| 76 |
<meta name="ra">%an RA of a position returning at least 1 object%</meta> |
| 77 |
<meta name="dec">%a Dec of a position returning at least 1 object%</meta> |
| 78 |
<meta name="sr">%search radius that returns at least 1 object%</meta> |
| 79 |
</meta> |
| 80 |
|
| 81 |
<!-- the browser interface goes to the VO and the front page --> |
| 82 |
<publish render="form" sets="ivo_managed, local"/> |
| 83 |
<!-- the SCS service isn't usable with a browser, so it goes to |
| 84 |
the VO only --> |
| 85 |
<publish render="scs.xml" sets="ivo_managed"/> |
| 86 |
<!-- all publish elements only become active after you run |
| 87 |
dachs pub q --> |
| 88 |
|
| 89 |
<scsCore queriedTable="main"> |
| 90 |
<FEED source="//scs#coreDescs"/> |
| 91 |
<!-- to enable other query parameters, something like |
| 92 |
<condDesc buildFrom="colname"/> should usually be enough. --> |
| 93 |
</scsCore> |
| 94 |
</service> |
| 95 |
|
| 96 |
<regSuite title="\resdir regression"> |
| 97 |
<regTest title="\resdir SCS serves some data"> |
| 98 |
<url RA="%ra that returns exactly one row%" |
| 99 |
DEC="%dec that returns exactly one row%" SR="0.001" |
| 100 |
>cone/scs.xml</url> |
| 101 |
<code> |
| 102 |
# The actual assertions are pyUnit-like. Obviously, you want to |
| 103 |
# remove the print statement once you've worked out what to test |
| 104 |
# against. |
| 105 |
row = self.getFirstVOTableRow() |
| 106 |
print(row) |
| 107 |
self.assertAlmostEqual(row["ra"], 22.22222) |
| 108 |
</code> |
| 109 |
</regTest> |
| 110 |
|
| 111 |
<!-- add more tests: extra tests for the web side, custom widgets, |
| 112 |
rendered outputFields... --> |
| 113 |
</regSuite> |
| 114 |
</resource> |