From 50a445f82ffb83bfee63ab1381c891d87d873245 Mon Sep 17 00:00:00 2001 From: Gregory Todd Williams Date: Fri, 12 Feb 2016 10:20:57 -0800 Subject: [PATCH] Fix Attean::Algebra::Update->blank_nodes (#70). --- lib/Attean/Algebra.pm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/Attean/Algebra.pm b/lib/Attean/Algebra.pm index 2e854887..789ff612 100644 --- a/lib/Attean/Algebra.pm +++ b/lib/Attean/Algebra.pm @@ -1403,6 +1403,19 @@ package Attean::Algebra::Update 0.012 { } } + around 'blank_nodes' => sub { + my $orig = shift; + my $self = shift; + my @blanks = $orig->($self, @_); + my %seen = map { $_->value => 1 } @blanks; + foreach my $data ($self->insert, $self->delete) { + my @triples = @{ $data }; + my @b = grep { $_->does('Attean::API::Blank') } map { $_->values } @triples; + push(@blanks, grep { not $seen{$_->value}++ } @b); + } + return @blanks; + }; + sub algebra_as_string { my $self = shift; state $S = { @@ -1482,8 +1495,6 @@ package Attean::Algebra::Update 0.012 { } } -# DELETE WHERE - 1; __END__