RDF-aREF

 view release on metacpan or  search on metacpan

t/aref-query.t  view on Meta::CPAN

use Test::More;
use RDF::aREF qw(aref_query aref_query_map);
use RDF::aREF::Query;
use Scalar::Util qw(reftype);

BEGIN {
    eval { require JSON; 1; } 
    or plan skip_all => "test requires JSON";
}

my $rdf = JSON::from_json(do { local (@ARGV, $/) = "t/doi-example.json"; <> });
my $uri = "http://dx.doi.org/10.2474/trol.7.147";

my @res = aref_query($rdf, $uri, '.');
is reftype $res[0], 'HASH';

# FIXME:
# is_deeply [ aref_query($rdf, $uri, '@') ], [ ], 'empty query (@)';
is_deeply [ aref_query($rdf, $uri, '') ], [ $uri ], 'empty query';

is_deeply [ aref_query($rdf, $uri, 'dct_title') ], 

t/suite.t  view on Meta::CPAN

        require RDF::Trine::Model; 
        require RDF::Trine::Serializer::NTriples::Canonical;
        require JSON;
        1; 
    } or do {
        plan skip_all => "RDF::Trine or JSON required";
    };
}

sub slurp { 
    local (@ARGV, $/) = @_; 
    my $data = -e $ARGV[0] ? <> : "";
    $data =~ s/\n$//;
    $data;
}

use RDF::aREF qw(decode_aref);
use RDF::aREF::Decoder;

sub trine_statement { # TODO: remove/modify this method
    RDF::aREF::Decoder::trine_statement(@_);



( run in 0.609 second using v1.01-cache-2.11-cpan-49f99fa48dc )