| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  |  | 
| 2 |  |  |  |  |  |  | use v5.14; | 
| 3 | 1 |  |  | 1 |  | 554 | use warnings; | 
|  | 1 |  |  |  |  | 4 |  | 
| 4 | 1 |  |  | 1 |  | 6 | use Test::Roo::Role; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 23 |  | 
| 5 | 1 |  |  | 1 |  | 347 | use Test::Moose; | 
|  | 1 |  |  |  |  | 422 |  | 
|  | 1 |  |  |  |  | 4 |  | 
| 6 | 1 |  |  | 1 |  | 1336 | use Attean; | 
|  | 1 |  |  |  |  | 93094 |  | 
|  | 1 |  |  |  |  | 4 |  | 
| 7 | 1 |  |  | 1 |  | 465 | use Attean::RDF; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 9 |  | 
| 8 | 1 |  |  | 1 |  | 5 |  | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 12 |  | 
| 9 |  |  |  |  |  |  | requires 'create_store';	   # create_store( triples => \@triples ) | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  | 6 | 0 |  | test 'get_triples' => sub { | 
| 12 |  |  |  |  |  |  | my $self	= shift; | 
| 13 |  |  |  |  |  |  | my $t1		= triple(iri('http://example.org/s'), iri('http://example.org/p'), iri('http://example.org/o')); | 
| 14 |  |  |  |  |  |  | my $t2		= triple(iri('http://example.org/x'), iri('http://example.org/y'), iri('http://example.org/z')); | 
| 15 |  |  |  |  |  |  | my @triples = ($t1, $t2); | 
| 16 |  |  |  |  |  |  | my $store	= $self->create_store(triples => \@triples); | 
| 17 |  |  |  |  |  |  | ok $store->does('Attean::API::Store'); | 
| 18 |  |  |  |  |  |  | ok $store->does('Attean::API::TripleStore'); | 
| 19 |  |  |  |  |  |  | $self->cleanup_store($store); | 
| 20 |  |  |  |  |  |  | }; | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | test 'count_triples' => sub { | 
| 23 |  |  |  |  |  |  | my $self	= shift; | 
| 24 |  |  |  |  |  |  | my @triples; | 
| 25 |  |  |  |  |  |  | foreach (1 .. 20) { | 
| 26 |  |  |  |  |  |  | push(@triples, triple(iri('http://example.org/s'), iri('http://example.org/p'), literal($_))); | 
| 27 |  |  |  |  |  |  | } | 
| 28 |  |  |  |  |  |  | foreach (1,10,20,50) { | 
| 29 |  |  |  |  |  |  | push(@triples, triple(iri('http://example.org/z'), iri('http://example.org/p'), literal($_))); | 
| 30 |  |  |  |  |  |  | } | 
| 31 |  |  |  |  |  |  | foreach (1 .. 20) { | 
| 32 |  |  |  |  |  |  | push(@triples, triple(iri('http://example.org/s'), iri('http://example.org/q'), blank("b$_"))); | 
| 33 |  |  |  |  |  |  | } | 
| 34 |  |  |  |  |  |  | my $store	= $self->create_store(triples => \@triples); | 
| 35 |  |  |  |  |  |  | is($store->count_triples(iri('http://example.org/UNEXPECTED')), 0, 'unexpected IRI'); | 
| 36 |  |  |  |  |  |  | is($store->count_triples(iri('http://example.org/s')), 40, 'expected subject'); | 
| 37 |  |  |  |  |  |  | is($store->count_triples(undef, iri('http://example.org/q')), 20, 'expected predicate'); | 
| 38 |  |  |  |  |  |  | is($store->count_triples(undef, undef, literal('7')), 1, 'expected object'); | 
| 39 |  |  |  |  |  |  | is($store->count_triples(undef, undef, literal('10')), 2, 'expected object (2)'); | 
| 40 |  |  |  |  |  |  | is($store->count_triples(iri('http://example.org/z'), undef, literal('10')), 1, 'expected subject/object'); | 
| 41 |  |  |  |  |  |  | is($store->count_triples(variable('s'), iri('http://example.org/q')), 20, 'expected predicate with variable'); | 
| 42 |  |  |  |  |  |  | is($store->count_triples(variable('s'), variable('p'), literal('7')), 1, 'expected object with variable'); | 
| 43 |  |  |  |  |  |  | is($store->count_triples(variable('s'), variable('p'), literal('10')), 2, 'expected object (2) with variable'); | 
| 44 |  |  |  |  |  |  | is($store->count_triples(iri('http://example.org/z'), variable('o'), literal('10')), 1, 'expected subject/object with variable'); | 
| 45 |  |  |  |  |  |  | cmp_ok($store->count_triples_estimate(iri('http://example.org/z')), '>=', 0, 'count_triples_estimate'); | 
| 46 |  |  |  |  |  |  | $self->cleanup_store($store); | 
| 47 |  |  |  |  |  |  | }; | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | # test 'count_triples_estimate' => sub {}; | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | test 'size' => sub { | 
| 53 |  |  |  |  |  |  | my $self	= shift; | 
| 54 |  |  |  |  |  |  | foreach my $size (1, 10, 25, 57) { | 
| 55 |  |  |  |  |  |  | my @triples; | 
| 56 |  |  |  |  |  |  | foreach (1 .. $size) { | 
| 57 |  |  |  |  |  |  | push(@triples, triple(iri('http://example.org/s'), iri('http://example.org/p'), literal($_))); | 
| 58 |  |  |  |  |  |  | } | 
| 59 |  |  |  |  |  |  | my $store	= $self->create_store(triples => \@triples); | 
| 60 |  |  |  |  |  |  | is($store->size(), $size); | 
| 61 |  |  |  |  |  |  | $self->cleanup_store($store); | 
| 62 |  |  |  |  |  |  | } | 
| 63 |  |  |  |  |  |  | }; | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | 1; |