| 1 |
<resource schema="tap_schema" resdir="__system"> |
| 2 |
<meta name="creationDate">2009-12-01T10:00:00</meta> |
| 3 |
<meta name="subject">virtual-observatories</meta> |
| 4 |
<meta name="subject">catalogs</meta> |
| 5 |
<meta name="schema-rank">10</meta> |
| 6 |
|
| 7 |
<meta name="description"> |
| 8 |
\getConfig{web}{sitename}'s Table Access Protocol |
| 9 |
(TAP) service with table metadata. |
| 10 |
</meta> |
| 11 |
|
| 12 |
|
| 13 |
<!--**************************** the TAP schema *********************--> |
| 14 |
|
| 15 |
<table id="schemas" onDisk="True" system="True" |
| 16 |
dupePolicy="overwrite" primary="schema_name" |
| 17 |
adql="True"> |
| 18 |
<meta name="description">Schemas containing tables available for ADQL |
| 19 |
querying.</meta> |
| 20 |
<!-- since schemata may be shared between RDs, nothing will ever |
| 21 |
get deleted from here (automatically); in particular, there is no |
| 22 |
sourceRD column here because that might need to have multiple |
| 23 |
values. In principle, based on dc.rdmeta one could drop schemas |
| 24 |
here when they are no longer used. --> |
| 25 |
|
| 26 |
<column name="schema_name" type="text" |
| 27 |
description="Fully qualified schema name"> |
| 28 |
<property name="std">1</property> |
| 29 |
</column> |
| 30 |
<column name="description" type="unicode" |
| 31 |
description="Brief description of the schema"> |
| 32 |
<property name="std">1</property> |
| 33 |
</column> |
| 34 |
<column name="utype" type="text" |
| 35 |
description="utype if schema corresponds to a data model"> |
| 36 |
<property name="std">1</property> |
| 37 |
</column> |
| 38 |
<column name="schema_index" type="integer" |
| 39 |
description="Suggested position this schema should take in a sorted |
| 40 |
list of schemas from this data center."> |
| 41 |
<property name="std">1</property> |
| 42 |
<values nullLiteral="-1"/> |
| 43 |
</column> |
| 44 |
</table> |
| 45 |
|
| 46 |
<table id="tables" onDisk="True" system="True" primary="table_name" |
| 47 |
adql="True"> |
| 48 |
<meta name="description">Tables available for ADQL querying.</meta> |
| 49 |
<meta name="table-rank">1</meta> |
| 50 |
<foreignKey source="schema_name" inTable="schemas"/> |
| 51 |
|
| 52 |
<column name="schema_name" type="text" |
| 53 |
tablehead="Schema" |
| 54 |
description="Fully qualified schema name"> |
| 55 |
<property name="std">1</property> |
| 56 |
</column> |
| 57 |
<column name="table_name" type="text" |
| 58 |
tablehead="Table" |
| 59 |
description="Fully qualified table name"> |
| 60 |
<property name="std">1</property> |
| 61 |
</column> |
| 62 |
<column name="table_type" type="text" |
| 63 |
tablehead="Type" |
| 64 |
description="One of: table, view"> |
| 65 |
<property name="std">1</property> |
| 66 |
</column> |
| 67 |
<column name="description" type="unicode" |
| 68 |
description="Brief description of the table"> |
| 69 |
<property name="std">1</property> |
| 70 |
</column> |
| 71 |
<column name="utype" type="text" |
| 72 |
description="utype if the table corresponds to a data model"> |
| 73 |
<property name="std">1</property> |
| 74 |
</column> |
| 75 |
<column name="table_index" type="integer" |
| 76 |
description="Suggested position this table should take in |
| 77 |
a sorted list of tables from this data center"> |
| 78 |
<property name="std">1</property> |
| 79 |
<values nullLiteral="-1"/> |
| 80 |
</column> |
| 81 |
<column name="sourceRD" type="text" |
| 82 |
description="Id of the originating rd (local information)"/> |
| 83 |
<column name="nrows" type="bigint" |
| 84 |
description="The approximate size of the table in rows"> |
| 85 |
<property name="std">1</property> |
| 86 |
<values nullLiteral="-1"/> |
| 87 |
</column> |
| 88 |
</table> |
| 89 |
|
| 90 |
<table id="columns" onDisk="True" system="True" |
| 91 |
primary="table_name,column_name" adql="True"> |
| 92 |
<meta name="description">Columns in tables available for ADQL querying. |
| 93 |
</meta> |
| 94 |
<meta name="table-rank">1</meta> |
| 95 |
<foreignKey source="table_name" inTable="tables"/> |
| 96 |
|
| 97 |
<column name="table_name" type="text" |
| 98 |
tablehead="Table" |
| 99 |
description="Fully qualified table name"> |
| 100 |
<property name="std">1</property> |
| 101 |
</column> |
| 102 |
<column name="column_name" type="text" |
| 103 |
tablehead="Name" |
| 104 |
description="Column name"> |
| 105 |
<property name="std">1</property> |
| 106 |
</column> |
| 107 |
<column name="description" type="unicode" |
| 108 |
description="Brief description of column"> |
| 109 |
<property name="std">1</property> |
| 110 |
</column> |
| 111 |
<column name="unit" type="text" |
| 112 |
description="Unit in VO standard format"> |
| 113 |
<property name="std">1</property> |
| 114 |
</column> |
| 115 |
<column name="ucd" type="text" |
| 116 |
tablehead="UCD" |
| 117 |
description="UCD of column if any"> |
| 118 |
<property name="std">1</property> |
| 119 |
</column> |
| 120 |
<column name="utype" type="text" |
| 121 |
description="Utype of column if any"> |
| 122 |
<property name="std">1</property> |
| 123 |
</column> |
| 124 |
<column name="datatype" type="text" |
| 125 |
tablehead="Type" |
| 126 |
description="ADQL datatype"> |
| 127 |
<property name="std">1</property> |
| 128 |
</column> |
| 129 |
<column name="arraysize" type="text" |
| 130 |
tablehead="Arr." |
| 131 |
description="Arraysize in VOTable notation"> |
| 132 |
<property name="std">1</property> |
| 133 |
</column> |
| 134 |
<column name="xtype" type="text" |
| 135 |
tablehead="xtype" |
| 136 |
description="VOTable extended type information (for special |
| 137 |
interpretation of data content, e.g., timestamps or points)"> |
| 138 |
<property name="std">1</property> |
| 139 |
</column> |
| 140 |
<column name="quoted/size" type="integer" |
| 141 |
description="Legacy length (ignore if you can)."> |
| 142 |
<values nullLiteral="-1"/> |
| 143 |
<property name="std">1</property> |
| 144 |
</column> |
| 145 |
<column name="principal" type="integer" required="True" |
| 146 |
tablehead="Princ?" |
| 147 |
description="Is column principal?"> |
| 148 |
<property name="std">1</property> |
| 149 |
</column> |
| 150 |
<column name="indexed" type="integer" required="True" |
| 151 |
tablehead="Indexed?" |
| 152 |
description="Is there an index on this column?"> |
| 153 |
<property name="std">1</property> |
| 154 |
</column> |
| 155 |
<column name="std" type="integer" required="True" |
| 156 |
tablehead="Std?" |
| 157 |
description="Is this a standard column?"> |
| 158 |
<property name="std">1</property> |
| 159 |
</column> |
| 160 |
<column name="sourceRD" type="text" |
| 161 |
description="Id of the originating rd (local information)"/> |
| 162 |
<column name="column_index" type="smallint" |
| 163 |
tablehead="Ind." |
| 164 |
description="1-based index of the column in database order."> |
| 165 |
<property name="std">1</property> |
| 166 |
<values nullLiteral="-1"/> |
| 167 |
</column> |
| 168 |
</table> |
| 169 |
|
| 170 |
<table id="keys" onDisk="True" system="True" |
| 171 |
primary="key_id" adql="True"> |
| 172 |
<meta name="description">Foreign key relationships between tables |
| 173 |
available for ADQL querying. |
| 174 |
</meta> |
| 175 |
<foreignKey source="from_table" dest="table_name" inTable="tables"/> |
| 176 |
<foreignKey source="target_table" dest="table_name" inTable="tables"/> |
| 177 |
|
| 178 |
<column name="key_id" type="text" |
| 179 |
tablehead="Id" |
| 180 |
description="Unique key identifier"> |
| 181 |
<property name="std">1</property> |
| 182 |
</column> |
| 183 |
<column name="from_table" type="text" |
| 184 |
tablehead="From table..." |
| 185 |
description="Fully qualified table name"> |
| 186 |
<property name="std">1</property> |
| 187 |
</column> |
| 188 |
<column name="target_table" type="text" |
| 189 |
tablehead="To table..." |
| 190 |
description="Fully qualified table name"> |
| 191 |
<property name="std">1</property> |
| 192 |
</column> |
| 193 |
<column name="description" type="unicode" |
| 194 |
description="Description of this key"> |
| 195 |
<property name="std">1</property> |
| 196 |
</column> |
| 197 |
<column name="utype" type="text" |
| 198 |
description="Utype of this key"> |
| 199 |
<property name="std">1</property> |
| 200 |
</column> |
| 201 |
<column name="sourceRD" type="text" |
| 202 |
description="Id of the originating rd (local information)"/> |
| 203 |
</table> |
| 204 |
|
| 205 |
<table id="key_columns" onDisk="True" system="True" adql="True"> |
| 206 |
<meta name="description">Columns participating in foreign key |
| 207 |
relationships between tables available for ADQL querying. |
| 208 |
</meta> |
| 209 |
<foreignKey source="key_id" |
| 210 |
dest="key_id" inTable="keys"/> |
| 211 |
|
| 212 |
<column name="key_id" type="text" |
| 213 |
tablehead="Id" |
| 214 |
description="Key identifier from TAP_SCHEMA.keys"> |
| 215 |
<property name="std">1</property> |
| 216 |
</column> |
| 217 |
<column name="from_column" type="text" |
| 218 |
tablehead="Src. Column" |
| 219 |
description="Key column name in the from table"> |
| 220 |
<property name="std">1</property> |
| 221 |
</column> |
| 222 |
<column name="target_column" type="text" |
| 223 |
tablehead="Tgt. Column" |
| 224 |
description="Key column in the target table"> |
| 225 |
<property name="std">1</property> |
| 226 |
</column> |
| 227 |
<column name="sourceRD" type="text" |
| 228 |
description="Id of the originating rd (local information)"/> |
| 229 |
</table> |
| 230 |
|
| 231 |
<table id="groups" onDisk="True" system="True" adql="True"> |
| 232 |
<meta name="description">Columns that are part of groups |
| 233 |
within tables available for ADQL querying. |
| 234 |
</meta> |
| 235 |
<foreignKey source="table_name" inTable="tables"/> |
| 236 |
<!-- this is slightly denormalized, but normalizing it by introducing |
| 237 |
two new tables IMHO isn't worth it at all --> |
| 238 |
<column original="columns.table_name"/> |
| 239 |
<column original="columns.column_name" |
| 240 |
description="Name of a column belonging to the group"/> |
| 241 |
<column original="columns.utype" name="column_utype" |
| 242 |
description="utype the column within the group"/> |
| 243 |
<column name="group_name" type="text" |
| 244 |
description="Name of the group"/> |
| 245 |
<column name="group_utype" type="text" |
| 246 |
description="utype of the group"/> |
| 247 |
<column name="sourceRD" type="text" |
| 248 |
description="Id of the originating rd (local information)"/> |
| 249 |
</table> |
| 250 |
|
| 251 |
<table id="supportedmodels" onDisk="True" primary="dmivorn" |
| 252 |
dupePolicy="overwrite" system="True"> |
| 253 |
<meta name="description"> |
| 254 |
Standard data models supported by this service. |
| 255 |
|
| 256 |
This is a non-standard tap_schema table used by DaCHS in the creation |
| 257 |
of registry records. It is manipulated through gavo imp on tables |
| 258 |
with supportsModel and supportsModelURI properties. |
| 259 |
</meta> |
| 260 |
<column original="tables.sourceRD"/> |
| 261 |
<column name="dmname" type="text" |
| 262 |
description="Human-readable name of the data model"/> |
| 263 |
<column name="dmivorn" type="text" |
| 264 |
description="IVOID of the data model (sorry for the legacy name)."/> |
| 265 |
</table> |
| 266 |
|
| 267 |
<data id="importTablesFromRD" auto="False"> |
| 268 |
<embeddedGrammar isDispatching="True"> |
| 269 |
<iterator> |
| 270 |
<code> |
| 271 |
rd = self.sourceToken |
| 272 |
yield ("schemas", { |
| 273 |
"schema_name": rd.schema, |
| 274 |
"schema_description": base.getMetaText(rd, "description"), |
| 275 |
"schema_utype": base.getMetaText(rd, "utype"), |
| 276 |
"schema_index": base.getMetaText(rd, "schema-rank")}) |
| 277 |
|
| 278 |
# the moribund property is set by external code if the |
| 279 |
# rd is to be removed from TAP_SCHEMA. The removal |
| 280 |
# is already done by the the newSource script in make |
| 281 |
# below, thus we only need to do nothing here. |
| 282 |
if rd.getProperty("moribund", False): |
| 283 |
return |
| 284 |
for table in rd.tables: |
| 285 |
if not table.adql or table.adql=="hidden": |
| 286 |
continue |
| 287 |
if table.viewStatement: |
| 288 |
tapTableType = "view" |
| 289 |
else: |
| 290 |
tapTableType = "table" |
| 291 |
|
| 292 |
yield ("tables", { |
| 293 |
"schema_name": rd.schema, |
| 294 |
"table_name": table.getQName().lower(), |
| 295 |
"table_description": base.getMetaText( |
| 296 |
table, "description", |
| 297 |
propagate=True), |
| 298 |
"table_type": tapTableType, |
| 299 |
"table_utype": base.getMetaText( |
| 300 |
table, "utype", |
| 301 |
propagate=False), |
| 302 |
"sourceRD": rd.sourceId, |
| 303 |
"nrows": table.nrows, |
| 304 |
"table_index": base.getMetaText(table, "table-rank"), |
| 305 |
}) |
| 306 |
</code> |
| 307 |
</iterator> |
| 308 |
</embeddedGrammar> |
| 309 |
|
| 310 |
<make table="schemas" role="schemas"> |
| 311 |
<rowmaker> |
| 312 |
<simplemaps> |
| 313 |
schema_index: schema_index, |
| 314 |
schema_name: schema_name, |
| 315 |
description: schema_description, |
| 316 |
utype: schema_utype |
| 317 |
</simplemaps> |
| 318 |
</rowmaker> |
| 319 |
</make> |
| 320 |
|
| 321 |
<make table="tables" role="tables"> |
| 322 |
<script type="newSource" lang="python" id="removeStale" |
| 323 |
notify="False" name="delete stale TAP_SCHEMA entries"> |
| 324 |
table.deleteMatching("sourceRD=%(sourceRD)s", |
| 325 |
{"sourceRD": sourceToken.sourceId}) |
| 326 |
</script> |
| 327 |
|
| 328 |
<rowmaker idmaps="*"> |
| 329 |
<simplemaps> |
| 330 |
utype: table_utype, |
| 331 |
description: table_description |
| 332 |
</simplemaps> |
| 333 |
</rowmaker> |
| 334 |
</make> |
| 335 |
</data> |
| 336 |
|
| 337 |
<data id="importDMsFromRD" auto="False"> |
| 338 |
<!-- note: we rely on tables removing entries from that list |
| 339 |
themselves rather than doing it here. The reason is that |
| 340 |
multiple different tables might claim the same data model, and |
| 341 |
if I unconditionally tore them down, that's about as broken |
| 342 |
as leaving them. The whole dataModel thing in TAPRegExt was |
| 343 |
a mistake. --> |
| 344 |
<embeddedGrammar> |
| 345 |
<iterator> |
| 346 |
<code> |
| 347 |
rd = self.sourceToken |
| 348 |
if rd.getProperty("moribund", False): |
| 349 |
return |
| 350 |
|
| 351 |
for table in rd.tables: |
| 352 |
if not table.adql or table.adql=="hidden": |
| 353 |
continue |
| 354 |
yield { |
| 355 |
"sourceRD": rd.sourceId, |
| 356 |
"table_name": table.getQName().lower(), |
| 357 |
"dmname": table.getProperty("supportsModel", None), |
| 358 |
"dmivorn": table.getProperty("supportsModelURI", None), |
| 359 |
} |
| 360 |
</code> |
| 361 |
</iterator> |
| 362 |
<rowfilter> |
| 363 |
<code> |
| 364 |
if @dmname: |
| 365 |
for name, uri in ( |
| 366 |
zip(@dmname.split(","), @dmivorn.split())): |
| 367 |
yield { |
| 368 |
"sourceRD": @sourceRD, |
| 369 |
"dmname": name.strip(), |
| 370 |
"dmivorn": uri} |
| 371 |
</code> |
| 372 |
</rowfilter> |
| 373 |
</embeddedGrammar> |
| 374 |
<make table="supportedmodels"/> |
| 375 |
</data> |
| 376 |
|
| 377 |
<data id="importColumnsFromRD" auto="False"> |
| 378 |
<embeddedGrammar> |
| 379 |
<iterator> |
| 380 |
<setup> |
| 381 |
<code> |
| 382 |
from gavo.utils.typeconversions import sqltypeToVOTable |
| 383 |
</code> |
| 384 |
</setup> |
| 385 |
<code> |
| 386 |
rd = self.sourceToken |
| 387 |
if rd.getProperty("moribund", False): |
| 388 |
return |
| 389 |
for table in rd.tables: |
| 390 |
if not table.adql or table.adql=="hidden": |
| 391 |
continue |
| 392 |
|
| 393 |
for index, col in enumerate(table): |
| 394 |
if col.hidden: |
| 395 |
continue |
| 396 |
indexed = 0 |
| 397 |
if col.isIndexed(): |
| 398 |
indexed = 1 |
| 399 |
type, arraysize, xtype = sqltypeToVOTable(col.type) |
| 400 |
# xtype overrides -- if this becomes more common, we'll |
| 401 |
# have to change sqltypeToVOTable to take local xtypes |
| 402 |
# into account as well. |
| 403 |
# There's analogous code in registry.tableset. |
| 404 |
if col.xtype=='adql:REGION': |
| 405 |
type, arraysize, xtype = "char", "*", "adql:REGION" |
| 406 |
|
| 407 |
try: |
| 408 |
legacy_size = int(arraysize) |
| 409 |
except (TypeError, ValueError): |
| 410 |
legacy_size = None |
| 411 |
|
| 412 |
yield { |
| 413 |
"table_name": table.getQName().lower(), |
| 414 |
"column_name": col.getTAPName(), |
| 415 |
"description": col.description, |
| 416 |
"unit": col.unit, |
| 417 |
"ucd": col.ucd, |
| 418 |
"utype": col.utype, |
| 419 |
"xtype": xtype, |
| 420 |
"arraysize": arraysize, |
| 421 |
"datatype": type, |
| 422 |
"size": legacy_size, |
| 423 |
"principal": col.verbLevel<=20, |
| 424 |
"indexed": indexed, |
| 425 |
"std": parseInt(col.getProperty("std", "0")), |
| 426 |
"sourceRD": rd.sourceId, |
| 427 |
"column_index": index+1, |
| 428 |
} |
| 429 |
</code> |
| 430 |
</iterator> |
| 431 |
</embeddedGrammar> |
| 432 |
<make table="columns"> |
| 433 |
<script original="removeStale"/> |
| 434 |
</make> |
| 435 |
</data> |
| 436 |
|
| 437 |
<data id="importGroupsFromRD" auto="False"> |
| 438 |
<embeddedGrammar> |
| 439 |
<iterator> |
| 440 |
<code> |
| 441 |
rd = self.sourceToken |
| 442 |
if rd.getProperty("moribund", False): |
| 443 |
return |
| 444 |
for table in rd.tables: |
| 445 |
if not table.adql or table.adql=="hidden": |
| 446 |
continue |
| 447 |
for group in table.groups: |
| 448 |
for colRef in group.columnRefs: |
| 449 |
yield { |
| 450 |
"table_name": table.getQName().lower(), |
| 451 |
"column_name": colRef.resolve(table).getTAPName(), |
| 452 |
"column_utype": colRef.utype, |
| 453 |
"group_name": group.name, |
| 454 |
"group_utype": group.utype, |
| 455 |
"sourceRD": rd.sourceId, |
| 456 |
} |
| 457 |
</code> |
| 458 |
</iterator> |
| 459 |
</embeddedGrammar> |
| 460 |
<make table="groups"/> |
| 461 |
</data> |
| 462 |
|
| 463 |
<data id="importFkeysFromRD" auto="False"> |
| 464 |
<embeddedGrammar> |
| 465 |
<iterator> |
| 466 |
<code> |
| 467 |
rd = self.sourceToken |
| 468 |
if rd.getProperty("moribund", False): |
| 469 |
return |
| 470 |
for table in rd.tables: |
| 471 |
if not table.adql or table.adql=="hidden": |
| 472 |
continue |
| 473 |
for fkey in table.foreignKeys: |
| 474 |
if not fkey.isADQLKey: |
| 475 |
continue |
| 476 |
|
| 477 |
fkeyId = rd.sourceId+utils.intToFunnyWord(id(fkey)) |
| 478 |
yield { |
| 479 |
"key_id": fkeyId.lower(), |
| 480 |
"from_table": table.getQName().lower(), |
| 481 |
"target_table": fkey.inTable.getQName().lower(), |
| 482 |
"description": None, |
| 483 |
"utype": None, |
| 484 |
"sourceRD": rd.sourceId, |
| 485 |
"dest": "keys", |
| 486 |
} |
| 487 |
for src, dst in zip(fkey.source, fkey.dest): |
| 488 |
yield { |
| 489 |
"key_id": fkeyId.lower(), |
| 490 |
"from_column": src.lower(), |
| 491 |
"target_column": dst.lower(), |
| 492 |
"sourceRD": rd.sourceId, |
| 493 |
"dest": "cols", |
| 494 |
} |
| 495 |
</code> |
| 496 |
</iterator> |
| 497 |
</embeddedGrammar> |
| 498 |
|
| 499 |
<!-- XXX TODO: We should let the DB do our work here by properly |
| 500 |
defining the fkey relationship between keys and key_columns --> |
| 501 |
|
| 502 |
<rowmaker id="build_keys" idmaps="*"> |
| 503 |
<ignoreOn><not><keyIs key="dest" value="keys"/></not></ignoreOn> |
| 504 |
</rowmaker> |
| 505 |
|
| 506 |
<rowmaker id="build_key_columns" idmaps="*"> |
| 507 |
<ignoreOn><not><keyIs key="dest" value="cols"/></not></ignoreOn> |
| 508 |
</rowmaker> |
| 509 |
|
| 510 |
<make table="keys" rowmaker="build_keys"> |
| 511 |
<script original="removeStale"/> |
| 512 |
</make> |
| 513 |
<make table="key_columns" rowmaker="build_key_columns"> |
| 514 |
<script original="removeStale"/> |
| 515 |
</make> |
| 516 |
</data> |
| 517 |
|
| 518 |
<data id="createSchema"> |
| 519 |
<!-- run this to create the TAP schema initially, or to recreate it |
| 520 |
later. To update the TAP schema contents after a bugfix or standards |
| 521 |
update, use gavo.user.upgrade._updateTAP_SCHEMA. |
| 522 |
--> |
| 523 |
<make table="schemas"/> |
| 524 |
<make table="tables"/> |
| 525 |
<make table="columns"/> |
| 526 |
<make table="keys"/> |
| 527 |
<make table="groups"/> |
| 528 |
<make table="supportedmodels"/> |
| 529 |
<make table="key_columns"> |
| 530 |
<!-- this script is for bootstrapping. Since TAP_SCHEMA isn't |
| 531 |
finished when the tables are created, they cannot be added |
| 532 |
to them. There's special code to let tap.py ignore them |
| 533 |
in that situation, and this code here adds them when TAP_SCHEMA |
| 534 |
is done. |
| 535 |
--> |
| 536 |
<script type="postCreation" lang="python" |
| 537 |
name="Add TAP_SCHEMA to TAP_SCHEMA" notify="False"> |
| 538 |
from gavo.protocols import tap |
| 539 |
rd = table.tableDef.rd |
| 540 |
tap._insertRDIntoTAP_SCHEMA(rd, table.connection) |
| 541 |
</script> |
| 542 |
</make> |
| 543 |
</data> |
| 544 |
|
| 545 |
<data id="refresh" updating="True" auto="False"> |
| 546 |
<sources items="refresh"/> |
| 547 |
<nullGrammar/> |
| 548 |
<make table="schemas"> |
| 549 |
<script name="Refresh TAP schema" type="newSource" lang="python" |
| 550 |
notify="False"> |
| 551 |
from gavo.protocols import tap |
| 552 |
|
| 553 |
toDo = [r[0] for r in |
| 554 |
table.connection.query( |
| 555 |
"SELECT DISTINCT sourceRD FROM tap_schema.tables")] |
| 556 |
|
| 557 |
for rdId in toDo: |
| 558 |
if rdId=="__system__/tap": |
| 559 |
# TAP_SCHEMA needs special handling because of bootstrapping |
| 560 |
tap._insertRDIntoTAP_SCHEMA( |
| 561 |
base.caches.getRD(rdId), table.connection) |
| 562 |
continue |
| 563 |
|
| 564 |
try: |
| 565 |
tap.publishToTAP( |
| 566 |
base.caches.getRD(rdId, doQueries=False), table.connection) |
| 567 |
except Exception as msg: |
| 568 |
base.ui.notifyWarning("RD %s couldn't be loaded or ingested to" |
| 569 |
" TAP_SCHEMA (%s). Fix and run dachs imp -m on it to have" |
| 570 |
" up-to-date metadata in TAP_SCHEMA"%(rdId, msg)) |
| 571 |
continue |
| 572 |
|
| 573 |
</script> |
| 574 |
</make> |
| 575 |
</data> |
| 576 |
|
| 577 |
|
| 578 |
<!--********************* TAP UWS job table ******************--> |
| 579 |
|
| 580 |
<table id="tapjobs" system="True"> |
| 581 |
<meta name="description"> |
| 582 |
A non-standard (and not tap-accessible) table used for managing |
| 583 |
asynchronous TAP jobs. It is manipulated through TAP job creation |
| 584 |
and destruction internally. Under very special circumstances, operators |
| 585 |
can use the gavo admin cleantap command to purge jobs from this table. |
| 586 |
|
| 587 |
Note that such jobs have corresponding directories in $STATEDIR/uwsjobs, |
| 588 |
which will be orphaned if this table is manipulated through SQL. |
| 589 |
</meta> |
| 590 |
<FEED source="//uws#uwsfields"/> |
| 591 |
<column name="pid" type="integer" |
| 592 |
description="A unix pid to kill to make the job stop"> |
| 593 |
<values nullLiteral="-1"/> |
| 594 |
</column> |
| 595 |
</table> |
| 596 |
|
| 597 |
<data id="createJobTable"> |
| 598 |
<make table="tapjobs"/> |
| 599 |
</data> |
| 600 |
|
| 601 |
|
| 602 |
<!--********************* The TAP Service *********************--> |
| 603 |
<service id="run" allowed="sync,async,dali,user_tables" |
| 604 |
defaultRenderer="info"> |
| 605 |
<meta name="identifier">ivo://\getConfig{ivoa}{authority}/tap</meta> |
| 606 |
<meta name="shortName">\metaString{authority.shortName} TAP</meta> |
| 607 |
<meta name="title">\getConfig{web}{sitename} TAP service</meta> |
| 608 |
|
| 609 |
|
| 610 |
<meta name="_longdoc" format="rst"><![CDATA[ |
| 611 |
This service speaks TAP, a protocol designed to allow the exchange of |
| 612 |
queries and data between clients (that's normally something running on your |
| 613 |
computer) and servers (e.g., us). |
| 614 |
|
| 615 |
You will want to use some sort of client to query TAP services; |
| 616 |
examples for those include: |
| 617 |
|
| 618 |
* TOPCAT_ (see in the "VO" menu) |
| 619 |
* `TAPHandle`_ (following this link should bring you to a page |
| 620 |
that lets you query this server) works completely within your |
| 621 |
browser, |
| 622 |
* pyVO_ (for VO support in python programs) |
| 623 |
|
| 624 |
You can, in a pinch, use our service in an XML-enabled browser, too. |
| 625 |
Under `Overview <#overview>`_, look for the bullet point on tap and |
| 626 |
follow the link to "this service". Then, click on "New job..." |
| 627 |
in the job list, enter your query, click "Set query", then |
| 628 |
"Execute query". Reload the page you are redirected to now |
| 629 |
and then to see when your job is finished, then retrieve the result. |
| 630 |
|
| 631 |
The queries this service executes are written an a dialect of SQL called |
| 632 |
ADQL. You need to learn it to use this service. See |
| 633 |
`our ADQL tutorial`_. Also do not miss the `local examples`_. |
| 634 |
|
| 635 |
By the way, for quick ad-hoc queries from within a browser, |
| 636 |
our `ADQL form service`_ may be more convenient than TAP. |
| 637 |
|
| 638 |
Also see the `table metadata`_ of the tables exposed here. |
| 639 |
|
| 640 |
Local information: This service may put a much lower limit on |
| 641 |
uploads in sync queries than advertised in the table metadata. |
| 642 |
Unfortunately, current TOPCAT versions don't give terribly helpful error |
| 643 |
messages when the server rejects a query because the attached upload is |
| 644 |
too large (something like “Error writing request body to server“). |
| 645 |
If that happens to you, just switch to asynchronous querying (in TOPCAT, |
| 646 |
that's in the “Mode” combo box just above the query editor). |
| 647 |
|
| 648 |
|
| 649 |
.. _TOPCAT: http://www.star.bris.ac.uk/~mbt/topcat/ |
| 650 |
.. _GAVO VOTable library: http://soft.g-vo.org/subpkgs |
| 651 |
.. _TAP shell: http://soft.g-vo.org/tapsh |
| 652 |
.. _pyVO: https://github.com/pyvirtobs/pyvo |
| 653 |
.. _table metadata: \internallink{__system__/dc_tables/list/form} |
| 654 |
.. _ADQL form service: \internallink{__system__/adql/query/form} |
| 655 |
.. _service doc of our ADQL form service: \internallink{__system__/adql/query/info} |
| 656 |
.. _our ADQL tutorial: http://docs.g-vo.org/adql |
| 657 |
.. _local examples: \internallink{__system__/tap/run/examples} |
| 658 |
.. _TAPHandle: http://saada.unistra.fr/taphandle/?url=\internallink{/tap} |
| 659 |
|
| 660 |
|
| 661 |
Issues |
| 662 |
====== |
| 663 |
|
| 664 |
For information on our ADQL implementation, see the |
| 665 |
\RSTservicelink{__system__/adql/query/info}{ADQL service info}. |
| 666 |
|
| 667 |
If multiple output columns in a query would end up having the same name, |
| 668 |
in the output VOTable they are disambiguated by appending underscores. |
| 669 |
This is in violation of the specification, but since fixing it would |
| 670 |
require rather intrusive changes into our software and it is not |
| 671 |
clear why one should want to use names when they are not unique to begin |
| 672 |
with, this will probably not be fixed. |
| 673 |
]]> |
| 674 |
</meta> |
| 675 |
<publish render="dali" sets="ivo_managed,local"> |
| 676 |
<meta name="accessURL">\internallink{tap}</meta> |
| 677 |
</publish> |
| 678 |
|
| 679 |
<tapCore/> |
| 680 |
|
| 681 |
<FEED source="%#tapdescription"/> |
| 682 |
<FEED source="%#tapexamples"/> |
| 683 |
</service> |
| 684 |
</resource> |