108
108
remember. Aliases are specified in an XML file (C<lanl-schema.xml>) that is part
109
109
of the distribution. Custom field aliases can be set up by modifying this file.
111
An HTML cheatsheet with valid field names, aliases, and match data can
112
be generated from the XML by using
113
C<hiv_object-E<gt>help('help.html')>. A query can also be validated
114
locally before it is unleashed on the server; see below.
111
An HTML cheatsheet with valid field names, aliases, and match data can be
112
generated from the XML by using C<hiv_object-E<gt>help('help.html')>. A query
113
can also be validated locally before it is unleashed on the server; see below.
116
115
=head2 Annotations
429
428
@flds = grep /^$tbl/, $schema->fields;
430
429
@flds = grep !/_id/, @flds;
432
$h->start_Tr({-style=>"background-color: lightblue;"}),
433
$h->td([$h->a({-id=>$tbl},$tbl), $h->span({-style=>"font-style:italic"},"fields"), $h->span({-style=>"font-style:italic"}, "aliases")]),
431
$h->start_Tr({-style=>"background-color: lightblue;"}),
432
$h->td([$h->a({-id=>$tbl},$tbl), $h->span({-style=>"font-style:italic"},"fields"), $h->span({-style=>"font-style:italic"}, "aliases")]),
436
435
foreach my $fld (@flds) {
437
@als = reverse $schema->aliases($fld);
439
$h->Tr( $h->td( ["", $h->a({-href=>"#opt$fld"}, shift @als), $h->code(join(',',@als))] ))
441
my @tmp = grep {$_} $schema->options($fld);
442
@tmp = sort {(($a =~ /^[0-9]+$/) && $b =~ /^[0-9]+$/) ? $a<=>$b : $a cmp $b} @tmp;
443
if (grep /Any/,@tmp) {
444
@tmp = grep !/Any/, @tmp;
447
#print STDERR join(', ',@tmp)."\n";
449
{-style=>"font-family:sans-serif;font-size:small"},
453
"<i>Valid options for</i> <b>$fld</b>: "),
455
@tmp ? $h->code(join(", ", @tmp)) : $h->i("free text")
458
"<i>Other aliases</i>: "),
460
@als ? $h->code(join(",",@als)) : "<i>none</i>"
465
$h->a({-href=>"#$tbl"}, $h->small('BACK')),
466
$h->a({-href=>"#TOP"}, $h->small('TOP'))
436
@als = reverse $schema->aliases($fld);
438
# note that aliases can sometimes be empty
439
$h->Tr( $h->td( ["", $h->a({-href=>"#opt$fld"}, shift @als || '???'), $h->code(join(',',@als))] ))
441
my @tmp = grep {$_} $schema->options($fld);
442
@tmp = sort {(($a =~ /^[0-9]+$/) && $b =~ /^[0-9]+$/) ? $a<=>$b : $a cmp $b} @tmp;
443
if (grep /Any/,@tmp) {
444
@tmp = grep !/Any/, @tmp;
447
#print STDERR join(', ',@tmp)."\n";
449
{-style=>"font-family:sans-serif;font-size:small"},
453
"<i>Valid options for</i> <b>$fld</b>: "
456
@tmp ? $h->code(join(", ", @tmp)) : $h->i("free text")
459
"<i>Other aliases</i>: "
462
@als ? $h->code(join(",",@als)) : "<i>none</i>"
468
$h->a({-href=>"#$tbl"}, $h->small('BACK')),
469
$h->a({-href=>"#TOP"}, $h->small('TOP'))
472
477
print $fh $h->end_table;