Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

added make target to build api docs #303

Merged
merged 3 commits into from

1 participant

@teharrison
Owner

No description provided.

@teharrison teharrison merged commit 319bace into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 3, 2013
  1. fixed wrong api resource name

    Travis Harrison authored
  2. added make target to build api docs

    Travis Harrison authored
This page is out of date. Refresh to see the latest.
View
6 Makefile
@@ -53,7 +53,7 @@ OVERRIDES = \
# if you change all: make sure all: in standard.mk is consistent.
all: installdirs $(TOOL_HDR) lib
-
+
# Use the PACKAGES macro to transform lib, bin, etc., targets
# into package level dependencies, e.g., lib -> PkgA.lib, PkgB.lib
# Rules below then cause PkgA.lib to do a make in PkgaA on lib:
@@ -66,6 +66,8 @@ clean: Makefile purge
purge:
rm -rf $(TARGET) bin/*.r
+api-doc:
+ perl src/WebApplication/scripts/api2html.pl -url http://api.metagenomics.anl.gov -outfile site/CGI/Html/api.cgi
##
# Targets to setup the expected directory structure for the
@@ -93,7 +95,7 @@ $(libdir)/%.installdirs:
$(tmpdir):
- mkdir -p $(tmpdir)
- chmod a+w $(tmpdir)
-
+
$(bindir):
- mkdir -p $(bindir)
View
8 src/MGRAST/lib/resources2/annotations.pm
@@ -16,9 +16,11 @@ sub new {
my $self = $class->SUPER::new(@args);
# Add name / attributes
- $self->{name} = "sequences";
+ $self->{name} = "annotations";
$self->{attributes} = { "id" => [ 'string', 'unique object identifier' ],
- "data" => [ 'hash', 'annotations names pointing to list of md5s' ],
+ "data" => [ 'hash', [ { 'key' => ['string', 'annotation text'],
+ 'value' => ['list', ['string', 'md5sum of hit protein']] },
+ 'annotation to md5s' ]],
"version" => [ 'integer', 'version of the object' ],
"url" => [ 'uri', 'resource location of this object instance' ] };
return $self;
@@ -48,7 +50,7 @@ sub info {
'description' => "Returns a single data object.",
'method' => "GET" ,
'type' => "synchronous" ,
- 'attributes' => $self->attributes,
+ 'attributes' => $self->{attributes},
'parameters' => { 'required' => { "id" => [ "string", "unique metagenome identifier" ] },
'options' => { "type" => [ "cv", [[ "organism", "return organism data" ],
[ "function", "return function data" ],
View
48 src/MGRAST/lib/resources2/m5nr.pm
@@ -18,27 +18,31 @@ sub new {
# Add name / attributes
$self->{name} = "m5nr";
$self->{hierarchy} = { taxonomy => [ ['species', 'taxonomy level'],
- ['genus', 'taxonomy level'],
- ['family', 'taxonomy level'],
- ['order', ' taxonomy level'],
- ['class', ' taxonomy level'],
- ['phylum', 'taxonomy level'],
- ['domain', 'top taxonomy level'] ],
- ontology => [ ['function', 'bottom ontology level'],
+ ['genus', 'taxonomy level'],
+ ['family', 'taxonomy level'],
+ ['order', ' taxonomy level'],
+ ['class', ' taxonomy level'],
+ ['phylum', 'taxonomy level'],
+ ['domain', 'top taxonomy level'] ],
+ ontology => [ ['function', 'bottom ontology level'],
['level3', 'ontology level' ],
['level2', 'ontology level' ],
- ['level1', 'top ontology level'] ]
- };
- $self->{attributes} = { taxonomy => [ 'list', ['list', 'requested taxonomy levels, from highest to lowest'] ],
- ontology => [ 'list', ['list', 'requested ontology levels, from highest to lowest'] ],
- sources => [ 'hash', [['key', ['string', 'source name']],
- ['value', ['object', [ { 'name' => ['string', 'source name'],
- 'description' => ['string', 'description of source'],
- 'type' => ['string', 'type of source'],
- 'link' => ['string', 'link for source id'] },
- 'information about source' ]]]
- ]]
- };
+ ['level1', 'top ontology level'] ]
+ };
+ $self->{attributes} = { taxonomy => { id => [ 'string', 'unique object identifier' ],
+ data => [ 'list', ['list', 'requested taxonomy levels, from highest to lowest'] ],
+ version => [ 'integer', 'version of the object' ],
+ url => [ 'uri', 'resource location of this object instance' ] },
+ ontology => { id => [ 'string', 'unique object identifier' ],
+ data => [ 'list', ['list', 'requested ontology levels, from highest to lowest'] ],
+ version => [ 'integer', 'version of the object' ],
+ url => [ 'uri', 'resource location of this object instance' ] },
+ sources => { id => [ 'string', 'unique object identifier' ],
+ data => [ 'hash', [{'key' => ['string', 'source name'],
+ 'value' => ['object', 'source object']}, 'source object hash'] ],
+ version => [ 'integer', 'version of the object' ],
+ url => [ 'uri', 'resource location of this object instance' ] }
+ };
return $self;
}
@@ -67,7 +71,7 @@ sub info {
'description' => "",
'method' => "GET",
'type' => "synchronous",
- 'attributes' => $self->attributes->{ontology},
+ 'attributes' => $self->{attributes}{ontology},
'parameters' => { 'options' => { 'source' => ['cv', [ ['Subsystems', 'returns 4 level SEED-Subsystems ontology' ],
['COG', 'returns 3 level COG ontology'],
['NOG', 'returns 3 level NOG ontology'],
@@ -84,7 +88,7 @@ sub info {
'description' => "",
'method' => "GET",
'type' => "synchronous",
- 'attributes' => $self->attributes->{taxonomy},
+ 'attributes' => $self->{attributes}{taxonomy},
'parameters' => { 'options' => { 'min_level' => ['cv', $self->{hierarchy}{taxonomy}],
'id_map' => ['boolean', 'if true overrides other options and returns a map { NCBI tax ID: [taxonomy levels] }'],
'min_level' => ['cv', $self->{hierarchy}{taxonomy}],
@@ -98,7 +102,7 @@ sub info {
'description' => "",
'method' => "GET",
'type' => "synchronous",
- 'attributes' => $self->attributes->{sources},
+ 'attributes' => $self->{attributes}{sources},
'parameters' => { 'options' => {},
'required' => {},
'body' => {} }
View
53 src/MGRAST/lib/resources2/metadata.pm
@@ -16,36 +16,29 @@ sub new {
my $self = $class->SUPER::new(@args);
# Add name / attributes
- my %rights = $self->user ? map {$_, 1} @{$self->user->has_right_to(undef, 'view', 'project')} : ();
- my $metadata = [ 'hash', [['key', ['string', 'metadata label']],
- ['value', ['object', [ { 'type' => ['string', 'value type: text, int, float, select, ontology'],
- 'definition' => ['string', 'definition of label'],
- 'required' => ['boolean', 'is a required label'],
- 'mixs' => ['boolean', 'is a MIxS label'],
- 'aliases' => ['list', ['string', 'alternative name for label']]
- }, 'information about metadata keyword' ]]] ]
- ];
- $self->{name} = "metadata";
- $self->{rights} = \%rights;
- $self->{attributes} = { "template" => { "project" => [ 'hash', ['key', ['string', 'project type']],
- ['value', ['object', [$metadata, 'available metadata for this project type']]] ],
- "sample" => [ 'hash', ['key', ['string', 'sample type']],
- ['value', ['object', [$metadata, 'available metadata for this sample type']]] ],
- "library" => [ 'hash', ['key', ['string', 'library type']],
- ['value', ['object', [$metadata, 'available metadata for this library type']]] ],
- "ep" => [ 'hash', ['key', ['string', 'enviromental package type']],
- ['value', ['object', [$metadata, 'available metadata for this ep type']]] ] },
- "cv" => { "ontology" => [ 'hash', ['key', ['string', 'metadata label']],
- ['value', ['int', 'bioportal ontology ID']] ],
- "ont_id" => [ 'hash', ['key', ['string', 'metadata label']],
- ['value', ['int', 'bioportal term ID']] ],
- "select" => [ 'hash', ['key', ['string', 'metadata label']],
- ['value', ['int', 'list of available CV terms']] ] },
- "export" => { "id" => [],
- "name" => [],
- "samples" => [],
- "sampleNum" => [],
- "data" => [] },
+ my %rights = $self->user ? map {$_, 1} @{$self->user->has_right_to(undef, 'view', 'project')} : ();
+ $self->{name} = "metadata";
+ $self->{rights} = \%rights;
+ $self->{attributes} = { "template" => { "project" => [ 'hash', [{'key' => ['string', 'project type'],
+ 'value' => ['hash', 'hash of metadata objects by label']}, 'projects and their metadata'] ],
+ "sample" => [ 'hash', [{'key' => ['string', 'sample type'],
+ 'value' => ['hash', 'hash of metadata objects by label']}, 'samples and their metadata'] ],
+ "library" => [ 'hash', [{'key' => ['string', 'library type'],
+ 'value' => ['hash', 'hash of metadata objects by label']}, 'libraries and their metadata'] ],
+ "ep" => [ 'hash', [{'key' => ['string', 'enviromental package type'],
+ 'value' => ['hash', 'hash of metadata objects by label']}, 'eps and their metadata'] ] },
+ "cv" => { "ontology" => [ 'hash', [{'key' => ['string', 'metadata label'],
+ 'value' => ['int', 'bioportal ontology ID']}, 'ontology IDs for metadata'] ],
+ "ont_id" => [ 'hash', [{'key' => ['string', 'metadata label'],
+ 'value' => ['int', 'bioportal term ID']}, 'term IDs for metadata'] ],
+ "select" => [ 'hash', [{'key' => ['string', 'metadata label'],
+ 'value' => ['list', ['string', 'CV term']]}, 'list of CV terms for metadata'] ] },
+ "export" => { "id" => [ 'string', 'unique object identifier' ],
+ "name" => [ 'string', 'human readable identifier' ],
+ "samples" => [ 'list', [ 'object', 'sample object containing sample metadata, sample libraries, sample envPackage' ] ],
+ "sampleNum" => [ 'int', 'number of samples in project' ],
+ "data" => [ 'hash', [{'key' => ['string', 'metadata label'],
+ 'value' => ['object', 'project metadata objects']}, 'hash of metadata by label'] ] },
"validate_post" => { 'is_valid' => [ 'boolean', 'the inputed value is valid for the given category and label' ],
'metadata' => [ 'object', 'valid metadata object for project and its samples and libraries' ] },
"validate_get" => { 'is_valid' => [ 'boolean', 'the inputed value is valid for the given category and label' ],
View
2  src/MGRAST/lib/resources2/metagenome.pm
@@ -28,7 +28,7 @@ sub new {
"version" => [ 'integer', 'version of the object' ],
"url" => [ 'uri', 'resource location of this object instance' ],
"status" => [ 'cv', [ ['public', 'object is public'],
- ['private', 'object is private'] ] ],
+ ['private', 'object is private'] ] ],
"sequence_type" => [ 'string', 'sequencing type' ]
};
return $self;
View
44 src/MGRAST/lib/resources2/metagenome_statistics.pm
@@ -22,39 +22,17 @@ sub new {
$self->{mgdb} = undef;
$self->{attributes} = {
"id" => [ 'string', 'unique metagenome id' ],
- "length_histogram" => {
- "upload" => [ 'list', 'length distribution of uploaded sequences' ],
- "post_qc" => [ 'list', 'length distribution of post-qc sequences' ]
- },
- "gc_histogram" => {
- "upload" => [ 'list', 'gc % distribution of uploaded sequences' ],
- "post_qc" => [ 'list', 'gc % distribution of post-qc sequences' ]
- },
- "qc" => {
- "kmer" => { "6_mer" => {"columns" => ['list', 'names of columns'], "data" => ['list', 'kmer 6 counts']},
- "15_mer" => {"columns" => ['list', 'names of columns'], "data" => ['list', 'kmer 15 counts']} },
- "drisee" => { "counts" => {"columns" => ['list', 'names of columns'], "data" => ['list', 'drisee count profile']},
- "percents" => {"columns" => ['list', 'names of columns'], "data" => ['list', 'drisee percent profile']},
- "summary" => {"columns" => ['list', 'names of columns'], "data" => ['list', 'drisee summary stats']} },
- "bp_profile" => { "counts" => {"columns" => ['list', 'names of columns'], "data" => ['list', 'nucleotide count profile']},
- "percents" => {"columns" => ['list', 'names of columns'], "data" => ['list', 'nucleotide percent profile']} }
- },
+ "length_histogram" => [ 'hash', [{'key' => ['string', 'pipeline stage'],
+ 'value' => ['list', 'length distribution of sequences in pipeline stage']}, 'length histograms for pipeline stages'] ],
+ "gc_histogram" => [ 'hash', [{'key' => ['string', 'pipeline stage'],
+ 'value' => ['list', 'gc % distribution of sequences in pipeline stage']}, 'gc % histograms for pipeline stages'] ],
+ "qc" => [ 'hash', [{'key' => ['string', 'QC type'],
+ 'value' => ['object', 'QC statistics object']}, 'set of QC statistics'] ],
"sequence_stats" => [ 'hash', 'statistics on sequence files of all pipeline stages' ],
- "taxonomy" => {
- "species" => [ 'list', 'species counts' ],
- "genus" => [ 'list', 'genus counts' ],
- "family" => [ 'list', 'family counts' ],
- "order" => [ 'list', 'order counts' ],
- "class" => [ 'list', 'class counts' ],
- "phylum" => [ 'list', 'phylum counts' ],
- "domain" => [ 'list', 'domain counts' ]
- },
- "ontology" => {
- "COG" => [ 'list', 'COG counts' ],
- "KO" => [ 'list', 'KO counts' ],
- "NOG" => [ 'list', 'NOG counts' ],
- "Subsystems" => [ 'list', 'Subsystem counts' ]
- },
+ "taxonomy" => [ 'hash', [{'key' => ['string', 'taxonomic level'],
+ 'value' => ['list', ['tuple', 'taxanomic name and abundance']]}, 'set of abundaces per taxonomic levels'] ],
+ "ontology" => [ 'hash', [{'key' => ['string', 'ontology source'],
+ 'value' => ['list', ['tuple', 'ontology name and abundance']]}, 'set of abundaces per ontology group'] ],
"source" => [ 'hash', 'evalue and % identity counts per source' ],
"rarefaction" => [ 'list', 'rarefaction coordinate data' ]
};
@@ -84,7 +62,7 @@ sub info {
'description' => "Returns a JSON structure of statistical information.",
'method' => "GET" ,
'type' => "synchronous" ,
- 'attributes' => $self->attributes,
+ 'attributes' => $self->{attributes},
'parameters' => { 'options' => { 'verbosity' => ['cv',
[['minimal','returns only sequence_stats attribute'],
['verbose','returns all but qc attribute'],
View
6 src/MGRAST/lib/resources2/project.pm
@@ -21,8 +21,8 @@ sub new {
$self->{attributes} = { "id" => [ 'string', 'unique object identifier' ],
"name" => [ 'string', 'human readable identifier' ],
"libraries" => [ 'list', [ 'reference library', 'a list of references to the related library objects' ] ],
- "samples" => [ 'list', [ 'reference sample', 'a list of references to the related sample objects' ] ],
- "analyzed" => [ 'list', [ 'reference metagenome', 'a list of references to the related metagenome objects' ] ],
+ "samples" => [ 'list', [ 'reference sample', 'a list of references to the related sample objects' ] ],
+ "analyzed" => [ 'list', [ 'reference metagenome', 'a list of references to the related metagenome objects' ] ],
"description" => [ 'string', 'a short, comprehensive description of the project' ],
"funding_source" => [ 'string', 'the official name of the source of funding of this project' ],
"pi" => [ 'string', 'the first and last name of the principal investigator of the project' ],
@@ -31,7 +31,7 @@ sub new {
"version" => [ 'integer', 'version of the object' ],
"url" => [ 'uri', 'resource location of this object instance' ],
"status" => [ 'cv', [ ['public', 'object is public'],
- ['private', 'object is private'] ] ]
+ ['private', 'object is private'] ] ]
};
return $self;
}
View
4 src/MGRAST/lib/resources2/sequences.pm
@@ -17,7 +17,9 @@ sub new {
# Add name / attributes
$self->{name} = "sequences";
$self->{attributes} = { "id" => [ 'string', 'unique object identifier' ],
- "data" => [ 'hash', 'data type pointing at lists of sequences' ],
+ "data" => [ 'hash', [ { 'key' => ['string', 'annotation or md5 text'],
+ 'value' => ['list', ['tuple', 'read id and read sequence']] },
+ 'data type pointing at lists of sequence info' ]],
"version" => [ 'integer', 'version of the object' ],
"url" => [ 'uri', 'resource location of this object instance' ] };
return $self;
View
2  src/MGRAST/lib/resources2/user.pm
@@ -25,7 +25,7 @@ sub new {
"firstname" => [ 'string', 'first name of user' ],
"lastname" => [ 'string', 'last name of user' ],
"entry_date" => [ 'date', 'date of user creation' ],
- "active" => [ 'boolean', '' ],
+ "active" => [ 'boolean', 'user is active' ],
"comment" => [ 'string', 'any comment about the user account' ],
"url" => [ 'uri', 'resource location of this object instance' ]
};
View
201 src/WebApplication/scripts/api2html.pl
@@ -72,114 +72,105 @@ sub usage {
$html .= "<h1><a name='overview' style='padding-top: 50px;'>".$structure->{service}->{name}." Overview</a></h1><p>".$structure->{service}->{description}."</p><hr>";
+my %param_types = ( body => "<p>This parameter must be passed in the message body.</p>",
+ options => "<p>This is an optional parameter and may be passed in the query string.</p>",
+ required => "<p>This is a required parameter and must be passed as a REST parameter.</p>" );
+
# iterate over the resources
foreach my $res (sort { $a->{name} cmp $b->{name} } @{$structure->{resources}}) {
- $html .= "<h1><a name='".$res->{name}."' style='padding-top: 50px;'>".$res->{name}."</a></h1><h2>Description</h2><p>".$res->{description}."</p>";
- foreach my $req (@{$res->{requests}}) {
- $html .= "<h2>".$req->{name}." - request</h2><h3>Description</h3><p>".$req->{description}."</p><p>This is a ".$req->{type}." ".$req->{method}." request.";
- unless (ref($req->{attributes})) {
- $html .= " This request has no parameters.";
- next;
- }
- $html .= "</p><h3>Parameters</h3><ul>";
- foreach my $param (keys(%{$req->{parameters}->{body}})) {
- my $pm = $req->{parameters}->{body}->{$param};
- $pm->[0] =~ s/cv/controlled vocabulary/;
- $html .= "<li><b>$param</b> (".$pm->[0];
- if (ref($pm->[1]) eq 'ARRAY') {
- if (! ref($pm->[0]) && $pm->[0] eq 'list') {
- $html .= " of ".$pm->[1]->[0].")</li><p>";
- $html .= $pm->[1]->[1]."</p>";
- } else {
- $html .= ")</li><p>";
- $html .= "This parameter value can be chosen from the following (the first being default):</p><ul style='list-style: none;'>";
- foreach my $cvitem (@{$pm->[1]}) {
- $html .= "<li><b>".$cvitem->[0]."</b> - ".$cvitem->[1]."</li>";
- }
- $html .= "</ul><br>";
- }
- } else {
- $html .= ")</p><p>".$pm->[1]."</p>";
- }
- $html .= "<p>This parameter must be passed in the message body.</p>";
- }
- foreach my $param (keys(%{$req->{parameters}->{options}})) {
- my $pm = $req->{parameters}->{options}->{$param};
- $pm->[0] =~ s/cv/controlled vocabulary/;
- $html .= "<li><b>$param</b> (".$pm->[0];
- if (ref($pm->[1]) eq 'ARRAY') {
- if (! ref($pm->[0]) && $pm->[0] eq 'list') {
- $html .= " of ".$pm->[1]->[0].")</li><p>";
- $html .= $pm->[1]->[1]."</p>";
- } else {
- $html .= ")</li><p>";
- $html .= "This parameter value can be chosen from the following (the first being default):</p><ul style='list-style: none;'>";
- foreach my $cvitem (@{$pm->[1]}) {
- $html .= "<li><b>".$cvitem->[0]."</b> - ".$cvitem->[1]."</li>";
- }
- $html .= "</ul><br>";
- }
- } else {
- $html .= ")</li><p>".$pm->[1]."</p>";
- }
- $html .= "<p>This is an optional parameter and may be passed in the query string.</p>";
- }
- foreach my $param (keys(%{$req->{parameters}->{required}})) {
- my $pm = $req->{parameters}->{required}->{$param};
- $pm->[0] =~ s/cv/controlled vocabulary/;
- $html .= "<li><b>$param</b> (".$pm->[0];
- if (ref($pm->[1]) eq 'ARRAY') {
- if (! ref($pm->[0]) && $pm->[0] eq 'list') {
- $html .= " of ".$pm->[1]->[0].")</li><p>";
- $html .= $pm->[1]->[1]."</p>";
- } else {
- $html .= ")</li><p>";
- $html .= "This parameter value can be chosen from the following (the first being default):</p><ul style='list-style: none;'>";
- foreach my $cvitem (@{$pm->[1]}) {
- $html .= "<li><b>".$cvitem->[0]."</b> - ".$cvitem->[1]."</li>";
- }
- $html .= "</ul><br>";
- }
- } else {
- $html .= ")</li><p>".$pm->[1]."</p>";
- }
- $html .= "<p>This is a required parameter and must be passed as a REST parameter.</p>";
- }
- $html .= "</ul>";
- $html .= "<h3>Return Attributes</h3><ul>";
- foreach my $param (keys(%{$req->{attributes}})) {
- my $att = $param;
- my $att_type = $req->{attributes}->{$param}->[0];
- my $att_desc = $req->{attributes}->{$param}->[1];
- my $att_obj;
- while (ref($att_desc) eq 'ARRAY') {
- unless ($att_type =~ /object/) {
- $att_type .= " of ".$att_desc->[0]."s";
- } else {
- $att_obj = $att_desc->[0];
- }
- $att_desc = $att_desc->[1];
- }
- $html .= "<li><b>$att</b> ($att_type)</li><p>";
- if ($att_obj) {
- $html .= "This attribute has an object structure:</p><ul style='list-style: none;'>";
- foreach my $key (keys(%$att_obj)) {
- my $obj_type = $att_obj->{$key}->[0];
- my $obj_att = $att_obj->{$key}->[1];
- while (ref($obj_att) eq 'ARRAY') {
- $obj_type .= " of ".$obj_att->[0]."s";
- $obj_att = $obj_att->[1];
- }
- $html .= "<li><b>$key ($obj_type)</b> - ".$obj_att."</li>";
- }
- $html .= "</ul><br>";
- } else {
- $html .= $att_desc."</p>";
- }
+ print $res->{name}."\n";
+ $html .= "<h1><a name='".$res->{name}."' style='padding-top: 50px;'>".$res->{name}."</a></h1><h2>Description</h2><p>".$res->{description}."</p>";
+ foreach my $req (@{$res->{requests}}) {
+ print "\t".$req->{name}."\n";
+ $html .= "<h2>".$req->{name}." - request</h2><h3>Description</h3><p>".$req->{description}."</p><p>This is a ".$req->{type}." ".$req->{method}." request.";
+ unless (ref($req->{attributes})) {
+ $html .= " This request has no parameters.";
+ next;
+ }
+ $html .= "</p><h3>Parameters</h3><ul>";
+ # iterate over paramaters
+ foreach my $ptype (sort keys %param_types) {
+ foreach my $param (keys(%{$req->{parameters}->{$ptype}})) {
+ my $pm = $req->{parameters}->{$ptype}->{$param};
+ $pm->[0] =~ s/cv/controlled vocabulary/;
+ $html .= "<li><b>$param</b> (".$pm->[0];
+ if (ref($pm->[1]) eq 'ARRAY') {
+ if (! ref($pm->[0]) && $pm->[0] eq 'list') {
+ $html .= " of ".$pm->[1]->[0].")</li><p>";
+ $html .= $pm->[1]->[1]."</p>";
+ } else {
+ $html .= ")</li><p>";
+ $html .= "This parameter value can be chosen from the following (the first being default):</p><ul style='list-style: none;'>";
+ foreach my $cvitem (@{$pm->[1]}) {
+ $html .= "<li><b>".$cvitem->[0]."</b> - ".$cvitem->[1]."</li>";
+ }
+ $html .= "</ul><br>";
+ }
+ } else {
+ $html .= ")</p><p>".$pm->[1]."</p>";
+ }
+ $html .= $param_types{$ptype};
+ }
+ }
+ $html .= "</ul>";
+ $html .= "<h3>Return Attributes</h3><ul>";
+ # iterate over attributes
+ foreach my $param (keys(%{$req->{attributes}})) {
+ my ($att_obj, $att_hash);
+ my $att = $param;
+ my $att_type = $req->{attributes}->{$param}->[0];
+ my $att_desc = $req->{attributes}->{$param}->[1];
+ if ($att_type eq 'cv') {
+ $html .= "<li><b>$att</b> (controlled vocabulary)</li><p>";
+ $html .= "This parameter value can be chosen from the following (the first being default):</p><ul style='list-style: none;'>";
+ foreach my $cvitem (@$att_desc) {
+ $html .= "<li><b>".$cvitem->[0]."</b> - ".$cvitem->[1]."</li>";
+ }
+ $html .= "</ul><br>";
+ } else {
+ while (ref($att_desc) eq 'ARRAY') {
+ if ($att_type =~ /object/) {
+ $att_obj = $att_desc->[0];
+ } elsif (($att_type =~ /hash/) && ref($att_desc) eq 'ARRAY') {
+ $att_hash = $att_desc->[0];
+ } else {
+ $att_type .= " of ".$att_desc->[0]."s";
+ }
+ $att_desc = $att_desc->[1];
+ }
+ $html .= "<li><b>$att</b> ($att_type)</li><p>";
+ if ($att_obj) {
+ $html .= "This attribute has an object structure:</p><ul style='list-style: none;'>";
+ foreach my $key (keys(%$att_obj)) {
+ my $obj_type = $att_obj->{$key}->[0];
+ my $obj_att = $att_obj->{$key}->[1];
+ while (ref($obj_att) eq 'ARRAY') {
+ $obj_type .= " of ".$obj_att->[0]."s";
+ $obj_att = $obj_att->[1];
+ }
+ $html .= "<li><b>$key ($obj_type)</b> - ".$obj_att."</li>";
+ }
+ $html .= "</ul><br>";
+ } elsif ($att_hash) {
+ $html .= "This attribute has a hash structure:</p><ul style='list-style: none;'>";
+ foreach my $key (('key', 'value')) {
+ my $hash_type = $att_hash->{$key}->[0];
+ my $hash_att = $att_hash->{$key}->[1];
+ while (ref($hash_att) eq 'ARRAY') {
+ $hash_type .= " of ".$hash_att->[0]."s";
+ $hash_att = $hash_att->[1];
+ }
+ $html .= "<li><b>$key ($hash_type)</b> - ".$hash_att."</li>";
+ }
+ $html .= "</ul><br>";
+ } else {
+ $html .= $att_desc."</p>"
+ }
+ }
+ }
+ $html .= "</p></ul>";
}
- $html .= "</p></ul>";
- }
- $html .= "<hr>";
+ $html .= "<hr>";
}
$html .= template_end();
Something went wrong with that request. Please try again.