| 1 | # RDF::Query::Algebra::TimeGraph | ||||||||||||
| 2 | # ----------------------------------------------------------------------------- | ||||||||||||
| 3 | |||||||||||||
| 4 | =head1 NAME | ||||||||||||
| 5 | |||||||||||||
| 6 | RDF::Query::Algebra::TimeGraph - Algebra class for temporal patterns | ||||||||||||
| 7 | |||||||||||||
| 8 | =head1 VERSION | ||||||||||||
| 9 | |||||||||||||
| 10 | This document describes RDF::Query::Algebra::TimeGraph version 2.919. | ||||||||||||
| 11 | |||||||||||||
| 12 | =cut | ||||||||||||
| 13 | |||||||||||||
| 14 | package RDF::Query::Algebra::TimeGraph; | ||||||||||||
| 15 | |||||||||||||
| 16 | 36 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 17 | 36 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 18 | 36 | ▶ | no warnings 'redefine'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 19 | 36 | ▶ | use base qw(RDF::Query::Algebra); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 20 | |||||||||||||
| 21 | 36 | ▶ | use Data::Dumper; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 22 | 36 | ▶ | use Carp qw(carp croak confess); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 23 | |||||||||||||
| 24 | ###################################################################### | ||||||||||||
| 25 | |||||||||||||
| 26 | 36 | our ($VERSION); | |||||||||||
| 27 | 36 | ▶ | BEGIN { | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 28 | 36 | $VERSION = '2.919'; | |||||||||||
| 29 | } | ||||||||||||
| 30 | |||||||||||||
| 31 | ###################################################################### | ||||||||||||
| 32 | |||||||||||||
| 33 | =head1 METHODS | ||||||||||||
| 34 | |||||||||||||
| 35 | Beyond the methods documented below, this class inherits methods from the | ||||||||||||
| 36 | L<RDF::Query::Algebra> class. | ||||||||||||
| 37 | |||||||||||||
| 38 | =over 4 | ||||||||||||
| 39 | |||||||||||||
| 40 | =cut | ||||||||||||
| 41 | |||||||||||||
| 42 | =item C<new ( $interval, $pattern, $time_triples )> | ||||||||||||
| 43 | |||||||||||||
| 44 | Returns a new TimeGraph structure. | ||||||||||||
| 45 | |||||||||||||
| 46 | =cut | ||||||||||||
| 47 | |||||||||||||
| 48 | 0 | ▶ | sub new { | ||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 49 | 0 | my $class = shift; | |||||||||||
| 50 | 0 | my @data = @_; # $interval, $pattern, $triples | |||||||||||
| 51 | 0 | return bless( [ 'TIME', @data ], $class ); | |||||||||||
| 52 | } | ||||||||||||
| 53 | |||||||||||||
| 54 | =item C<< construct_args >> | ||||||||||||
| 55 | |||||||||||||
| 56 | Returns a list of arguments that, passed to this class' constructor, | ||||||||||||
| 57 | will produce a clone of this algebra pattern. | ||||||||||||
| 58 | |||||||||||||
| 59 | =cut | ||||||||||||
| 60 | |||||||||||||
| 61 | 0 | ▶ | sub construct_args { | ||||||||||
|
Subroutine
construct_args: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 62 | 0 | my $self = shift; | |||||||||||
| 63 | 0 | return ($self->interval, $self->pattern, $self->time_triples); | |||||||||||
| 64 | } | ||||||||||||
| 65 | |||||||||||||
| 66 | =item C<< interval >> | ||||||||||||
| 67 | |||||||||||||
| 68 | Returns the time interval node of the temporal graph expression. | ||||||||||||
| 69 | |||||||||||||
| 70 | =cut | ||||||||||||
| 71 | |||||||||||||
| 72 | 0 | ▶ | sub interval { | ||||||||||
|
Subroutine
interval: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 73 | 0 | my $self = shift; | |||||||||||
| 74 | 0 | ▶ | if (@_) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 75 | 0 | my $interval = shift; | |||||||||||
| 76 | 0 | $self->[1] = $interval; | |||||||||||
| 77 | } | ||||||||||||
| 78 | 0 | return $self->[1]; | |||||||||||
| 79 | } | ||||||||||||
| 80 | |||||||||||||
| 81 | =item C<< pattern >> | ||||||||||||
| 82 | |||||||||||||
| 83 | Returns the graph pattern of the temporal graph expression. | ||||||||||||
| 84 | |||||||||||||
| 85 | =cut | ||||||||||||
| 86 | |||||||||||||
| 87 | 0 | ▶ | sub pattern { | ||||||||||
|
Subroutine
pattern: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 88 | 0 | my $self = shift; | |||||||||||
| 89 | 0 | return $self->[2]; | |||||||||||
| 90 | } | ||||||||||||
| 91 | |||||||||||||
| 92 | =item C<< time_triples >> | ||||||||||||
| 93 | |||||||||||||
| 94 | Returns the triples describing the time interval of the temporal graph. | ||||||||||||
| 95 | |||||||||||||
| 96 | =cut | ||||||||||||
| 97 | |||||||||||||
| 98 | 0 | ▶ | sub time_triples { | ||||||||||
|
Subroutine
time_triples: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 99 | 0 | my $self = shift; | |||||||||||
| 100 | 0 | return $self->[3]; | |||||||||||
| 101 | } | ||||||||||||
| 102 | |||||||||||||
| 103 | =item C<< sse >> | ||||||||||||
| 104 | |||||||||||||
| 105 | Returns the SSE string for this algebra expression. | ||||||||||||
| 106 | |||||||||||||
| 107 | =cut | ||||||||||||
| 108 | |||||||||||||
| 109 | 0 | ▶ | sub sse { | ||||||||||
|
Subroutine
sse: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 110 | 0 | my $self = shift; | |||||||||||
| 111 | 0 | my $context = shift; | |||||||||||
| 112 | 0 | ▶ | my $prefix = shift || ''; | ||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||
| 113 | 0 | my $indent = $context->{indent}; | |||||||||||
| 114 | |||||||||||||
| 115 | 0 | return sprintf( | |||||||||||
| 116 | '(time\n${prefix}${indent}%s\n${prefix}${indent}%s\n${prefix}${indent}%s)', | ||||||||||||
| 117 | $self->interval->sse( $context, "${prefix}${indent}" ), | ||||||||||||
| 118 | $self->pattern->sse( $context, "${prefix}${indent}" ), | ||||||||||||
| 119 | $self->time_triples->sse( $context, "${prefix}${indent}" ), | ||||||||||||
| 120 | ); | ||||||||||||
| 121 | } | ||||||||||||
| 122 | |||||||||||||
| 123 | =item C<< as_sparql >> | ||||||||||||
| 124 | |||||||||||||
| 125 | Returns the SPARQL string for this algebra expression. | ||||||||||||
| 126 | |||||||||||||
| 127 | =cut | ||||||||||||
| 128 | |||||||||||||
| 129 | 0 | ▶ | sub as_sparql { | ||||||||||
|
Subroutine
as_sparql: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 130 | 0 | my $self = shift; | |||||||||||
| 131 | 0 | my $context = shift; | |||||||||||
| 132 | 0 | my $indent = shift; | |||||||||||
| 133 | 0 | my $nindent = $indent . "\t"; | |||||||||||
| 134 | 0 | my $string = sprintf( | |||||||||||
| 135 | "TIME %s %s", | ||||||||||||
| 136 | $self->interval->as_sparql( $context, $indent ), | ||||||||||||
| 137 | $self->pattern->as_sparql( $context, $indent ), | ||||||||||||
| 138 | ); | ||||||||||||
| 139 | 0 | return $string; | |||||||||||
| 140 | } | ||||||||||||
| 141 | |||||||||||||
| 142 | =item C<< type >> | ||||||||||||
| 143 | |||||||||||||
| 144 | Returns the type of this algebra expression. | ||||||||||||
| 145 | |||||||||||||
| 146 | =cut | ||||||||||||
| 147 | |||||||||||||
| 148 | 0 | ▶ | sub type { | ||||||||||
|
Subroutine
type: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 149 | 0 | return 'TIME'; | |||||||||||
| 150 | } | ||||||||||||
| 151 | |||||||||||||
| 152 | =item C<< referenced_variables >> | ||||||||||||
| 153 | |||||||||||||
| 154 | Returns a list of the variable names used in this algebra expression. | ||||||||||||
| 155 | |||||||||||||
| 156 | =cut | ||||||||||||
| 157 | |||||||||||||
| 158 | 0 | ▶ | sub referenced_variables { | ||||||||||
|
Subroutine
referenced_variables: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 159 | 0 | my $self = shift; | |||||||||||
| 160 | return RDF::Query::_uniq( | ||||||||||||
| 161 | 0 | map { $_->name } grep { $_->isa('RDF::Query::Node::Variable') } ($self->graph), | |||||||||||
| 162 | $self->pattern->referenced_variables, | ||||||||||||
| 163 | $self->time_triples->referenced_variables, | ||||||||||||
| 164 | ); | ||||||||||||
| 165 | } | ||||||||||||
| 166 | |||||||||||||
| 167 | =item C<< potentially_bound >> | ||||||||||||
| 168 | |||||||||||||
| 169 | Returns a list of the variable names used in this algebra expression that will | ||||||||||||
| 170 | bind values during execution. | ||||||||||||
| 171 | |||||||||||||
| 172 | =cut | ||||||||||||
| 173 | |||||||||||||
| 174 | 0 | ▶ | sub potentially_bound { | ||||||||||
|
Subroutine
potentially_bound: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 175 | 0 | my $self = shift; | |||||||||||
| 176 | return RDF::Query::_uniq( | ||||||||||||
| 177 | 0 | map { $_->name } grep { $_->isa('RDF::Query::Node::Variable') } ($self->graph), | |||||||||||
| 178 | $self->pattern->potentially_bound, | ||||||||||||
| 179 | $self->time_triples->potentially_bound, | ||||||||||||
| 180 | ); | ||||||||||||
| 181 | } | ||||||||||||
| 182 | |||||||||||||
| 183 | =item C<< definite_variables >> | ||||||||||||
| 184 | |||||||||||||
| 185 | Returns a list of the variable names that will be bound after evaluating this algebra expression. | ||||||||||||
| 186 | |||||||||||||
| 187 | =cut | ||||||||||||
| 188 | |||||||||||||
| 189 | 0 | ▶ | sub definite_variables { | ||||||||||
|
Subroutine
definite_variables: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 190 | 0 | my $self = shift; | |||||||||||
| 191 | return RDF::Query::_uniq( | ||||||||||||
| 192 | 0 | map { $_->name } grep { $_->isa('RDF::Query::Node::Variable') } ($self->graph), | |||||||||||
| 193 | $self->pattern->definite_variables, | ||||||||||||
| 194 | $self->time_triples->definite_variables, | ||||||||||||
| 195 | ); | ||||||||||||
| 196 | } | ||||||||||||
| 197 | |||||||||||||
| 198 | 36 | 1; | |||||||||||
| 199 | |||||||||||||
| 200 | __END__ | ||||||||||||