X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDX%2FProposition.pm;h=6c2d133059dba62ba701ff2b56faf93143248bfa;hb=2548ce615db02d9ebd44d15359c1220aaf06798f;hp=aa6f0601795b473e25ba9987f7f5ae0287be691c;hpb=5f12a9d8e45505cd07c13eb83cde76dddc25fe1c;p=scpubgit%2FDX.git diff --git a/lib/DX/Proposition.pm b/lib/DX/Proposition.pm index aa6f060..6c2d133 100644 --- a/lib/DX/Proposition.pm +++ b/lib/DX/Proposition.pm @@ -1,15 +1,26 @@ package DX::Proposition; -use Types::Standard qw(HashRef ArrayRef Str); use DX::Class; has predicate => (is => 'ro', isa => Str, required => 1); -has args => (is => 'ro', isa => ArrayRef, required => 1); +has args => (is => 'ro', isa => ArrayRef[Str|Value], required => 1); -has introduced_names => (is => 'ro', isa => HashRef, required => 1); +has introduced_names => (is => 'ro', isa => HashRef[One], required => 1); -has required_names => (is => 'ro', isa => HashRef, required => 1); +has required_names => (is => 'ro', isa => HashRef[One], required => 1); + +sub for_deparse { + my ($self) = @_; + [ statement => [ + [ symbol => $self->predicate ], + map { + ref($_) + ? $_ + : [ symbol => $self->introduced_names->{$_} ? "?$_" : $_ ] + } @{$self->args} + ] ]; +} sub resolve_for { my ($self, $scope) = @_; @@ -18,7 +29,7 @@ sub resolve_for { #if (my $step = $scope->known_facts->resolution_step_for($predicate, @args)) { # return $step; #} - return $predicate->resolution_step_for(@args); + return $predicate->resolution_step_for($self, @args); } 1;