Debian Codegraph @

gavo/resources/src/template-taptable.rd_

raw
1 <!-- A template for a simple, TAP-accessible table with no further frills.
2 If you have "typed" data (object catalgues, images, spectra...), use
3 a more refined template.
4
5 To fill it out, search and replace %.*%
6
7 Note that this doesn't expose all features of DaCHS. For advanced
8 projects, you'll still have to read documentation... -->
9 \tpldesc{Any sort of data via a plain TAP table}
10
11 <resource schema="\resdir" resdir=".">
12 <meta name="creationDate">\now</meta>
13
14 \commonmeta
15 <table id="main" onDisk="True" adql="True">
16 <column name="%enter a name%" type="%sql type: integer, double precisions...%"
17 unit="%remove the attribute if unitless%" ucd="%cf. dachs adm suggest%"
18 tablehead="%short label for a table header%"
19 description="%long, human readable information. Be precise here%"/>
20 %add further columns%
21 </table>
22
23 <data id="import">
24 <sources pattern="%resdir-relative pattern, like data/*.txt%"/>
25
26 <!-- the grammar really depends on your input material. See
27 http://docs.g-vo.org/DaCHS/ref.html#grammars-available,
28 in particular columnGrammar, csvGrammar, fitsTableGrammar,
29 and reGrammar; if nothing else helps see embeddedGrammar
30 or customGrammar -->
31 <csvGrammar names="name1 some_other_name and_so_on"/>
32
33 <make table="main">
34 <rowmaker idmaps="*">
35 <!-- the following is an example of a mapping rule that uses
36 a python expression; @something takes the value of the something
37 field returned by the grammar. You obviously need to edit
38 or remove this concrete rule. -->
39 <map dest="%name of a column%">int(@some_other_name[2:])</map>
40 </rowmaker>
41 </make>
42 </data>
43
44 <service id="q" allowed="form">
45 <!-- if you want a browser-based service in addition to TAP, use
46 this. Otherwise, delete this and just write <publish/> into
47 the table element above to publish the table as such. With a
48 service, the table will be published as part of the service -->
49 <meta name="shortName">%max. 16 characters%</meta>
50
51 <!-- the browser interface goes to the VO and the front page -->
52 <publish render="form" sets="ivo_managed, local"/>
53 <!-- all publish elements only become active after you run
54 dachs pub q -->
55
56 <dbCore queriedTable="main">
57 <!-- to add query constraints on table columns, add condDesc
58 elements built from the column -->
59 <condDesc buildFrom="%colname%"/>
60 </dbCore>
61 </service>
62
63 <regSuite title="\resdir regression">
64 <regTest title="\resdir table serves some data">
65 <url parSet="TAP"
66 QUERY="SELECT * FROM \resdir.main WHERE %select one column%"
67 >/tap/sync</url>
68 <code>
69 # The actual assertions are pyUnit-like. Obviously, you want to
70 # remove the print statement once you've worked out what to test
71 # against.
72 row = self.getFirstVOTableRow()
73 print(row)
74 self.assertAlmostEqual(row["ra"], 22.22222)
75 </code>
76 </regTest>
77
78 <!-- add more tests: extra tests for the web side, custom widgets,
79 rendered outputFields... -->
80 </regSuite>
81 </resource>