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