14152767ead278333c4092d0be0f8ccc24330262
[scpubgit/DX.git] / lib / DX / Proposition.pm
1 package DX::Proposition;
2
3 use Types::Standard qw(HashRef ArrayRef Str);
4 use DX::Class;
5
6 has predicate => (is => 'ro', isa => Str, required => 1);
7
8 has args => (is => 'ro', isa => ArrayRef[Str|Value], required => 1);
9
10 has introduced_names => (is => 'ro', isa => HashRef[One], required => 1);
11
12 has required_names => (is => 'ro', isa => HashRef[One], required => 1);
13
14 sub resolve_for {
15   my ($self, $scope) = @_;
16   my $predicate = $scope->lookup_predicate($self->predicate);
17   my @args = map { ref($_) ? $_ : $scope->lookup($_) } @{$self->args};
18   #if (my $step = $scope->known_facts->resolution_step_for($predicate, @args)) {
19   #  return $step;
20   #}
21   return $predicate->resolution_step_for($self, @args);
22 }
23
24 1;