forked from LogicalContracts/LogicalEnglish
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathminicontractv2.pl
executable file
·70 lines (56 loc) · 2.92 KB
/
minicontractv2.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
:- module('minicontract+http://tests.com',[]).
en("the target language is: prolog.
% Logical English document
the templates are:
the terms of *a contract* are met,
*a contract* is a valid contract,
*a schedule* of *a contract* is valid,
*a contract* is signed by *a provider* known as *an entity*,
service datetime: *a date*,
*A schedule* is of type payment after delivery of service and before *a N* days have elapsed from service datetime,
*A schedule* is of type payment before service delivery datetime,
*A schedule* is of type staggered payment schedule,
payment after delivery of service and before time *a date*,
payment before service delivery time *a date*.
the knowledge base minicontract includes:
A contract C is a valid contract if
the contract C is signed by the service provider known as a X
and the contract C is signed by the service recipient known as a Y
and the terms of the contract C are met.
the terms of a contract are met if
a payment schedule of the contract is valid.
A payment schedule of a contract is valid
if the payment schedule is of type payment after delivery of service and before 2 days have elapsed from service datetime
or the payment schedule is of type payment after delivery of service and before 30 days have elapsed from service datetime
or the payment schedule is of type payment before service delivery datetime
or the payment schedule is of type staggered payment schedule.
the payment schedule is of type payment after delivery of service and before a N days have elapsed from service datetime
if payment after delivery of service and before time a second date
and service datetime: a first date
and the second date is a M days after the first date
and M < N.
the payment schedule is of type payment before service delivery datetime
if payment before service delivery time a date.
Scenario one is:
the payment schedule is of type staggered payment schedule.
the contract one is signed by the service provider known as Logical Contracts.
the contract one is signed by the service recipient known as Andrew N.
Scenario two is:
payment after delivery of service and before time 2022-06-06T10:00:00.
service datetime: 2022-06-05T10:00:00.
the contract two is signed by the service provider known as Logical Contracts.
the contract two is signed by the service recipient known as Andrew N.
Scenario three is:
payment before service delivery time 2022-06-05T10:00:00.
the contract three is signed by the service provider known as Logical Contracts.
the contract three is signed by the service recipient known as Andrew N.
Query one is:
which contract is a valid contract.
").
/** <examples>
?- answer(one, with(one), le(E), R).
?- answer("query one with scenario one").
?- answer("query one with scenario two").
?- answer("query one with scenario three").
?- show prolog.
*/