diff --git a/lib/Tuba/Activity.pm b/lib/Tuba/Activity.pm index 409e2212..8914a605 100644 --- a/lib/Tuba/Activity.pm +++ b/lib/Tuba/Activity.pm @@ -40,8 +40,7 @@ sub make_tree_for_show { my $c = shift; my $obj = shift; my $tree = $obj->as_tree(c => $c, - ( $c->param('brief') ? (bonsai => 1) : ()), - ( $c->param('with_gcmd') ? (with_gcmd => 1) : ()) + ( $c->param('brief') ? (bonsai => 1) : ()) ); $tree->{methodologies} = [ map $_->as_tree(c => $c), $obj->methodologies diff --git a/lib/Tuba/Controller.pm b/lib/Tuba/Controller.pm index 8e1a8359..424d9cce 100644 --- a/lib/Tuba/Controller.pm +++ b/lib/Tuba/Controller.pm @@ -210,8 +210,6 @@ sub make_tree_for_show { my $c = shift; my $obj = shift; my %params; - $params{with_gcmd} = 1 unless $c->param('with_gcmd') == 0; - $params{with_regions} = 1 unless $c->param('with_regions' == 0); $params{bonsai} = 1 if $c->param('brief'); my $ret = $obj->as_tree(c => $c, %params); if (my $gcid = $ret->{uri}) { @@ -244,12 +242,13 @@ sub make_tree_for_show { } sub maybe_include_generic_pub_rels { + # these are no longer maybe my $c = shift; my $obj = shift; my $pub = $obj->get_publication or return (); my $tree = {}; - $tree->{gcmd_keywords} = [ map $_->as_tree(@_), $pub->gcmd_keywords ] unless $c->param('with_gcmd') == 0; - $tree->{regions} = [ map $_->as_tree(@_), $pub->regions] if $c->param('with_regions'); + $tree->{gcmd_keywords} = [ map $_->as_tree(@_), $pub->gcmd_keywords ]; + $tree->{regions} = [ map $_->as_tree(@_), $pub->regions]; return %$tree; } diff --git a/lib/Tuba/DB/Object.pm b/lib/Tuba/DB/Object.pm index c2aaaf13..a20d01cd 100644 --- a/lib/Tuba/DB/Object.pm +++ b/lib/Tuba/DB/Object.pm @@ -297,8 +297,8 @@ information : - a list of parent publications - a list of files - - a list of gcmd keywords (iff with_gcmd is sent) - - a list of regions (iff with_regions is sent) + - a list of gcmd keywords + - a list of regions - a list of contributors (if this is a publication) - a list of publications for each contributor record (if this is a contributor) @@ -315,8 +315,6 @@ sub as_tree { my %a = @_; my $c = $a{c}; # controller object my $bonsai = delete $a{bonsai}; # a small tree - my $with_gcmd = delete $a{with_gcmd}; # a large tree - my $with_regions = delete $a{with_regions}; # a large tree $a{deflate} = 0 unless exists($a{deflate}); my $tree = $s->Rose::DB::Object::Helpers::as_tree(%a); @@ -336,8 +334,8 @@ sub as_tree { }; } $tree->{files} = [ map $_->as_tree(@_), $pub->files ]; - $tree->{gcmd_keywords} = [ map $_->as_tree(@_), $pub->gcmd_keywords ] if $with_gcmd; - $tree->{regions} = [ map $_->as_tree(@_), $pub->regions] if $with_regions; + $tree->{gcmd_keywords} = [ map $_->as_tree(@_), $pub->gcmd_keywords ]; + $tree->{regions} = [ map $_->as_tree(@_), $pub->regions]; } my $uri = $s->uri($c); my $href = $uri->clone->to_abs; diff --git a/lib/Tuba/DocManager.pm b/lib/Tuba/DocManager.pm index 3a59725e..8716fa4b 100644 --- a/lib/Tuba/DocManager.pm +++ b/lib/Tuba/DocManager.pm @@ -149,8 +149,8 @@ our %RouteDoc = ( list_scenario => { tags => [qw/model/], _list_defaults('scenario') }, list_lexicon => { tags => [qw/lexicon/], _list_defaults('lexicon') }, - show_report => { tags => [qw/report/], _show_defaults('report', withs => 1) }, - show_chapter => {tags => [qw/report/], _show_defaults('chapter', withs => 1) }, + show_report => { tags => [qw/report/], _show_defaults('report') }, + show_chapter => {tags => [qw/report/], _show_defaults('chapter') }, show_platform => {tags => [qw/obs/], _show_defaults('platform') }, show_instrument => {tags => [qw/obs/], _show_defaults('instrument') }, show_instrument_instance => {tags => [qw/obs/], _show_defaults('instrument', add => 'on a platform' ) }, @@ -161,20 +161,20 @@ our %RouteDoc = ( model_run_lookup => {tags => [qw/model/], _show_defaults('model run') }, show_scenario => {tags => [qw/model/], _show_defaults('scenario') }, - show_figure => { tags => [qw/figure/], _show_defaults('figure', withs => 1, add => "in a chapter") }, - show_finding => { tags => [qw/finding/], _show_defaults('finding', withs => 1, add => "in a chapter") }, - show_table => { tags => [qw/table/], _show_defaults('table', withs => 1, add => "in a chapter") }, + show_figure => { tags => [qw/figure/], _show_defaults('figure', add => "in a chapter") }, + show_finding => { tags => [qw/finding/], _show_defaults('finding', add => "in a chapter") }, + show_table => { tags => [qw/table/], _show_defaults('table', add => "in a chapter") }, - show_report_figure => { tags => [qw/report figure/], _show_defaults('figure', withs => 1) }, - show_report_finding => {tags => [qw/report finding/], _show_defaults('finding', withs => 1) }, - show_report_table => {tags => [qw/report table/], _show_defaults('table', withs => 1) }, + show_report_figure => { tags => [qw/report figure/], _show_defaults('figure') }, + show_report_finding => {tags => [qw/report finding/], _show_defaults('finding') }, + show_report_table => {tags => [qw/report table/], _show_defaults('table') }, - show_article => { tags => [qw/publication/], _show_defaults('article', withs => 1) }, + show_article => { tags => [qw/publication/], _show_defaults('article') }, show_journal => {tags => [qw/publication/], _show_defaults('journal') }, - show_image => {tags => [qw/figure/], _show_defaults('image', withs => 1) }, - show_array => {tags => [qw/table/], _show_defaults('array', withs => 1) }, - show_webpage => {tags => [qw/publication/], _show_defaults('web page', withs => 1) }, - show_book => {tags => [qw/publication/], _show_defaults('book', withs => 1) }, + show_image => {tags => [qw/figure/], _show_defaults('image') }, + show_array => {tags => [qw/table/], _show_defaults('array') }, + show_webpage => {tags => [qw/publication/], _show_defaults('web page') }, + show_book => {tags => [qw/publication/], _show_defaults('book') }, show_activity => {tags => [qw/dataset/], _show_defaults('activity') }, show_person => { tags => [qw/contributor/], _show_defaults('person') }, show_organization => { tags => [qw/contributor/], _show_defaults('organization') }, @@ -315,15 +315,8 @@ sub _show_defaults { 'application/json', 'application/x-turtle', 'text/turtle', 'application/n-triples', 'text/n3', 'text/rdf+n3', 'application/ld+json', 'application/rdf+xml', 'application/rdf+json', - ], - $a{withs} ? - ( - params => [ - { name => "with_regions", type => "boolean", description => "Include regions associated with the $what." }, - { name => "with_gcmd", type => "boolean", description => "Include GCMD keywords associated with the $what." }, - ] - ) : () - ) + ] + ) } sub _route_to_path { diff --git a/lib/Tuba/Report.pm b/lib/Tuba/Report.pm index 341cbd26..77fed38a 100644 --- a/lib/Tuba/Report.pm +++ b/lib/Tuba/Report.pm @@ -356,7 +356,7 @@ sub make_tree_for_show { my $format = $c->stash('format'); $href .= ".$format" if $format; my %regions; - if ($pub && $c->param('with_regions')) { + if ($pub) { $regions{regions} = [ map $_->as_tree(c => $c), $pub->regions]; } my @parents; diff --git a/t/006_figure.t b/t/006_figure.t index 160ddc46..bc1d0f56 100644 --- a/t/006_figure.t +++ b/t/006_figure.t @@ -152,7 +152,7 @@ $t->post_ok( "/report/vegetables/chapter/carrots/figure/keywords/orange" => { Accept => "application/json" } => json => {identifier => "001f18d3-7e61-430b-9883-1960c6256fe5"})->status_is(200); -$t->get_ok( "/report/vegetables/chapter/carrots/figure/orange.json?with_gcmd=1") +$t->get_ok( "/report/vegetables/chapter/carrots/figure/orange.json") ->json_is( "/gcmd_keywords/0/identifier", "001f18d3-7e61-430b-9883-1960c6256fe5" ); # Create a region. @@ -170,7 +170,7 @@ $t->post_ok( "/report/vegetables/chapter/carrots/figure/regions/orange" => { Accept => "application/json" } => json => {identifier => "bermuda_triangle"})->status_is(200); -$t->get_ok( "/report/vegetables/chapter/carrots/figure/orange.json?with_regions=1") +$t->get_ok( "/report/vegetables/chapter/carrots/figure/orange.json") ->json_is( "/regions/0/identifier", "bermuda_triangle" ); $t->post_ok("/report/vegetables/chapter/carrots/figure/rel/orange" => { Accept => "application/json" } => json => diff --git a/t/010_stringify.t b/t/010_stringify.t index d0f69014..486cfb25 100644 --- a/t/010_stringify.t +++ b/t/010_stringify.t @@ -39,6 +39,7 @@ $t->get_ok("/report/test-report.json")->json_is( href => "${base}report/test-report.json", report_type_identifier => 'report', report_tables => [], + regions => [], report_figures => [], report_findings => [], parents => [], diff --git a/t/014_array.t b/t/014_array.t index 397ac6ef..1ec797ca 100644 --- a/t/014_array.t +++ b/t/014_array.t @@ -60,11 +60,13 @@ $t->get_ok("/report/vegetables/table/veggietable.json")->status_is(200) 'chapter_identifier' => undef, 'contributors' => [], 'files' => [], + 'gcmd_keywords' => [], 'href' => "$base/report/vegetables/table/veggietable.json", 'identifier' => 'veggietable', 'ordinal' => '1-b', 'parents' => [], 'references' => [], + 'regions' => [], 'cited_by' => [], 'report_identifier' => 'vegetables', 'title' => 'veggie table',