Permalink
Browse files

arc_fetch() was not failing if the nodes specified were not found.

Rather, the not-found nodes became wildcards... definitely not useful.
  • Loading branch information...
rcaputo committed Sep 25, 2007
1 parent 5a6d9e4 commit 1a56c5f20cdb667a8b5baddb9b43ee7a00696a00
Showing with 32 additions and 3 deletions.
  1. +32 −3 trunk/ThirdLobe/ArcStore.pm
@@ -188,9 +188,38 @@ return sets may consume a lot of memory.
sub arc_fetch {
my ($self, $subject, $predicate, $object) = @_;
- my $sub = $self->anchor_fetch($subject);
- my $prd = $self->anchor_fetch($predicate);
- my $obj = $self->anchor_fetch($object);
+ my $sub;
+ if (defined $subject and length $subject) {
+ if (ref($subject) eq 'ThirdLobe::Arc') {
+ $sub = $subject;
+ }
+ else {
+ $sub = $self->anchor_fetch($subject);
+ return unless defined $sub;
+ }
+ }
+
+ my $prd;
+ if (defined $predicate and length $predicate) {
+ if (ref($predicate) eq 'ThirdLobe::Arc') {
+ $prd = $predicate;
+ }
+ else {
+ $prd = $self->anchor_fetch($predicate);
+ return unless defined $prd;
+ }
+ }
+
+ my $obj;
+ if (defined $object and length $object) {
+ if (ref($object) eq 'ThirdLobe::Arc') {
+ $obj = $object;
+ }
+ else {
+ $obj = $self->anchor_fetch($object);
+ return unless defined $obj;
+ }
+ }
my @arcs = $self->_db()->arc_from_arcs($sub, $prd, $obj);

0 comments on commit 1a56c5f

Please sign in to comment.