"Fossies" - the Fresh Open Source Software Archive

Member "eprints3.4-3.4.4/tests/32_triples.pl" (7 Aug 2022, 1860 Bytes) of package /linux/www/eprints3.4-3.4.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "32_triples.pl": 3.4-3.4.3_vs_3.4-3.4.4.

    1 #!/usr/bin/perl
    2 
    3 use Test::More;
    4 
    5 use strict;
    6 use warnings;
    7 
    8 use EPrints;
    9 use EPrints::Test;
   10 use EPrints::Test::RepositoryLog;
   11 
   12 my $repoid = EPrints::Test::get_test_id();
   13 
   14 my $ep = EPrints->new();
   15 if( !defined $ep ) { BAIL_OUT( "Could not obtain the EPrints System object" ); }
   16 
   17 my $repo = $ep->repository( $repoid );
   18 if( !defined $repo ) { BAIL_OUT( "Could not obtain the Repository object" ); }
   19 
   20 my $dataset = $repo->dataset( "triple" );
   21 if( !defined $dataset ) { BAIL_OUT( "Could not obtain the triple dataset" ); }
   22 
   23 plan tests => 4;
   24 
   25 {
   26     my $graph = EPrints::RDFGraph->new( repository=>$repo );
   27     ok( defined $graph, "Created a graph" );
   28 
   29     ok( $graph->count == 0, "Empty graph has zero size" );
   30 
   31     $graph->add( 
   32         subject => '<aaa>', 
   33         predicate => '<bbb>',
   34         object => "<ccc>" );
   35 
   36     ok( $graph->count == 1, "Graph has size of 1 after adding an item." );
   37 
   38     my $plugin = $repo->plugin( "Export::RDFNT" );
   39     my $nt = $plugin->output_graph( $graph );
   40 
   41     ok( $nt eq "<aaa> <bbb> <ccc> .\n", "Output graph" );
   42 }
   43 
   44 # done
   45 
   46 =head1 COPYRIGHT
   47 
   48 =for COPYRIGHT BEGIN
   49 
   50 Copyright 2022 University of Southampton.
   51 EPrints 3.4 is supplied by EPrints Services.
   52 
   53 http://www.eprints.org/eprints-3.4/
   54 
   55 =for COPYRIGHT END
   56 
   57 =for LICENSE BEGIN
   58 
   59 This file is part of EPrints 3.4 L<http://www.eprints.org/>.
   60 
   61 EPrints 3.4 and this file are released under the terms of the
   62 GNU Lesser General Public License version 3 as published by
   63 the Free Software Foundation unless otherwise stated.
   64 
   65 EPrints 3.4 is distributed in the hope that it will be useful,
   66 but WITHOUT ANY WARRANTY; without even the implied warranty of
   67 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   68 See the GNU Lesser General Public License for more details.
   69 
   70 You should have received a copy of the GNU Lesser General Public
   71 License along with EPrints 3.4.
   72 If not, see L<http://www.gnu.org/licenses/>.
   73 
   74 =for LICENSE END
   75