Skip to content

Commit

Permalink
Added Attean::API::QuadPattern->as_triple_pattern method.
Browse files Browse the repository at this point in the history
  • Loading branch information
kasei committed Feb 12, 2016
1 parent 3d6dab7 commit df091c2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/Attean/API/Binding.pm
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,9 @@ package Attean::API::Triple 0.012 {

package Attean::API::QuadPattern 0.012 {
use Scalar::Util qw(blessed);
use List::MoreUtils qw(zip);
use Moo::Role;
use namespace::clean;

sub variables { return qw(subject predicate object graph) }
sub value {
Expand All @@ -379,6 +381,14 @@ package Attean::API::QuadPattern 0.012 {
return $self->apply_statement(@_);
}

sub as_triple_pattern {
my $self = shift;
my @keys = Attean::API::Triple->variables;
my @values = $self->values;
@values = @values[0 .. scalar(@keys)-1];
return Attean::TriplePattern->new(zip @keys, @values);
}

sub sparql_tokens {
my $self = shift;
my @tokens;
Expand Down

0 comments on commit df091c2

Please sign in to comment.