1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
use strict;
use warnings;
use Test::More;
use Catmandu::Exporter::RDF;
my $turtle;
my $exporter = Catmandu::Exporter::RDF->new(file => \$turtle, type => 'ttl');
my @arefs = (
{
"http://x.org/alice" => { "foaf_knows" => "<http://x.org/bob>" },
"http://x.org/bob" => { "a" => "foaf_Person", }
},
{
"http://x.org/alice" => { "foaf_knows" => "<http://x.org/claire>" },
}
);
$exporter->add($_) for @arefs;
$exporter->commit;
$turtle =~ s/ \./ ;/smg;
is_deeply [ sort split "\n", $turtle ], [
'<http://x.org/alice> <http://xmlns.com/foaf/0.1/knows> <http://x.org/bob>, <http://x.org/claire> ;',
'<http://x.org/bob> a <http://xmlns.com/foaf/0.1/Person> ;'
];
print $turtle;
done_testing;
|