Attean/Triple.pm

filter: Statementstmt 93.7% 45 / 48 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.9% 10 / 11 Podpod 0.0% 0 / 2 totaltotal 90.4% 57 / 63 CC 2 SCAR 2.2
CC
2
Cov
94%
ntriples_string
2.0
__ANON__
2.0
BEGIN
1.0
CRAP 1.2
« AtteanX/Serializer/NTuples.pm ↑ Summary AtteanX/Parser/Turtle/Constants.pm »
1 50 ▶use v5.14;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 50 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 =head1 NAME
5  
6 Attean::Triple - RDF Triples
7  
8 =head1 VERSION
9  
10 This document describes Attean::Triple version 0.040
11  
12 =head1 SYNOPSIS
13  
14 use v5.14;
15 use Attean;
16 my $triple = Attean::Triple->new( $s, $p, $o );
17  
18 =head1 DESCRIPTION
19  
20 The Attean::Triple class represents an RDF triple.
21 It conforms to the L<Attean::API::Triple|Attean::API::Binding> role.
22  
23 =head1 ROLES
24  
25 This role consumes L<Attean::API::Triple>.
26  
27 =head1 METHODS
28  
29 =over 4
30  
31 =item C<< subject >>
32  
33 =item C<< predicate >>
34  
35 =item C<< object >>
36  
37 =back
38  
39 =cut
40  
41 50 package Attean::TriplePattern 0.040 {
42 50 ▶ use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
43 50 ▶ use Scalar::Util qw(blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
44 50 ▶ use Attean::RDF;
Subroutine BEGIN: called CC=1 SCAR=0.0
45 50 ▶ use Attean::API::Binding;
Subroutine BEGIN: called CC=1 SCAR=0.0
46
47 50 has 'subject' => (is => 'ro', required => 1);
48 50 has 'predicate' => (is => 'ro', required => 1);
49 50 has 'object' => (is => 'ro', required => 1);
50
51 50 with 'Attean::API::TriplePattern';
52
53 1 ▶ sub as_quadpattern {
Subroutine as_quadpattern: called CC=1 SCAR=0.0
Pod undocumented
54 1 my $self = shift;
55 1 my $graph = shift;
56 # TODO: deprecate this in favor of as_quad_pattern() provided by Attean::API::TriplePattern
57 1 return $self->as_quad_pattern($graph);
58 }
59
60 0 ▶ sub ntriples_string {
Subroutine ntriples_string: not called CC=1 SCAR=6.9
Pod undocumented
61 0 my $self = shift;
62 0 return join(' ', '<<(', (map { $self->$_()->ntriples_string() } qw(subject predicate object)), ')>>');
63 }
64 }
65  
66 50 package Attean::Triple 0.040 {
67 50 ▶ use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
68 50 ▶ use Attean::API::Binding;
Subroutine BEGIN: called CC=1 SCAR=0.0
69
70 50 has 'subject' => (is => 'ro', does => 'Attean::API::BlankOrIRI', required => 1);
71 50 has 'predicate' => (is => 'ro', does => 'Attean::API::IRI', required => 1);
72 50 has 'object' => (is => 'ro', does => 'Attean::API::Term', required => 1);
73
74 50 with 'Attean::API::Triple';
75
76 438 ▶ around BUILDARGS => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
77 438 my $orig = shift;
78 438 my $class = shift;
79 438 ▶ if (scalar(@_) == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @_ == 3) 415 23 438
80 415 my %args;
81 415 @args{ $class->variables } = @_;
82 415 return $class->$orig(%args);
83 }
84 23 return $class->$orig(@_);
85 50 };
86 }
87  
88  
89 50 1;
90  
91 __END__
« AtteanX/Serializer/NTuples.pm ↑ Summary AtteanX/Parser/Turtle/Constants.pm »