~ubuntu-branches/ubuntu/trusty/librdf-trine-perl/trusty

« back to all changes in this revision

Viewing changes to lib/RDF/Trine/Store/Hexastore.pm

  • Committer: Package Import Robot
  • Author(s): Jonas Smedegaard, Jonas Smedegaard
  • Date: 2012-12-11 04:17:02 UTC
  • mfrom: (1.2.2)
  • Revision ID: package-import@ubuntu.com-20121211041702-tfqq2grzobwynjpm
Tags: 1.002-1
* New upstream release.
  Highlights:
  + Replaced old Turtle and TriG parsers with new streaming
    implementations.
  + Added RDF::Trine::Node::Literal->canonicalize method.
  + Updated RDF::Trine::Parser::Redland to construct a new parser
    object on each parse (avoiding a bug in redland).
  + Applied partial patch to 'fix interaction with
    HTML::Data::Parser'.
  + Added POD to RDF::Trine and RDF::Trine::Store::DBI.
  + Silenced undefined warnings in RDF::Trine::Parser::Turtle::Lexer.
  + Silenced warning of cartesian joins in
    RDF::Trine::Store::Hexastore.

[ Jonas Smedegaard ]
* Bump debhelper compatibility level to 8.
* Update package relations:
  + (Build-)depend on libmoose-perl and libmoosex-arrayref-perl.
  + Relax to build-depend unversioned on cdbs: Needed version
    satisfied in stable, and oldstable no longer supported.
* Update copyright file:
  + Expand Files section authored by Toby Inkster, and extend
    coverage.
  + Fix use comment and license pseudo-sections to obey silly
    restrictions of copyright format 1.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 
5
5
=head1 VERSION
6
6
 
7
 
This document describes RDF::Trine::Store::Hexastore version 1.000
 
7
This document describes RDF::Trine::Store::Hexastore version 1.002
8
8
 
9
9
=head1 SYNOPSIS
10
10
 
45
45
 
46
46
our $VERSION;
47
47
BEGIN {
48
 
        $VERSION        = "1.000";
 
48
        $VERSION        = "1.002";
49
49
        my $class       = __PACKAGE__;
50
50
        $RDF::Trine::Store::STORE_CLASSES{ $class }     = $VERSION;
51
51
}
247
247
                
248
248
                my @local_list  = $self->_node_values( $list );
249
249
                my $sub         = sub {
250
 
                        return undef unless (scalar(@local_list));
 
250
                        return unless (scalar(@local_list));
251
251
                        my $id  = shift(@local_list);
252
252
                        my %data        = map { $_ => $nodes[ NODEMAP->{ $_ } ] } @dkeys;
253
253
                        $data{ $ukey }  = $self->_id2node( $id );
295
295
                my $ukey1;
296
296
                my $sub         = sub {
297
297
                        while (0 == scalar(@local_list)) {
298
 
                                return undef unless (scalar(@ukeys1));
 
298
                                return unless (scalar(@ukeys1));
299
299
                                $ukey1          = shift(@ukeys1);
300
300
#                               warn '>>>>>>>>> ' . Dumper( $ukeys[0], $ukey1, $data );
301
301
                                my $list        = $self->_index_from_pair( $index, $ukeys[0], $ukey1 );
362
362
                                # no more objects. go to next predicate.
363
363
                                while (0 == scalar(@pkeys)) {
364
364
                                        # no more predicates. go to next subject.
365
 
                                        return undef unless (scalar(@skeys));
 
365
                                        return unless (scalar(@skeys));
366
366
                                        $sid    = shift(@skeys);
367
367
#                                       warn "*** using subject $sid\n";
368
368
                                        @pkeys  = sort { $a <=> $b } keys %{ $subj->{ $sid }{ $order_keys[1] } };
463
463
                        }
464
464
                        return RDF::Trine::Iterator::Bindings->new( \@results, [ $bgp->referenced_variables ] );
465
465
                } else {
466
 
                        warn 'no shared variable -- cartesian product';
 
466
#                       warn 'no shared variable -- cartesian product';
467
467
                        # no shared variable -- cartesian product
468
468
                        my $i1  = $self->SUPER::_get_pattern( RDF::Trine::Pattern->new( $t1 ) );
469
469
                        my $i2  = $self->SUPER::_get_pattern( RDF::Trine::Pattern->new( $t2 ) );
689
689
sub _node2id {
690
690
        my $self        = shift;
691
691
        my $node        = shift;
692
 
        return undef unless (blessed($node));
693
 
        return undef if ($node->isa('RDF::Trine::Node::Variable'));
 
692
        return unless (blessed($node));
 
693
        return if ($node->isa('RDF::Trine::Node::Variable'));
694
694
        if (exists( $self->{ node2id }{ $node->as_string } )) {
695
695
                return $self->{ node2id }{ $node->as_string };
696
696
        } else {
706
706
        if (exists( $self->{ id2node }{ $id } )) {
707
707
                return $self->{ id2node }{ $id };
708
708
        } else {
709
 
                return undef;
 
709
                return;
710
710
        }
711
711
}
712
712
 
805
805
        my $index       = shift;
806
806
        my $rev         = shift;
807
807
        if ($rev) {
808
 
                return sort { $b <=> $a } keys %$index;
 
808
                my @values      = sort { $b <=> $a } keys %$index;
 
809
                return @values;
809
810
        } else {
810
 
                return sort { $a <=> $b } keys %$index;
 
811
                my @values      = sort { $a <=> $b } keys %$index;
 
812
                return @values;
811
813
        }
812
814
}
813
815
#########################################