diff --git a/.gitignore b/.gitignore index dc717b41..3061e755 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ *.pyc transcript /blawxbot/.rasa/ -/blawxbot/models/ \ No newline at end of file +/blawxbot/models/ +blawx/util/test.pl diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f78996f..71781f8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,15 @@ As of v0.2-alpha, this project is attempting to adhere to [Semantic Versioning]( While alpha, however, any version may include breaking changes that may not be specifically noted as such, and breaking changes will not necessarily result in changes to the main version number. +## [v1.6.14-alpha](https://github.com/Lexpedite/blawx/releases/tag/v1.6.14-alpha) 2023-05-12 + +### Added +* A GCWeb-themed version of Scenario Editor + +### Fixed +* Event reasoning was finding spurious evidence of non-interruption. + + ## [v1.6.13-alpha](https://github.com/Lexpedite/blawx/releases/tag/v1.6.13-alpha) 2023-05-09 ### Fixes diff --git a/blawx/aggregates.py b/blawx/aggregates.py index 560bcee4..c0763553 100644 --- a/blawx/aggregates.py +++ b/blawx/aggregates.py @@ -37,4 +37,22 @@ min_blawx_list([First|Rest],RestMin) :- min_blawx_list(Rest,RestMin), First #> RestMin. + +blawx_list_not_between([Head|Tail],Start,End) :- + blawx_not_between(Head,Start,End), + blawx_list_not_between(Tail,Start,End). +blawx_list_not_between([],_,_). +blawx_not_between(X,Y,Z) :- X =< Y. +blawx_not_between(X,Y,Z) :- X >= Z. + +blawx_list_not_before([Head|Tail],End) :- + Head >= End, + blawx_list_not_before(Tail,End). +blawx_list_not_before([],_). + +blawx_list_not_after([Head|Tail],Start) :- + Head =< Start, + blawx_list_not_after(Tail,Start). +blawx_list_not_after([],_). + """ \ No newline at end of file diff --git a/blawx/settings.py b/blawx/settings.py index a0d805d3..6110a888 100644 --- a/blawx/settings.py +++ b/blawx/settings.py @@ -13,7 +13,7 @@ from pathlib import Path # For adding a version identifier -BLAWX_VERSION = "v1.6.13-alpha" +BLAWX_VERSION = "v1.6.14-alpha" # Build paths inside the project like this: BASE_DIR / 'subdir'. diff --git a/blawx/static/blawx/examples/life_act.yaml b/blawx/static/blawx/examples/life_act.yaml index 34c4f208..751ae260 100644 --- a/blawx/static/blawx/examples/life_act.yaml +++ b/blawx/static/blawx/examples/life_act.yaml @@ -48,20 +48,23 @@ type="new_category_declaration" id="/+.JAEH.c(L=ES|z@iRP">personobjectis a personpersonalivebooleanovobject's attribute name isvalueis alivepersondobdatetimeovobjectwas born onvaluepersondobdatetimeovobjectwas born onvalueFALSEFALSEpersonPerson Start.\nblawx_as_of(-person(X),datetime(Time)) - :- blawx_becomes(-person(X),datetime(BeforeT)), not blawx_becomes(person(X), - datetime(BetweenT)), BeforeT #< Time,BeforeT #< BetweenT, BetweenT #< Time.\nblawx_as_of(-person(X),datetime(Time)) - :- blawx_initially(-person(X)), not blawx_becomes(person(X), datetime(BetweenT)), - BetweenT #< Time.\nblawx_during(datetime(Start),-person(X),datetime(End)) :- - blawx_becomes(-person(X),datetime(Start)), not blawx_becomes(person(X),datetime(BeforeEnd)), - blawx_becomes(person(X),datetime(End)), BeforeEnd #< End, Start #< End.\nblawx_during(datetime(bot),-person(X),datetime(End)) - :- blawx_initially(-person(X)), not blawx_becomes(person(X),datetime(BeforeEnd)), - blawx_becomes(person(X),datetime(End)), BeforeEnd #< End.\nblawx_during(datetime(Start),-person(X),datetime(eot)) - :- blawx_becomes(-person(X),datetime(Start)), not blawx_becomes(person(X),datetime(AfterStart)), - blawx_ultimately(-person(X)), AfterStart #> Start.\nblawx_attribute(person,alive,boolean).\nblawx_attribute_nlg(alive,not_applicable,\"\",not_applicable,\"is + became true at @(T)'.\n#pred blawx_not_interrupted(Start,person(X),End) :: '@(X) + is a person remained the case between @(Start) and @(End)'.\n#pred blawx_not_interrupted(Start,-person(X),End) + :: 'it is not the case that @(X) is a person remained the case between @(Start) + and @(End)'.\nblawx_not_interrupted(datetime(Start),person(X),datetime(End)) + :- Start \\= bot, End \\= eot, findall(Time,blawx_becomes(-person(X),datetime(Time)),Times),blawx_list_not_between(Times,Start,End).\nblawx_not_interrupted(datetime(Start),-person(X),datetime(End)) + :- Start \\= bot, End \\= eot, findall(Time,blawx_becomes(person(X),datetime(Time)),Times),blawx_list_not_between(Times,Start,End).\nblawx_not_interrupted(datetime(bot),person(X),datetime(End)) + :- End \\= eot, findall(Time,blawx_becomes(-person(X),datetime(Time)),Times),blawx_list_not_before(Times,End).\nblawx_not_interrupted(datetime(bot),-person(X),datetime(End)) + :- End \\= eot, findall(Time,blawx_becomes(person(X),datetime(Time)),Times),blawx_list_not_before(Times,End).\nblawx_not_interrupted(datetime(Start),person(X),datetime(eot)) + :- Start \\= bot, findall(Time,blawx_becomes(-person(X),datetime(Time)),Times),blawx_list_not_after(Times,Start).\nblawx_not_interrupted(datetime(Start),-person(X),datetime(eot)) + :- Start \\= bot, findall(Time,blawx_becomes(person(X),datetime(Time)),Times),blawx_list_not_after(Times,Start).\nblawx_not_interrupted(datetime(bot),person(X),datetime(eot)) + :- blawx_initially(person(X)), blawx_ultimately(person(X)), findall(Time,blawx_becomes(-person(X),datetime(Time)),[]).\nblawx_not_interrupted(datetime(bot),-person(X),datetime(eot)) + :- blawx_initially(-person(X)), blawx_ultimately(-person(X)), findall(Time,blawx_becomes(person(X),datetime(Time)),[]).\nblawx_as_of(person(X),datetime(Time)) + :- blawx_initially(person(X)), BeforeT #< Time,blawx_not_interrupted(datetime(bot),person(X),datetime(BeforeT)).\nblawx_as_of(person(X),datetime(Time)) + :- blawx_becomes(person(X),datetime(BeforeT)),BeforeT #< Time,blawx_not_interrupted(datetime(BeforeT),person(X),datetime(Time)).\nblawx_as_of(-person(X),datetime(Time)) + :- blawx_initially(-person(X)), BeforeT #< Time,blawx_not_interrupted(datetime(bot),-person(X),datetime(BeforeT)).\nblawx_as_of(-person(X),datetime(Time)) + :- blawx_becomes(-person(X),datetime(BeforeT)),BeforeT #< Time,blawx_not_interrupted(datetime(BeforeT),-person(X),datetime(Time)).\nblawx_during(datetime(Start),person(X),datetime(End)) + :- blawx_becomes(person(X),datetime(Start)), blawx_becomes(-person(X),datetime(End)), + Start #< End, blawx_not_interrupted(datetime(Start),person(X),datetime(End)).\nblawx_during(datetime(bot),person(X),datetime(End)) + :- blawx_initially(person(X)), blawx_becomes(-person(X),datetime(End)), blawx_not_interrupted(datetime(bot),person(X),datetime(End)).\nblawx_during(datetime(Start),person(X),datetime(eot)) + :- blawx_ultimately(person(X)), blawx_becomes(-person(X),datetime(Start)), blawx_not_interrupted(datetime(Start),person(X),datetime(eot)).\nblawx_during(datetime(bot),person(X),datetime(eot)) + :- blawx_initially(person(X)), blawx_ultimately(person(X)), blawx_becomes(-person(X),datetime(Start)), + blawx_not_interrupted(datetime(bot),person(X),datetime(eot)).\nblawx_during(datetime(Start),-person(X),datetime(End)) + :- blawx_becomes(-person(X),datetime(Start)), blawx_becomes(person(X),datetime(End)), + Start #< End, blawx_not_interrupted(datetime(Start),-person(X),datetime(End)).\nblawx_during(datetime(bot),-person(X),datetime(End)) + :- blawx_initially(-person(X)), blawx_becomes(person(X),datetime(End)), blawx_not_interrupted(datetime(bot),-person(X),datetime(End)).\nblawx_during(datetime(Start),-person(X),datetime(eot)) + :- blawx_ultimately(-person(X)), blawx_becomes(person(X),datetime(Start)), blawx_not_interrupted(datetime(Start),-person(X),datetime(eot)).\nblawx_during(datetime(bot),-person(X),datetime(eot)) + :- blawx_initially(-person(X)), blawx_ultimately(-person(X)), blawx_becomes(-person(X),datetime(Start)), + blawx_not_interrupted(datetime(bot),-person(X),datetime(eot)).\nblawx_attribute(person,alive,boolean).\nblawx_attribute_nlg(alive,not_applicable,\"\",not_applicable,\"is alive\").\n:- dynamic alive/1.\n#pred alive(X) :: '@(X) is alive'.\n#pred holds(user,alive,X) :: 'it is provided as a fact that @(X) is alive'.\n#pred holds(user,-alive,X) :: 'it is provided as a fact that it is not the case that @(X) is alive'.\n#pred @@ -141,26 +152,34 @@ :: 'that it is not the case that @(X) is alive held between @(T1) and @(T2)'.\n#pred blawx_becomes(alive(X),T) :: 'that @(X) is alive became true at @(T)'.\n#pred blawx_becomes(-alive(X),T) :: 'that it is not the case that @(X) is alive became - true at @(T)'.\nblawx_as_of(alive(X),datetime(Time)) :- blawx_becomes(alive(X),datetime(BeforeT)), - not blawx_becomes(-alive(X), datetime(BetweenT)), BeforeT #< Time,BeforeT #< - BetweenT, BetweenT #< Time.\nblawx_as_of(alive(X),datetime(Time)) :- blawx_initially(alive(X)), - not blawx_becomes(-alive(X), datetime(BetweenT)), BetweenT #< Time.\nblawx_during(datetime(Start),alive(X),datetime(End)) - :- blawx_becomes(alive(X),datetime(Start)), not blawx_becomes(-alive(X),datetime(BeforeEnd)), - blawx_becomes(-alive(X),datetime(End)), BeforeEnd #< End, Start #< End.\nblawx_during(datetime(bot),alive(X),datetime(End)) - :- blawx_initially(alive(X)), not blawx_becomes(-alive(X),datetime(BeforeEnd)), - blawx_becomes(-alive(X),datetime(End)), BeforeEnd #< End.\nblawx_during(datetime(Start),alive(X),datetime(eot)) - :- blawx_becomes(alive(X),datetime(Start)), not blawx_becomes(-alive(X),datetime(AfterStart)), - blawx_ultimately(alive(X)), AfterStart #> Start.\nblawx_as_of(-alive(X),datetime(Time)) - :- blawx_becomes(-alive(X),datetime(BeforeT)), not blawx_becomes(alive(X), datetime(BetweenT)), - BeforeT #< Time,BeforeT #< BetweenT, BetweenT #< Time.\nblawx_as_of(-alive(X),datetime(Time)) - :- blawx_initially(-alive(X)), not blawx_becomes(alive(X), datetime(BetweenT)), - BetweenT #< Time.\nblawx_during(datetime(Start),-alive(X),datetime(End)) :- - blawx_becomes(-alive(X),datetime(Start)), not blawx_becomes(alive(X),datetime(BeforeEnd)), - blawx_becomes(alive(X),datetime(End)), BeforeEnd #< End, Start #< End.\nblawx_during(datetime(bot),-alive(X),datetime(End)) - :- blawx_initially(-alive(X)), not blawx_becomes(alive(X),datetime(BeforeEnd)), - blawx_becomes(alive(X),datetime(End)), BeforeEnd #< End.\nblawx_during(datetime(Start),-alive(X),datetime(eot)) - :- blawx_becomes(-alive(X),datetime(Start)), not blawx_becomes(alive(X),datetime(AfterStart)), - blawx_ultimately(-alive(X)), AfterStart #> Start.\nblawx_attribute(person,dob,datetime).\nblawx_attribute_nlg(dob,ov,\"\",\"was + true at @(T)'.\n#pred blawx_not_interrupted(Start,alive(X),End) :: '@(X) is + alive remained the case between @(Start) and @(End)'.\n#pred blawx_not_interrupted(Start,-alive(X),End) + :: 'it is not the case that @(X) is alive remained the case between @(Start) + and @(End)'.\nblawx_not_interrupted(datetime(Start),alive(X),datetime(End)) + :- Start \\= bot, End \\= eot, findall(Time,blawx_becomes(-alive(X),datetime(Time)),Times),blawx_list_not_between(Times,Start,End).\nblawx_not_interrupted(datetime(Start),-alive(X),datetime(End)) + :- Start \\= bot, End \\= eot, findall(Time,blawx_becomes(alive(X),datetime(Time)),Times),blawx_list_not_between(Times,Start,End).\nblawx_not_interrupted(datetime(bot),alive(X),datetime(End)) + :- End \\= eot, findall(Time,blawx_becomes(-alive(X),datetime(Time)),Times),blawx_list_not_before(Times,End).\nblawx_not_interrupted(datetime(bot),-alive(X),datetime(End)) + :- End \\= eot, findall(Time,blawx_becomes(alive(X),datetime(Time)),Times),blawx_list_not_before(Times,End).\nblawx_not_interrupted(datetime(Start),alive(X),datetime(eot)) + :- Start \\= bot, findall(Time,blawx_becomes(-alive(X),datetime(Time)),Times),blawx_list_not_after(Times,Start).\nblawx_not_interrupted(datetime(Start),-alive(X),datetime(eot)) + :- Start \\= bot, findall(Time,blawx_becomes(alive(X),datetime(Time)),Times),blawx_list_not_after(Times,Start).\nblawx_not_interrupted(datetime(bot),alive(X),datetime(eot)) + :- blawx_initially(alive(X)), blawx_ultimately(alive(X)), findall(Time,blawx_becomes(-alive(X),datetime(Time)),[]).\nblawx_not_interrupted(datetime(bot),-alive(X),datetime(eot)) + :- blawx_initially(-alive(X)), blawx_ultimately(-alive(X)), findall(Time,blawx_becomes(alive(X),datetime(Time)),[]).\nblawx_as_of(alive(X),datetime(Time)) + :- blawx_initially(alive(X)), BeforeT #< Time,blawx_not_interrupted(datetime(bot),alive(X),datetime(BeforeT)).\nblawx_as_of(alive(X),datetime(Time)) + :- blawx_becomes(alive(X),datetime(BeforeT)),BeforeT #< Time,blawx_not_interrupted(datetime(BeforeT),alive(X),datetime(Time)).\nblawx_as_of(-alive(X),datetime(Time)) + :- blawx_initially(-alive(X)), BeforeT #< Time,blawx_not_interrupted(datetime(bot),-alive(X),datetime(BeforeT)).\nblawx_as_of(-alive(X),datetime(Time)) + :- blawx_becomes(-alive(X),datetime(BeforeT)),BeforeT #< Time,blawx_not_interrupted(datetime(BeforeT),-alive(X),datetime(Time)).\nblawx_during(datetime(Start),alive(X),datetime(End)) + :- blawx_becomes(alive(X),datetime(Start)), blawx_becomes(-alive(X),datetime(End)), + Start #< End, blawx_not_interrupted(datetime(Start),alive(X),datetime(End)).\nblawx_during(datetime(bot),alive(X),datetime(End)) + :- blawx_initially(alive(X)), blawx_becomes(-alive(X),datetime(End)), blawx_not_interrupted(datetime(bot),alive(X),datetime(End)).\nblawx_during(datetime(Start),alive(X),datetime(eot)) + :- blawx_ultimately(alive(X)), blawx_becomes(-alive(X),datetime(Start)), blawx_not_interrupted(datetime(Start),alive(X),datetime(eot)).\nblawx_during(datetime(bot),alive(X),datetime(eot)) + :- blawx_initially(alive(X)), blawx_ultimately(alive(X)), blawx_becomes(-alive(X),datetime(Start)), + blawx_not_interrupted(datetime(bot),alive(X),datetime(eot)).\nblawx_during(datetime(Start),-alive(X),datetime(End)) + :- blawx_becomes(-alive(X),datetime(Start)), blawx_becomes(alive(X),datetime(End)), + Start #< End, blawx_not_interrupted(datetime(Start),-alive(X),datetime(End)).\nblawx_during(datetime(bot),-alive(X),datetime(End)) + :- blawx_initially(-alive(X)), blawx_becomes(alive(X),datetime(End)), blawx_not_interrupted(datetime(bot),-alive(X),datetime(End)).\nblawx_during(datetime(Start),-alive(X),datetime(eot)) + :- blawx_ultimately(-alive(X)), blawx_becomes(alive(X),datetime(Start)), blawx_not_interrupted(datetime(Start),-alive(X),datetime(eot)).\nblawx_during(datetime(bot),-alive(X),datetime(eot)) + :- blawx_initially(-alive(X)), blawx_ultimately(-alive(X)), blawx_becomes(-alive(X),datetime(Start)), + blawx_not_interrupted(datetime(bot),-alive(X),datetime(eot)).\nblawx_attribute(person,dob,datetime).\nblawx_attribute_nlg(dob,ov,\"\",\"was born on\",\"\").\n:- dynamic dob/2.\n#pred dob(X,Y) :: '@(X) was born on @(Y)'.\n#pred holds(user,dob,X,Y) :: 'it is provided as a fact that @(X) was born on @(Y)'.\n#pred holds(user,-dob,X,Y) :: 'it is provided as a fact that it is not the case that @@ -171,39 +190,46 @@ :: 'according to @(Z), it is not the case that @(X) was born on @(Y)'.\n#pred blawx_defeated(Z,dob,X,Y) :: 'the conclusion in @(Z) that @(X) was born on @(Y) is defeated'.\n#pred blawx_defeated(Z,-dob,X,Y) :: 'the conclusion in @(Z) that - @(X) was born on @(Y) is defeated'.\n#pred blawx_initially(dob,(X,Y)) :: 'that - @(X) was born on @(Y) holds initially'.\n#pred blawx_initially(-dob,(X,Y)) :: + @(X) was born on @(Y) is defeated'.\n#pred blawx_initially(dob(X,Y)) :: 'that + @(X) was born on @(Y) holds initially'.\n#pred blawx_initially(-dob(X,Y)) :: 'that it is not the case that @(X) was born on @(Y) holds initially'.\n#pred - blawx_ultimately(dob,(X,Y)) :: 'that @(X) was born on @(Y) holds ultimately'.\n#pred - blawx_ultimately(-dob,(X,Y)) :: 'that it is not the case that @(X) was born - on @(Y) holds ultimately'.\n#pred blawx_as_of(dob,(X,Y),T) :: 'that @(X) was - born on @(Y) holds at @(T)'.\n#pred blawx_as_of(-dob,(X,Y),T) :: 'that it is - not the case that @(X) was born on @(Y) holds at @(T)'.\n#pred blawx_during(T1,dob,(X,Y),T2) - :: 'that @(X) was born on @(Y) held between @(T1) and @(T2)'.\n#pred blawx_during(T1,-dob,(X,Y),T2) + blawx_ultimately(dob(X,Y)) :: 'that @(X) was born on @(Y) holds ultimately'.\n#pred + blawx_ultimately(-dob(X,Y)) :: 'that it is not the case that @(X) was born on + @(Y) holds ultimately'.\n#pred blawx_as_of(dob(X,Y),T) :: 'that @(X) was born + on @(Y) holds at @(T)'.\n#pred blawx_as_of(-dob(X,Y),T) :: 'that it is not the + case that @(X) was born on @(Y) holds at @(T)'.\n#pred blawx_during(T1,dob(X,Y),T2) + :: 'that @(X) was born on @(Y) held between @(T1) and @(T2)'.\n#pred blawx_during(T1,-dob(X,Y),T2) :: 'that it is not the case that @(X) was born on @(Y) held between @(T1) and - @(T2)'.\n#pred blawx_becomes(dob,(X,Y),T) :: 'that @(X) was born on @(Y) became - true at @(T)'.\n#pred blawx_becomes(-dob,(X,Y),T) :: 'that it is not the case - that @(X) was born on @(Y) became true at @(T)'.\nblawx_as_of(dob(X,Y),datetime(Time)) - :- blawx_becomes(dob(X,Y),datetime(BeforeT)), not blawx_becomes(-dob(X,Y), datetime(BetweenT)), - BeforeT #< Time,BeforeT #< BetweenT, BetweenT #< Time.\nblawx_as_of(dob(X,Y),datetime(Time)) - :- blawx_initially(dob(X,Y)), not blawx_becomes(-dob(X,Y), datetime(BetweenT)), - BetweenT #< Time.\nblawx_during(datetime(Start),dob(X,Y),datetime(End)) :- blawx_becomes(dob(X,Y),datetime(Start)), - not blawx_becomes(-dob(X,Y),datetime(BeforeEnd)), blawx_becomes(-dob(X,Y),datetime(End)), - BeforeEnd #< End, Start #< End.\nblawx_during(datetime(bot),dob(X,Y),datetime(End)) - :- blawx_initially(dob(X,Y)), not blawx_becomes(-dob(X,Y),datetime(BeforeEnd)), - blawx_becomes(-dob(X,Y),datetime(End)), BeforeEnd #< End.\nblawx_during(datetime(Start),dob(X,Y),datetime(eot)) - :- blawx_becomes(dob(X,Y),datetime(Start)), not blawx_becomes(-dob(X,Y),datetime(AfterStart)), - blawx_ultimately(dob(X,Y)), AfterStart #> Start.\nblawx_as_of(-dob(X,Y),datetime(Time)) - :- blawx_becomes(-dob(X,Y),datetime(BeforeT)), not blawx_becomes(dob(X,Y), datetime(BetweenT)), - BeforeT #< Time,BeforeT #< BetweenT, BetweenT #< Time.\nblawx_as_of(-dob(X,Y),datetime(Time)) - :- blawx_initially(-dob(X,Y)), not blawx_becomes(dob(X,Y), datetime(BetweenT)), - BetweenT #< Time.\nblawx_during(datetime(Start),-dob(X,Y),datetime(End)) :- - blawx_becomes(-dob(X,Y),datetime(Start)), not blawx_becomes(dob(X,Y),datetime(BeforeEnd)), - blawx_becomes(dob(X,Y),datetime(End)), BeforeEnd #< End, Start #< End.\nblawx_during(datetime(bot),-dob(X,Y),datetime(End)) - :- blawx_initially(-dob(X,Y)), not blawx_becomes(dob(X,Y),datetime(BeforeEnd)), - blawx_becomes(dob(X,Y),datetime(End)), BeforeEnd #< End.\nblawx_during(datetime(Start),-dob(X,Y),datetime(eot)) - :- blawx_becomes(-dob(X,Y),datetime(Start)), not blawx_becomes(dob(X,Y),datetime(AfterStart)), - blawx_ultimately(-dob(X,Y)), AfterStart #> Start.\n\naccording_to(sec_1_section,blawx_becomes,alive(Person),DOB) + @(T2)'.\n#pred blawx_becomes(dob(X,Y),T) :: 'that @(X) was born on @(Y) became + true at @(T)'.\n#pred blawx_becomes(-dob(X,Y),T) :: 'that it is not the case + that @(X) was born on @(Y) became true at @(T)'.\n#pred blawx_not_interrupted(Start,dob(X,Y),End) + :: '@(X) was born on @(Y) remained the case between @(Start) and @(End)'.\n#pred + blawx_not_interrupted(Start,-dob(X,Y),End) :: 'it is not the case that @(X) + was born on @(Y) remained the case between @(Start) and @(End)'.\nblawx_not_interrupted(datetime(Start),dob(X,Y),datetime(End)) + :- Start \\= bot, End \\= eot, findall(Time,blawx_becomes(-dob(X,Y),datetime(Time)),Times),blawx_list_not_between(Times,Start,End).\nblawx_not_interrupted(datetime(Start),-dob(X,Y),datetime(End)) + :- Start \\= bot, End \\= eot, findall(Time,blawx_becomes(dob(X,Y),datetime(Time)),Times),blawx_list_not_between(Times,Start,End).\nblawx_not_interrupted(datetime(bot),dob(X,Y),datetime(End)) + :- End \\= eot, findall(Time,blawx_becomes(-dob(X,Y),datetime(Time)),Times),blawx_list_not_before(Times,End).\nblawx_not_interrupted(datetime(bot),-dob(X,Y),datetime(End)) + :- End \\= eot, findall(Time,blawx_becomes(dob(X,Y),datetime(Time)),Times),blawx_list_not_before(Times,End).\nblawx_not_interrupted(datetime(Start),dob(X,Y),datetime(eot)) + :- Start \\= bot, findall(Time,blawx_becomes(-dob(X,Y),datetime(Time)),Times),blawx_list_not_after(Times,Start).\nblawx_not_interrupted(datetime(Start),-dob(X,Y),datetime(eot)) + :- Start \\= bot, findall(Time,blawx_becomes(dob(X,Y),datetime(Time)),Times),blawx_list_not_after(Times,Start).\nblawx_not_interrupted(datetime(bot),dob(X,Y),datetime(eot)) + :- blawx_initially(dob(X,Y)), blawx_ultimately(dob(X,Y)), findall(Time,blawx_becomes(-dob(X,Y),datetime(Time)),[]).\nblawx_not_interrupted(datetime(bot),-dob(X,Y),datetime(eot)) + :- blawx_initially(-dob(X,Y)), blawx_ultimately(-dob(X,Y)), findall(Time,blawx_becomes(dob(X,Y),datetime(Time)),[]).\nblawx_as_of(dob(X,Y),datetime(Time)) + :- blawx_initially(dob(X,Y)), BeforeT #< Time,blawx_not_interrupted(datetime(bot),dob(X,Y),datetime(BeforeT)).\nblawx_as_of(dob(X,Y),datetime(Time)) + :- blawx_becomes(dob(X,Y),datetime(BeforeT)),BeforeT #< Time,blawx_not_interrupted(datetime(BeforeT),dob(X,Y),datetime(Time)).\nblawx_as_of(-dob(X,Y),datetime(Time)) + :- blawx_initially(-dob(X,Y)), BeforeT #< Time,blawx_not_interrupted(datetime(bot),-dob(X,Y),datetime(BeforeT)).\nblawx_as_of(-dob(X,Y),datetime(Time)) + :- blawx_becomes(-dob(X,Y),datetime(BeforeT)),BeforeT #< Time,blawx_not_interrupted(datetime(BeforeT),-dob(X,Y),datetime(Time)).\nblawx_during(datetime(Start),dob(X,Y),datetime(End)) + :- blawx_becomes(dob(X,Y),datetime(Start)), blawx_becomes(-dob(X,Y),datetime(End)), + Start #< End, blawx_not_interrupted(datetime(Start),dob(X,Y),datetime(End)).\nblawx_during(datetime(bot),dob(X,Y),datetime(End)) + :- blawx_initially(dob(X,Y)), blawx_becomes(-dob(X,Y),datetime(End)), blawx_not_interrupted(datetime(bot),dob(X,Y),datetime(End)).\nblawx_during(datetime(Start),dob(X,Y),datetime(eot)) + :- blawx_ultimately(dob(X,Y)), blawx_becomes(-dob(X,Y),datetime(Start)), blawx_not_interrupted(datetime(Start),dob(X,Y),datetime(eot)).\nblawx_during(datetime(bot),dob(X,Y),datetime(eot)) + :- blawx_initially(dob(X,Y)), blawx_ultimately(dob(X,Y)), blawx_becomes(-dob(X,Y),datetime(Start)), + blawx_not_interrupted(datetime(bot),dob(X,Y),datetime(eot)).\nblawx_during(datetime(Start),-dob(X,Y),datetime(End)) + :- blawx_becomes(-dob(X,Y),datetime(Start)), blawx_becomes(dob(X,Y),datetime(End)), + Start #< End, blawx_not_interrupted(datetime(Start),-dob(X,Y),datetime(End)).\nblawx_during(datetime(bot),-dob(X,Y),datetime(End)) + :- blawx_initially(-dob(X,Y)), blawx_becomes(dob(X,Y),datetime(End)), blawx_not_interrupted(datetime(bot),-dob(X,Y),datetime(End)).\nblawx_during(datetime(Start),-dob(X,Y),datetime(eot)) + :- blawx_ultimately(-dob(X,Y)), blawx_becomes(dob(X,Y),datetime(Start)), blawx_not_interrupted(datetime(Start),-dob(X,Y),datetime(eot)).\nblawx_during(datetime(bot),-dob(X,Y),datetime(eot)) + :- blawx_initially(-dob(X,Y)), blawx_ultimately(-dob(X,Y)), blawx_becomes(-dob(X,Y),datetime(Start)), + blawx_not_interrupted(datetime(bot),-dob(X,Y),datetime(eot)).\n\naccording_to(sec_1_section,blawx_becomes,alive(Person),DOB) :- person(Person),\ndob(Person,DOB).\n\n% BLAWX CHECK DUPLICATES\nholds(sec_1_section,blawx_becomes,alive(Person),DOB) :- according_to(sec_1_section,blawx_becomes,alive(Person),DOB).\n\n% BLAWX CHECK DUPLICATES\n blawx_becomes( alive(Person),DOB) :- holds(sec_1_section,blawx_becomes,alive(Person),DOB)." @@ -229,14 +255,16 @@ xml_content: persondoddatetimeovobjectdied onvalueFALSEpersondoddatetimeovobjectdied onvalueFALSEFALSEpersonPerson Start.\nblawx_as_of(-dod(X,Y),datetime(Time)) - :- blawx_becomes(-dod(X,Y),datetime(BeforeT)), not blawx_becomes(dod(X,Y), datetime(BetweenT)), - BeforeT #< Time,BeforeT #< BetweenT, BetweenT #< Time.\nblawx_as_of(-dod(X,Y),datetime(Time)) - :- blawx_initially(-dod(X,Y)), not blawx_becomes(dod(X,Y), datetime(BetweenT)), - BetweenT #< Time.\nblawx_during(datetime(Start),-dod(X,Y),datetime(End)) :- - blawx_becomes(-dod(X,Y),datetime(Start)), not blawx_becomes(dod(X,Y),datetime(BeforeEnd)), - blawx_becomes(dod(X,Y),datetime(End)), BeforeEnd #< End, Start #< End.\nblawx_during(datetime(bot),-dod(X,Y),datetime(End)) - :- blawx_initially(-dod(X,Y)), not blawx_becomes(dod(X,Y),datetime(BeforeEnd)), - blawx_becomes(dod(X,Y),datetime(End)), BeforeEnd #< End.\nblawx_during(datetime(Start),-dod(X,Y),datetime(eot)) - :- blawx_becomes(-dod(X,Y),datetime(Start)), not blawx_becomes(dod(X,Y),datetime(AfterStart)), - blawx_ultimately(-dod(X,Y)), AfterStart #> Start.\n\naccording_to(sec_3_section,blawx_becomes,-alive(Person),DOD) + blawx_becomes(dod(X,Y),T) :: 'that @(X) died on @(Y) became true at @(T)'.\n#pred + blawx_becomes(-dod(X,Y),T) :: 'that it is not the case that @(X) died on @(Y) + became true at @(T)'.\n#pred blawx_not_interrupted(Start,dod(X,Y),End) :: '@(X) + died on @(Y) remained the case between @(Start) and @(End)'.\n#pred blawx_not_interrupted(Start,-dod(X,Y),End) + :: 'it is not the case that @(X) died on @(Y) remained the case between @(Start) + and @(End)'.\nblawx_not_interrupted(datetime(Start),dod(X,Y),datetime(End)) + :- Start \\= bot, End \\= eot, findall(Time,blawx_becomes(-dod(X,Y),datetime(Time)),Times),blawx_list_not_between(Times,Start,End).\nblawx_not_interrupted(datetime(Start),-dod(X,Y),datetime(End)) + :- Start \\= bot, End \\= eot, findall(Time,blawx_becomes(dod(X,Y),datetime(Time)),Times),blawx_list_not_between(Times,Start,End).\nblawx_not_interrupted(datetime(bot),dod(X,Y),datetime(End)) + :- End \\= eot, findall(Time,blawx_becomes(-dod(X,Y),datetime(Time)),Times),blawx_list_not_before(Times,End).\nblawx_not_interrupted(datetime(bot),-dod(X,Y),datetime(End)) + :- End \\= eot, findall(Time,blawx_becomes(dod(X,Y),datetime(Time)),Times),blawx_list_not_before(Times,End).\nblawx_not_interrupted(datetime(Start),dod(X,Y),datetime(eot)) + :- Start \\= bot, findall(Time,blawx_becomes(-dod(X,Y),datetime(Time)),Times),blawx_list_not_after(Times,Start).\nblawx_not_interrupted(datetime(Start),-dod(X,Y),datetime(eot)) + :- Start \\= bot, findall(Time,blawx_becomes(dod(X,Y),datetime(Time)),Times),blawx_list_not_after(Times,Start).\nblawx_not_interrupted(datetime(bot),dod(X,Y),datetime(eot)) + :- blawx_initially(dod(X,Y)), blawx_ultimately(dod(X,Y)), findall(Time,blawx_becomes(-dod(X,Y),datetime(Time)),[]).\nblawx_not_interrupted(datetime(bot),-dod(X,Y),datetime(eot)) + :- blawx_initially(-dod(X,Y)), blawx_ultimately(-dod(X,Y)), findall(Time,blawx_becomes(dod(X,Y),datetime(Time)),[]).\nblawx_as_of(dod(X,Y),datetime(Time)) + :- blawx_initially(dod(X,Y)), BeforeT #< Time,blawx_not_interrupted(datetime(bot),dod(X,Y),datetime(BeforeT)).\nblawx_as_of(dod(X,Y),datetime(Time)) + :- blawx_becomes(dod(X,Y),datetime(BeforeT)),BeforeT #< Time,blawx_not_interrupted(datetime(BeforeT),dod(X,Y),datetime(Time)).\nblawx_as_of(-dod(X,Y),datetime(Time)) + :- blawx_initially(-dod(X,Y)), BeforeT #< Time,blawx_not_interrupted(datetime(bot),-dod(X,Y),datetime(BeforeT)).\nblawx_as_of(-dod(X,Y),datetime(Time)) + :- blawx_becomes(-dod(X,Y),datetime(BeforeT)),BeforeT #< Time,blawx_not_interrupted(datetime(BeforeT),-dod(X,Y),datetime(Time)).\nblawx_during(datetime(Start),dod(X,Y),datetime(End)) + :- blawx_becomes(dod(X,Y),datetime(Start)), blawx_becomes(-dod(X,Y),datetime(End)), + Start #< End, blawx_not_interrupted(datetime(Start),dod(X,Y),datetime(End)).\nblawx_during(datetime(bot),dod(X,Y),datetime(End)) + :- blawx_initially(dod(X,Y)), blawx_becomes(-dod(X,Y),datetime(End)), blawx_not_interrupted(datetime(bot),dod(X,Y),datetime(End)).\nblawx_during(datetime(Start),dod(X,Y),datetime(eot)) + :- blawx_ultimately(dod(X,Y)), blawx_becomes(-dod(X,Y),datetime(Start)), blawx_not_interrupted(datetime(Start),dod(X,Y),datetime(eot)).\nblawx_during(datetime(bot),dod(X,Y),datetime(eot)) + :- blawx_initially(dod(X,Y)), blawx_ultimately(dod(X,Y)), blawx_becomes(-dod(X,Y),datetime(Start)), + blawx_not_interrupted(datetime(bot),dod(X,Y),datetime(eot)).\nblawx_during(datetime(Start),-dod(X,Y),datetime(End)) + :- blawx_becomes(-dod(X,Y),datetime(Start)), blawx_becomes(dod(X,Y),datetime(End)), + Start #< End, blawx_not_interrupted(datetime(Start),-dod(X,Y),datetime(End)).\nblawx_during(datetime(bot),-dod(X,Y),datetime(End)) + :- blawx_initially(-dod(X,Y)), blawx_becomes(dod(X,Y),datetime(End)), blawx_not_interrupted(datetime(bot),-dod(X,Y),datetime(End)).\nblawx_during(datetime(Start),-dod(X,Y),datetime(eot)) + :- blawx_ultimately(-dod(X,Y)), blawx_becomes(dod(X,Y),datetime(Start)), blawx_not_interrupted(datetime(Start),-dod(X,Y),datetime(eot)).\nblawx_during(datetime(bot),-dod(X,Y),datetime(eot)) + :- blawx_initially(-dod(X,Y)), blawx_ultimately(-dod(X,Y)), blawx_becomes(-dod(X,Y),datetime(Start)), + blawx_not_interrupted(datetime(bot),-dod(X,Y),datetime(eot)).\n\naccording_to(sec_3_section,blawx_becomes,-alive(Person),DOD) :- person(Person),\ndod(Person,DOD).\n\n% BLAWX CHECK DUPLICATES\nholds(sec_3_section,blawx_becomes,-alive(Person),DOD) :- according_to(sec_3_section,blawx_becomes,-alive(Person),DOD).\n\n% BLAWX CHECK DUPLICATES\n blawx_becomes( -alive(Person),DOD) :- holds(sec_3_section,blawx_becomes,-alive(Person),DOD).\n\nblawx_ultimately( diff --git a/blawx/static/blawx/scasp_generator.js b/blawx/static/blawx/scasp_generator.js index d5fcfecb..9798d66d 100644 --- a/blawx/static/blawx/scasp_generator.js +++ b/blawx/static/blawx/scasp_generator.js @@ -957,16 +957,53 @@ sCASP['new_attribute_declaration'] = function(block) { code += '#pred blawx_during(T1,-' + text_attribute_name + '(' + variable_order + "),T2) :: 'that it is not the case that " + add_code.trim() + " held between @(T1) and @(T2)'.\n"; code += '#pred blawx_becomes(' + text_attribute_name + '(' + variable_order + "),T) :: 'that " + add_code.trim() + " became true at @(T)'.\n"; code += '#pred blawx_becomes(-' + text_attribute_name + '(' + variable_order + "),T) :: 'that it is not the case that " + add_code.trim() + " became true at @(T)'.\n"; - code += 'blawx_as_of(' + text_attribute_name + '(X,Y),datetime(Time)) :- blawx_becomes(' + text_attribute_name + '(X,Y),datetime(BeforeT)), not blawx_becomes(-' + text_attribute_name + '(X,Y), datetime(BetweenT)), BeforeT #< Time,BeforeT #< BetweenT, BetweenT #< Time.\n'; - code += 'blawx_as_of(' + text_attribute_name + '(X,Y),datetime(Time)) :- blawx_initially(' + text_attribute_name + '(X,Y)), not blawx_becomes(-' + text_attribute_name + '(X,Y), datetime(BetweenT)), BetweenT #< Time.\n'; - code += 'blawx_during(datetime(Start),' + text_attribute_name + '(X,Y),datetime(End)) :- blawx_becomes(' + text_attribute_name + '(X,Y),datetime(Start)), not blawx_becomes(-' + text_attribute_name + '(X,Y),datetime(BeforeEnd)), blawx_becomes(-' + text_attribute_name + '(X,Y),datetime(End)), BeforeEnd #< End, Start #< End.\n'; - code += 'blawx_during(datetime(bot),' + text_attribute_name + '(X,Y),datetime(End)) :- blawx_initially(' + text_attribute_name + '(X,Y)), not blawx_becomes(-' + text_attribute_name + '(X,Y),datetime(BeforeEnd)), blawx_becomes(-' + text_attribute_name + '(X,Y),datetime(End)), BeforeEnd #< End.\n'; - code += 'blawx_during(datetime(Start),' + text_attribute_name + '(X,Y),datetime(eot)) :- blawx_becomes(' + text_attribute_name + '(X,Y),datetime(Start)), not blawx_becomes(-' + text_attribute_name + '(X,Y),datetime(AfterStart)), blawx_ultimately(' + text_attribute_name + '(X,Y)), AfterStart #> Start.\n'; - code += 'blawx_as_of(-' + text_attribute_name + '(X,Y),datetime(Time)) :- blawx_becomes(-' + text_attribute_name + '(X,Y),datetime(BeforeT)), not blawx_becomes(' + text_attribute_name + '(X,Y), datetime(BetweenT)), BeforeT #< Time,BeforeT #< BetweenT, BetweenT #< Time.\n'; - code += 'blawx_as_of(-' + text_attribute_name + '(X,Y),datetime(Time)) :- blawx_initially(-' + text_attribute_name + '(X,Y)), not blawx_becomes(' + text_attribute_name + '(X,Y), datetime(BetweenT)), BetweenT #< Time.\n'; - code += 'blawx_during(datetime(Start),-' + text_attribute_name + '(X,Y),datetime(End)) :- blawx_becomes(-' + text_attribute_name + '(X,Y),datetime(Start)), not blawx_becomes(' + text_attribute_name + '(X,Y),datetime(BeforeEnd)), blawx_becomes(' + text_attribute_name + '(X,Y),datetime(End)), BeforeEnd #< End, Start #< End.\n'; - code += 'blawx_during(datetime(bot),-' + text_attribute_name + '(X,Y),datetime(End)) :- blawx_initially(-' + text_attribute_name + '(X,Y)), not blawx_becomes(' + text_attribute_name + '(X,Y),datetime(BeforeEnd)), blawx_becomes(' + text_attribute_name + '(X,Y),datetime(End)), BeforeEnd #< End.\n'; - code += 'blawx_during(datetime(Start),-' + text_attribute_name + '(X,Y),datetime(eot)) :- blawx_becomes(-' + text_attribute_name + '(X,Y),datetime(Start)), not blawx_becomes(' + text_attribute_name + '(X,Y),datetime(AfterStart)), blawx_ultimately(-' + text_attribute_name + '(X,Y)), AfterStart #> Start.\n'; + code += '#pred blawx_not_interrupted(Start,' + text_attribute_name + '(' + variable_order + "),End) :: '" + add_code.trim() + " remained the case between @(Start) and @(End)'.\n"; + code += '#pred blawx_not_interrupted(Start,-' + text_attribute_name + '(' + variable_order + "),End) :: 'it is not the case that " + add_code.trim() + " remained the case between @(Start) and @(End)'.\n"; + + // Generate event reasoning rules. + // Not interrupted positive between + code += 'blawx_not_interrupted(datetime(Start),' + text_attribute_name + '(' + variable_order + '),datetime(End)) :- Start \\= bot, End \\= eot, findall(Time,blawx_becomes(-' + text_attribute_name + '(' + variable_order + '),datetime(Time)),Times),blawx_list_not_between(Times,Start,End).\n' + // not interrupted negative between + code += 'blawx_not_interrupted(datetime(Start),-' + text_attribute_name + '(' + variable_order + '),datetime(End)) :- Start \\= bot, End \\= eot, findall(Time,blawx_becomes(' + text_attribute_name + '(' + variable_order + '),datetime(Time)),Times),blawx_list_not_between(Times,Start,End).\n' + // not interrupted positive before end after bot + code += 'blawx_not_interrupted(datetime(bot),' + text_attribute_name + '(' + variable_order + '),datetime(End)) :- End \\= eot, findall(Time,blawx_becomes(-' + text_attribute_name + '(' + variable_order + '),datetime(Time)),Times),blawx_list_not_before(Times,End).\n' + // not interrupted negative before end after bot + code += 'blawx_not_interrupted(datetime(bot),-' + text_attribute_name + '(' + variable_order + '),datetime(End)) :- End \\= eot, findall(Time,blawx_becomes(' + text_attribute_name + '(' + variable_order + '),datetime(Time)),Times),blawx_list_not_before(Times,End).\n' + // not interrupted positive before eot after start + code += 'blawx_not_interrupted(datetime(Start),' + text_attribute_name + '(' + variable_order + '),datetime(eot)) :- Start \\= bot, findall(Time,blawx_becomes(-' + text_attribute_name + '(' + variable_order + '),datetime(Time)),Times),blawx_list_not_after(Times,Start).\n' + // not interrupted negative before eot after start + code += 'blawx_not_interrupted(datetime(Start),-' + text_attribute_name + '(' + variable_order + '),datetime(eot)) :- Start \\= bot, findall(Time,blawx_becomes(' + text_attribute_name + '(' + variable_order + '),datetime(Time)),Times),blawx_list_not_after(Times,Start).\n' + // not interrupted positive ever + code += 'blawx_not_interrupted(datetime(bot),' + text_attribute_name + '(' + variable_order + '),datetime(eot)) :- blawx_initially(' + text_attribute_name + '(' + variable_order + ')), blawx_ultimately(' + text_attribute_name + '(' + variable_order + ')), findall(Time,blawx_becomes(-' + text_attribute_name + '(' + variable_order + '),datetime(Time)),[]).\n' + // not interrupted negative ever + code += 'blawx_not_interrupted(datetime(bot),-' + text_attribute_name + '(' + variable_order + '),datetime(eot)) :- blawx_initially(-' + text_attribute_name + '(' + variable_order + ')), blawx_ultimately(-' + text_attribute_name + '(' + variable_order + ')), findall(Time,blawx_becomes(' + text_attribute_name + '(' + variable_order + '),datetime(Time)),[]).\n' + + // As of initially, positive + code += 'blawx_as_of(' + text_attribute_name + '(' + variable_order + '),datetime(Time)) :- blawx_initially(' + text_attribute_name + '(' + variable_order + ')), BeforeT #< Time,blawx_not_interrupted(datetime(bot),' + text_attribute_name + '(' + variable_order + '),datetime(BeforeT)).\n' + // As of later positive + code += 'blawx_as_of(' + text_attribute_name + '(' + variable_order + '),datetime(Time)) :- blawx_becomes(' + text_attribute_name + '(' + variable_order + '),datetime(BeforeT)),BeforeT #< Time,blawx_not_interrupted(datetime(BeforeT),' + text_attribute_name + '(' + variable_order + '),datetime(Time)).\n' + // As of initially, negative + code += 'blawx_as_of(-' + text_attribute_name + '(' + variable_order + '),datetime(Time)) :- blawx_initially(-' + text_attribute_name + '(' + variable_order + ')), BeforeT #< Time,blawx_not_interrupted(datetime(bot),-' + text_attribute_name + '(' + variable_order + '),datetime(BeforeT)).\n' + // As of later negative + code += 'blawx_as_of(-' + text_attribute_name + '(' + variable_order + '),datetime(Time)) :- blawx_becomes(-' + text_attribute_name + '(' + variable_order + '),datetime(BeforeT)),BeforeT #< Time,blawx_not_interrupted(datetime(BeforeT),-' + text_attribute_name + '(' + variable_order + '),datetime(Time)).\n' + + // During Positive Both + code += 'blawx_during(datetime(Start),' + text_attribute_name + '(' + variable_order + '),datetime(End)) :- blawx_becomes(' + text_attribute_name + '(' + variable_order + '),datetime(Start)), blawx_becomes(-' + text_attribute_name + '(' + variable_order + '),datetime(End)), Start #< End, blawx_not_interrupted(datetime(Start),' + text_attribute_name + '(' + variable_order + '),datetime(End)).\n'; + // During Positive End + code += 'blawx_during(datetime(bot),' + text_attribute_name + '(' + variable_order + '),datetime(End)) :- blawx_initially(' + text_attribute_name + '(' + variable_order + ')), blawx_becomes(-' + text_attribute_name + '(' + variable_order + '),datetime(End)), blawx_not_interrupted(datetime(bot),' + text_attribute_name + '(' + variable_order + '),datetime(End)).\n'; + // During Positive Start + code += 'blawx_during(datetime(Start),' + text_attribute_name + '(' + variable_order + '),datetime(eot)) :- blawx_ultimately(' + text_attribute_name + '(' + variable_order + ')), blawx_becomes(-' + text_attribute_name + '(' + variable_order + '),datetime(Start)), blawx_not_interrupted(datetime(Start),' + text_attribute_name + '(' + variable_order + '),datetime(eot)).\n'; + // During Positive Neither + code += 'blawx_during(datetime(bot),' + text_attribute_name + '(' + variable_order + '),datetime(eot)) :- blawx_initially(' + text_attribute_name + '(' + variable_order + ')), blawx_ultimately(' + text_attribute_name + '(' + variable_order + ')), blawx_becomes(-' + text_attribute_name + '(' + variable_order + '),datetime(Start)), blawx_not_interrupted(datetime(bot),' + text_attribute_name + '(' + variable_order + '),datetime(eot)).\n'; + + // During Negative Both + code += 'blawx_during(datetime(Start),-' + text_attribute_name + '(' + variable_order + '),datetime(End)) :- blawx_becomes(-' + text_attribute_name + '(' + variable_order + '),datetime(Start)), blawx_becomes(' + text_attribute_name + '(' + variable_order + '),datetime(End)), Start #< End, blawx_not_interrupted(datetime(Start),-' + text_attribute_name + '(' + variable_order + '),datetime(End)).\n'; + // During Negative End + code += 'blawx_during(datetime(bot),-' + text_attribute_name + '(' + variable_order + '),datetime(End)) :- blawx_initially(-' + text_attribute_name + '(' + variable_order + ')), blawx_becomes(' + text_attribute_name + '(' + variable_order + '),datetime(End)), blawx_not_interrupted(datetime(bot),-' + text_attribute_name + '(' + variable_order + '),datetime(End)).\n'; + // During Negative Start + code += 'blawx_during(datetime(Start),-' + text_attribute_name + '(' + variable_order + '),datetime(eot)) :- blawx_ultimately(-' + text_attribute_name + '(' + variable_order + ')), blawx_becomes(' + text_attribute_name + '(' + variable_order + '),datetime(Start)), blawx_not_interrupted(datetime(Start),-' + text_attribute_name + '(' + variable_order + '),datetime(eot)).\n'; + // During Negative Neither + code += 'blawx_during(datetime(bot),-' + text_attribute_name + '(' + variable_order + '),datetime(eot)) :- blawx_initially(-' + text_attribute_name + '(' + variable_order + ')), blawx_ultimately(-' + text_attribute_name + '(' + variable_order + ')), blawx_becomes(-' + text_attribute_name + '(' + variable_order + '),datetime(Start)), blawx_not_interrupted(datetime(bot),-' + text_attribute_name + '(' + variable_order + '),datetime(eot)).\n'; } else { // This is for booleans. code += "blawx_attribute_nlg(" + text_attribute_name + ",not_applicable,\"" + text_prefix + "\",not_applicable,\"" + text_postfix + "\").\n" @@ -991,16 +1028,53 @@ sCASP['new_attribute_declaration'] = function(block) { code += '#pred blawx_during(T1,-' + text_attribute_name + "(X),T2) :: 'that it is not the case that " + add_code.trim() + " held between @(T1) and @(T2)'.\n"; code += '#pred blawx_becomes(' + text_attribute_name + "(X),T) :: 'that " + add_code.trim() + " became true at @(T)'.\n"; code += '#pred blawx_becomes(-' + text_attribute_name + "(X),T) :: 'that it is not the case that " + add_code.trim() + " became true at @(T)'.\n"; - code += 'blawx_as_of(' + text_attribute_name + '(X),datetime(Time)) :- blawx_becomes(' + text_attribute_name + '(X),datetime(BeforeT)), not blawx_becomes(-' + text_attribute_name + '(X), datetime(BetweenT)), BeforeT #< Time,BeforeT #< BetweenT, BetweenT #< Time.\n'; - code += 'blawx_as_of(' + text_attribute_name + '(X),datetime(Time)) :- blawx_initially(' + text_attribute_name + '(X)), not blawx_becomes(-' + text_attribute_name + '(X), datetime(BetweenT)), BetweenT #< Time.\n'; - code += 'blawx_during(datetime(Start),' + text_attribute_name + '(X),datetime(End)) :- blawx_becomes(' + text_attribute_name + '(X),datetime(Start)), not blawx_becomes(-' + text_attribute_name + '(X),datetime(BeforeEnd)), blawx_becomes(-' + text_attribute_name + '(X),datetime(End)), BeforeEnd #< End, Start #< End.\n'; - code += 'blawx_during(datetime(bot),' + text_attribute_name + '(X),datetime(End)) :- blawx_initially(' + text_attribute_name + '(X)), not blawx_becomes(-' + text_attribute_name + '(X),datetime(BeforeEnd)), blawx_becomes(-' + text_attribute_name + '(X),datetime(End)), BeforeEnd #< End.\n'; - code += 'blawx_during(datetime(Start),' + text_attribute_name + '(X),datetime(eot)) :- blawx_becomes(' + text_attribute_name + '(X),datetime(Start)), not blawx_becomes(-' + text_attribute_name + '(X),datetime(AfterStart)), blawx_ultimately(' + text_attribute_name + '(X)), AfterStart #> Start.\n'; - code += 'blawx_as_of(-' + text_attribute_name + '(X),datetime(Time)) :- blawx_becomes(-' + text_attribute_name + '(X),datetime(BeforeT)), not blawx_becomes(' + text_attribute_name + '(X), datetime(BetweenT)), BeforeT #< Time,BeforeT #< BetweenT, BetweenT #< Time.\n'; - code += 'blawx_as_of(-' + text_attribute_name + '(X),datetime(Time)) :- blawx_initially(-' + text_attribute_name + '(X)), not blawx_becomes(' + text_attribute_name + '(X), datetime(BetweenT)), BetweenT #< Time.\n'; - code += 'blawx_during(datetime(Start),-' + text_attribute_name + '(X),datetime(End)) :- blawx_becomes(-' + text_attribute_name + '(X),datetime(Start)), not blawx_becomes(' + text_attribute_name + '(X),datetime(BeforeEnd)), blawx_becomes(' + text_attribute_name + '(X),datetime(End)), BeforeEnd #< End, Start #< End.\n'; - code += 'blawx_during(datetime(bot),-' + text_attribute_name + '(X),datetime(End)) :- blawx_initially(-' + text_attribute_name + '(X)), not blawx_becomes(' + text_attribute_name + '(X),datetime(BeforeEnd)), blawx_becomes(' + text_attribute_name + '(X),datetime(End)), BeforeEnd #< End.\n'; - code += 'blawx_during(datetime(Start),-' + text_attribute_name + '(X),datetime(eot)) :- blawx_becomes(-' + text_attribute_name + '(X),datetime(Start)), not blawx_becomes(' + text_attribute_name + '(X),datetime(AfterStart)), blawx_ultimately(-' + text_attribute_name + '(X)), AfterStart #> Start.\n'; + code += '#pred blawx_not_interrupted(Start,' + text_attribute_name + "(X),End) :: '" + add_code.trim() + " remained the case between @(Start) and @(End)'.\n"; + code += '#pred blawx_not_interrupted(Start,-' + text_attribute_name + "(X),End) :: 'it is not the case that " + add_code.trim() + " remained the case between @(Start) and @(End)'.\n"; + + // Generate event reasoning rules. + // Not interrupted positive between + code += 'blawx_not_interrupted(datetime(Start),' + text_attribute_name + '(X),datetime(End)) :- Start \\= bot, End \\= eot, findall(Time,blawx_becomes(-' + text_attribute_name + '(X),datetime(Time)),Times),blawx_list_not_between(Times,Start,End).\n' + // not interrupted negative between + code += 'blawx_not_interrupted(datetime(Start),-' + text_attribute_name + '(X),datetime(End)) :- Start \\= bot, End \\= eot, findall(Time,blawx_becomes(' + text_attribute_name + '(X),datetime(Time)),Times),blawx_list_not_between(Times,Start,End).\n' + // not interrupted positive before end after bot + code += 'blawx_not_interrupted(datetime(bot),' + text_attribute_name + '(X),datetime(End)) :- End \\= eot, findall(Time,blawx_becomes(-' + text_attribute_name + '(X),datetime(Time)),Times),blawx_list_not_before(Times,End).\n' + // not interrupted negative before end after bot + code += 'blawx_not_interrupted(datetime(bot),-' + text_attribute_name + '(X),datetime(End)) :- End \\= eot, findall(Time,blawx_becomes(' + text_attribute_name + '(X),datetime(Time)),Times),blawx_list_not_before(Times,End).\n' + // not interrupted positive before eot after start + code += 'blawx_not_interrupted(datetime(Start),' + text_attribute_name + '(X),datetime(eot)) :- Start \\= bot, findall(Time,blawx_becomes(-' + text_attribute_name + '(X),datetime(Time)),Times),blawx_list_not_after(Times,Start).\n' + // not interrupted negative before eot after start + code += 'blawx_not_interrupted(datetime(Start),-' + text_attribute_name + '(X),datetime(eot)) :- Start \\= bot, findall(Time,blawx_becomes(' + text_attribute_name + '(X),datetime(Time)),Times),blawx_list_not_after(Times,Start).\n' + // not interrupted positive ever + code += 'blawx_not_interrupted(datetime(bot),' + text_attribute_name + '(X),datetime(eot)) :- blawx_initially(' + text_attribute_name + '(X)), blawx_ultimately(' + text_attribute_name + '(X)), findall(Time,blawx_becomes(-' + text_attribute_name + '(X),datetime(Time)),[]).\n' + // not interrupted negative ever + code += 'blawx_not_interrupted(datetime(bot),-' + text_attribute_name + '(X),datetime(eot)) :- blawx_initially(-' + text_attribute_name + '(X)), blawx_ultimately(-' + text_attribute_name + '(X)), findall(Time,blawx_becomes(' + text_attribute_name + '(X),datetime(Time)),[]).\n' + + // As of initially, positive + code += 'blawx_as_of(' + text_attribute_name + '(X),datetime(Time)) :- blawx_initially(' + text_attribute_name + '(X)), BeforeT #< Time,blawx_not_interrupted(datetime(bot),' + text_attribute_name + '(X),datetime(BeforeT)).\n' + // As of later positive + code += 'blawx_as_of(' + text_attribute_name + '(X),datetime(Time)) :- blawx_becomes(' + text_attribute_name + '(X),datetime(BeforeT)),BeforeT #< Time,blawx_not_interrupted(datetime(BeforeT),' + text_attribute_name + '(X),datetime(Time)).\n' + // As of initially, negative + code += 'blawx_as_of(-' + text_attribute_name + '(X),datetime(Time)) :- blawx_initially(-' + text_attribute_name + '(X)), BeforeT #< Time,blawx_not_interrupted(datetime(bot),-' + text_attribute_name + '(X),datetime(BeforeT)).\n' + // As of later negative + code += 'blawx_as_of(-' + text_attribute_name + '(X),datetime(Time)) :- blawx_becomes(-' + text_attribute_name + '(X),datetime(BeforeT)),BeforeT #< Time,blawx_not_interrupted(datetime(BeforeT),-' + text_attribute_name + '(X),datetime(Time)).\n' + + // During Positive Both + code += 'blawx_during(datetime(Start),' + text_attribute_name + '(X),datetime(End)) :- blawx_becomes(' + text_attribute_name + '(X),datetime(Start)), blawx_becomes(-' + text_attribute_name + '(X),datetime(End)), Start #< End, blawx_not_interrupted(datetime(Start),' + text_attribute_name + '(X),datetime(End)).\n'; + // During Positive End + code += 'blawx_during(datetime(bot),' + text_attribute_name + '(X),datetime(End)) :- blawx_initially(' + text_attribute_name + '(X)), blawx_becomes(-' + text_attribute_name + '(X),datetime(End)), blawx_not_interrupted(datetime(bot),' + text_attribute_name + '(X),datetime(End)).\n'; + // During Positive Start + code += 'blawx_during(datetime(Start),' + text_attribute_name + '(X),datetime(eot)) :- blawx_ultimately(' + text_attribute_name + '(X)), blawx_becomes(-' + text_attribute_name + '(X),datetime(Start)), blawx_not_interrupted(datetime(Start),' + text_attribute_name + '(X),datetime(eot)).\n'; + // During Positive Neither + code += 'blawx_during(datetime(bot),' + text_attribute_name + '(X),datetime(eot)) :- blawx_initially(' + text_attribute_name + '(X)), blawx_ultimately(' + text_attribute_name + '(X)), blawx_becomes(-' + text_attribute_name + '(X),datetime(Start)), blawx_not_interrupted(datetime(bot),' + text_attribute_name + '(X),datetime(eot)).\n'; + + // During Negative Both + code += 'blawx_during(datetime(Start),-' + text_attribute_name + '(X),datetime(End)) :- blawx_becomes(-' + text_attribute_name + '(X),datetime(Start)), blawx_becomes(' + text_attribute_name + '(X),datetime(End)), Start #< End, blawx_not_interrupted(datetime(Start),-' + text_attribute_name + '(X),datetime(End)).\n'; + // During Negative End + code += 'blawx_during(datetime(bot),-' + text_attribute_name + '(X),datetime(End)) :- blawx_initially(-' + text_attribute_name + '(X)), blawx_becomes(' + text_attribute_name + '(X),datetime(End)), blawx_not_interrupted(datetime(bot),-' + text_attribute_name + '(X),datetime(End)).\n'; + // During Negative Start + code += 'blawx_during(datetime(Start),-' + text_attribute_name + '(X),datetime(eot)) :- blawx_ultimately(-' + text_attribute_name + '(X)), blawx_becomes(' + text_attribute_name + '(X),datetime(Start)), blawx_not_interrupted(datetime(Start),-' + text_attribute_name + '(X),datetime(eot)).\n'; + // During Negative Neither + code += 'blawx_during(datetime(bot),-' + text_attribute_name + '(X),datetime(eot)) :- blawx_initially(-' + text_attribute_name + '(X)), blawx_ultimately(-' + text_attribute_name + '(X)), blawx_becomes(-' + text_attribute_name + '(X),datetime(Start)), blawx_not_interrupted(datetime(bot),-' + text_attribute_name + '(X),datetime(eot)).\n'; } return code; }; @@ -1033,16 +1107,54 @@ sCASP['new_category_declaration'] = function(block) { code += '#pred blawx_during(T1,-' + text_category_name + "(X),T2) :: 'that it is not the case that " + add_code.trim() + " held between @(T1) and @(T2)'.\n"; code += '#pred blawx_becomes(' + text_category_name + "(X),T) :: 'that " + add_code.trim() + " became true at @(T)'.\n"; code += '#pred blawx_becomes(-' + text_category_name + "(X),T) :: 'that it is not the case that " + add_code.trim() + " became true at @(T)'.\n"; - code += 'blawx_as_of(' + text_category_name + '(X),datetime(Time)) :- blawx_becomes(' + text_category_name + '(X),datetime(BeforeT)), not blawx_becomes(-' + text_category_name + '(X), datetime(BetweenT)), BeforeT #< Time,BeforeT #< BetweenT, BetweenT #< Time.\n'; - code += 'blawx_as_of(' + text_category_name + '(X),datetime(Time)) :- blawx_initially(' + text_category_name + '(X)), not blawx_becomes(-' + text_category_name + '(X), datetime(BetweenT)), BetweenT #< Time.\n'; - code += 'blawx_during(datetime(Start),' + text_category_name + '(X),datetime(End)) :- blawx_becomes(' + text_category_name + '(X),datetime(Start)), not blawx_becomes(-' + text_category_name + '(X),datetime(BeforeEnd)), blawx_becomes(-' + text_category_name + '(X),datetime(End)), BeforeEnd #< End, Start #< End.\n'; - code += 'blawx_during(datetime(bot),' + text_category_name + '(X),datetime(End)) :- blawx_initially(' + text_category_name + '(X)), not blawx_becomes(-' + text_category_name + '(X),datetime(BeforeEnd)), blawx_becomes(-' + text_category_name + '(X),datetime(End)), BeforeEnd #< End.\n'; - code += 'blawx_during(datetime(Start),' + text_category_name + '(X),datetime(eot)) :- blawx_becomes(' + text_category_name + '(X),datetime(Start)), not blawx_becomes(-' + text_category_name + '(X),datetime(AfterStart)), blawx_ultimately(' + text_category_name + '(X)), AfterStart #> Start.\n'; - code += 'blawx_as_of(-' + text_category_name + '(X),datetime(Time)) :- blawx_becomes(-' + text_category_name + '(X),datetime(BeforeT)), not blawx_becomes(' + text_category_name + '(X), datetime(BetweenT)), BeforeT #< Time,BeforeT #< BetweenT, BetweenT #< Time.\n'; - code += 'blawx_as_of(-' + text_category_name + '(X),datetime(Time)) :- blawx_initially(-' + text_category_name + '(X)), not blawx_becomes(' + text_category_name + '(X), datetime(BetweenT)), BetweenT #< Time.\n'; - code += 'blawx_during(datetime(Start),-' + text_category_name + '(X),datetime(End)) :- blawx_becomes(-' + text_category_name + '(X),datetime(Start)), not blawx_becomes(' + text_category_name + '(X),datetime(BeforeEnd)), blawx_becomes(' + text_category_name + '(X),datetime(End)), BeforeEnd #< End, Start #< End.\n'; - code += 'blawx_during(datetime(bot),-' + text_category_name + '(X),datetime(End)) :- blawx_initially(-' + text_category_name + '(X)), not blawx_becomes(' + text_category_name + '(X),datetime(BeforeEnd)), blawx_becomes(' + text_category_name + '(X),datetime(End)), BeforeEnd #< End.\n'; - code += 'blawx_during(datetime(Start),-' + text_category_name + '(X),datetime(eot)) :- blawx_becomes(-' + text_category_name + '(X),datetime(Start)), not blawx_becomes(' + text_category_name + '(X),datetime(AfterStart)), blawx_ultimately(-' + text_category_name + '(X)), AfterStart #> Start.\n'; + code += '#pred blawx_not_interrupted(Start,' + text_category_name + "(X),End) :: '" + add_code.trim() + " remained the case between @(Start) and @(End)'.\n"; + code += '#pred blawx_not_interrupted(Start,-' + text_category_name + "(X),End) :: 'it is not the case that " + add_code.trim() + " remained the case between @(Start) and @(End)'.\n"; + + // Generate event reasoning rules. + // Not interrupted positive between + code += 'blawx_not_interrupted(datetime(Start),' + text_category_name + '(X),datetime(End)) :- Start \\= bot, End \\= eot, findall(Time,blawx_becomes(-' + text_category_name + '(X),datetime(Time)),Times),blawx_list_not_between(Times,Start,End).\n' + // not interrupted negative between + code += 'blawx_not_interrupted(datetime(Start),-' + text_category_name + '(X),datetime(End)) :- Start \\= bot, End \\= eot, findall(Time,blawx_becomes(' + text_category_name + '(X),datetime(Time)),Times),blawx_list_not_between(Times,Start,End).\n' + // not interrupted positive before end after bot + code += 'blawx_not_interrupted(datetime(bot),' + text_category_name + '(X),datetime(End)) :- End \\= eot, findall(Time,blawx_becomes(-' + text_category_name + '(X),datetime(Time)),Times),blawx_list_not_before(Times,End).\n' + // not interrupted negative before end after bot + code += 'blawx_not_interrupted(datetime(bot),-' + text_category_name + '(X),datetime(End)) :- End \\= eot, findall(Time,blawx_becomes(' + text_category_name + '(X),datetime(Time)),Times),blawx_list_not_before(Times,End).\n' + // not interrupted positive before eot after start + code += 'blawx_not_interrupted(datetime(Start),' + text_category_name + '(X),datetime(eot)) :- Start \\= bot, findall(Time,blawx_becomes(-' + text_category_name + '(X),datetime(Time)),Times),blawx_list_not_after(Times,Start).\n' + // not interrupted negative before eot after start + code += 'blawx_not_interrupted(datetime(Start),-' + text_category_name + '(X),datetime(eot)) :- Start \\= bot, findall(Time,blawx_becomes(' + text_category_name + '(X),datetime(Time)),Times),blawx_list_not_after(Times,Start).\n' + // not interrupted positive ever + code += 'blawx_not_interrupted(datetime(bot),' + text_category_name + '(X),datetime(eot)) :- blawx_initially(' + text_category_name + '(X)), blawx_ultimately(' + text_category_name + '(X)), findall(Time,blawx_becomes(-' + text_category_name + '(X),datetime(Time)),[]).\n' + // not interrupted negative ever + code += 'blawx_not_interrupted(datetime(bot),-' + text_category_name + '(X),datetime(eot)) :- blawx_initially(-' + text_category_name + '(X)), blawx_ultimately(-' + text_category_name + '(X)), findall(Time,blawx_becomes(' + text_category_name + '(X),datetime(Time)),[]).\n' + + // As of initially, positive + code += 'blawx_as_of(' + text_category_name + '(X),datetime(Time)) :- blawx_initially(' + text_category_name + '(X)), BeforeT #< Time,blawx_not_interrupted(datetime(bot),' + text_category_name + '(X),datetime(BeforeT)).\n' + // As of later positive + code += 'blawx_as_of(' + text_category_name + '(X),datetime(Time)) :- blawx_becomes(' + text_category_name + '(X),datetime(BeforeT)),BeforeT #< Time,blawx_not_interrupted(datetime(BeforeT),' + text_category_name + '(X),datetime(Time)).\n' + // As of initially, negative + code += 'blawx_as_of(-' + text_category_name + '(X),datetime(Time)) :- blawx_initially(-' + text_category_name + '(X)), BeforeT #< Time,blawx_not_interrupted(datetime(bot),-' + text_category_name + '(X),datetime(BeforeT)).\n' + // As of later negative + code += 'blawx_as_of(-' + text_category_name + '(X),datetime(Time)) :- blawx_becomes(-' + text_category_name + '(X),datetime(BeforeT)),BeforeT #< Time,blawx_not_interrupted(datetime(BeforeT),-' + text_category_name + '(X),datetime(Time)).\n' + + // During Positive Both + code += 'blawx_during(datetime(Start),' + text_category_name + '(X),datetime(End)) :- blawx_becomes(' + text_category_name + '(X),datetime(Start)), blawx_becomes(-' + text_category_name + '(X),datetime(End)), Start #< End, blawx_not_interrupted(datetime(Start),' + text_category_name + '(X),datetime(End)).\n'; + // During Positive End + code += 'blawx_during(datetime(bot),' + text_category_name + '(X),datetime(End)) :- blawx_initially(' + text_category_name + '(X)), blawx_becomes(-' + text_category_name + '(X),datetime(End)), blawx_not_interrupted(datetime(bot),' + text_category_name + '(X),datetime(End)).\n'; + // During Positive Start + code += 'blawx_during(datetime(Start),' + text_category_name + '(X),datetime(eot)) :- blawx_ultimately(' + text_category_name + '(X)), blawx_becomes(-' + text_category_name + '(X),datetime(Start)), blawx_not_interrupted(datetime(Start),' + text_category_name + '(X),datetime(eot)).\n'; + // During Positive Neither + code += 'blawx_during(datetime(bot),' + text_category_name + '(X),datetime(eot)) :- blawx_initially(' + text_category_name + '(X)), blawx_ultimately(' + text_category_name + '(X)), blawx_becomes(-' + text_category_name + '(X),datetime(Start)), blawx_not_interrupted(datetime(bot),' + text_category_name + '(X),datetime(eot)).\n'; + + // During Negative Both + code += 'blawx_during(datetime(Start),-' + text_category_name + '(X),datetime(End)) :- blawx_becomes(-' + text_category_name + '(X),datetime(Start)), blawx_becomes(' + text_category_name + '(X),datetime(End)), Start #< End, blawx_not_interrupted(datetime(Start),-' + text_category_name + '(X),datetime(End)).\n'; + // During Negative End + code += 'blawx_during(datetime(bot),-' + text_category_name + '(X),datetime(End)) :- blawx_initially(-' + text_category_name + '(X)), blawx_becomes(' + text_category_name + '(X),datetime(End)), blawx_not_interrupted(datetime(bot),-' + text_category_name + '(X),datetime(End)).\n'; + // During Negative Start + code += 'blawx_during(datetime(Start),-' + text_category_name + '(X),datetime(eot)) :- blawx_ultimately(-' + text_category_name + '(X)), blawx_becomes(' + text_category_name + '(X),datetime(Start)), blawx_not_interrupted(datetime(Start),-' + text_category_name + '(X),datetime(eot)).\n'; + // During Negative Neither + code += 'blawx_during(datetime(bot),-' + text_category_name + '(X),datetime(eot)) :- blawx_initially(-' + text_category_name + '(X)), blawx_ultimately(-' + text_category_name + '(X)), blawx_becomes(-' + text_category_name + '(X),datetime(Start)), blawx_not_interrupted(datetime(bot),-' + text_category_name + '(X),datetime(eot)).\n'; + return code; }; @@ -1297,17 +1409,54 @@ sCASP['relationship_declaration'] = function(block) { code += '#pred blawx_during(T1,-' + text_relationship_name + '(' + parameters + "),T2) :: 'that it is not the case that " + add_code.trim() + " held between @(T1) and @(T2)'.\n"; code += '#pred blawx_becomes(' + text_relationship_name + '(' + parameters + "),T) :: 'that " + add_code.trim() + " became true at @(T)'.\n"; code += '#pred blawx_becomes(-' + text_relationship_name + '(' + parameters + "),T) :: 'that it is not the case that " + add_code.trim() + " became true at @(T)'.\n"; + code += '#pred blawx_not_interrupted(Start,' + text_relationship_name + '(' + parameters + "),End) :: '" + add_code.trim() + " remained the case between @(Start) and @(End)'.\n"; + code += '#pred blawx_not_interrupted(Start,-' + text_relationship_name + '(' + parameters + "),End) :: 'it is not the case that " + add_code.trim() + " remained the case between @(Start) and @(End)'.\n"; + // Generate event reasoning rules. - code += 'blawx_as_of(' + text_relationship_name + '(' + parameters + '),datetime(Time)) :- blawx_becomes(' + text_relationship_name + '(' + parameters + '),datetime(BeforeT)), not blawx_becomes(-' + text_relationship_name + '(' + parameters + '), datetime(BetweenT)), BeforeT #< Time,BeforeT #< BetweenT, BetweenT #< Time.\n'; - code += 'blawx_as_of(' + text_relationship_name + '(' + parameters + '),datetime(Time)) :- blawx_initially(' + text_relationship_name + '(' + parameters + ')), not blawx_becomes(-' + text_relationship_name + '(' + parameters + '), datetime(BetweenT)), BetweenT #< Time.\n'; - code += 'blawx_during(datetime(Start),' + text_relationship_name + '(' + parameters + '),datetime(End)) :- blawx_becomes(' + text_relationship_name + '(' + parameters + '),datetime(Start)), not blawx_becomes(-' + text_relationship_name + '(' + parameters + '),datetime(BeforeEnd)), blawx_becomes(-' + text_relationship_name + '(' + parameters + '),datetime(End)), BeforeEnd #< End, Start #< End.\n'; - code += 'blawx_during(datetime(bot),' + text_relationship_name + '(' + parameters + '),datetime(End)) :- blawx_initially(' + text_relationship_name + '(' + parameters + ')), not blawx_becomes(-' + text_relationship_name + '(' + parameters + '),datetime(BeforeEnd)), blawx_becomes(-' + text_relationship_name + '(' + parameters + '),datetime(End)), BeforeEnd #< End.\n'; - code += 'blawx_during(datetime(Start),' + text_relationship_name + '(' + parameters + '),datetime(eot)) :- blawx_becomes(' + text_relationship_name + '(' + parameters + '),datetime(Start)), not blawx_becomes(-' + text_relationship_name + '(' + parameters + '),datetime(AfterStart)), blawx_ultimately(' + text_relationship_name + '(' + parameters + ')), AfterStart #> Start.\n'; - code += 'blawx_as_of(-' + text_relationship_name + '(' + parameters + '),datetime(Time)) :- blawx_becomes(-' + text_relationship_name + '(' + parameters + '),datetime(BeforeT)), not blawx_becomes(' + text_relationship_name + '(' + parameters + '), datetime(BetweenT)), BeforeT #< Time,BeforeT #< BetweenT, BetweenT #< Time.\n'; - code += 'blawx_as_of(-' + text_relationship_name + '(' + parameters + '),datetime(Time)) :- blawx_initially(-' + text_relationship_name + '(' + parameters + ')), not blawx_becomes(' + text_relationship_name + '(' + parameters + '), datetime(BetweenT)), BetweenT #< Time.\n'; - code += 'blawx_during(datetime(Start),-' + text_relationship_name + '(' + parameters + '),datetime(End)) :- blawx_becomes(-' + text_relationship_name + '(' + parameters + '),datetime(Start)), not blawx_becomes(' + text_relationship_name + '(' + parameters + '),datetime(BeforeEnd)), blawx_becomes(' + text_relationship_name + '(' + parameters + '),datetime(End)), BeforeEnd #< End, Start #< End.\n'; - code += 'blawx_during(datetime(bot),-' + text_relationship_name + '(' + parameters + '),datetime(End)) :- blawx_initially(-' + text_relationship_name + '(' + parameters + ')), not blawx_becomes(' + text_relationship_name + '(' + parameters + '),datetime(BeforeEnd)), blawx_becomes(' + text_relationship_name + '(' + parameters + '),datetime(End)), BeforeEnd #< End.\n'; - code += 'blawx_during(datetime(Start),-' + text_relationship_name + '(' + parameters + '),datetime(eot)) :- blawx_becomes(-' + text_relationship_name + '(' + parameters + '),datetime(Start)), not blawx_becomes(' + text_relationship_name + '(' + parameters + '),datetime(AfterStart)), blawx_ultimately(-' + text_relationship_name + '(' + parameters + ')), AfterStart #> Start.\n'; + // Not interrupted positive between + code += 'blawx_not_interrupted(datetime(Start),' + text_relationship_name + '(' + parameters + '),datetime(End)) :- Start \\= bot, End \\= eot, findall(Time,blawx_becomes(-' + text_relationship_name + '(' + parameters + '),datetime(Time)),Times),blawx_list_not_between(Times,Start,End).\n' + // not interrupted negative between + code += 'blawx_not_interrupted(datetime(Start),-' + text_relationship_name + '(' + parameters + '),datetime(End)) :- Start \\= bot, End \\= eot, findall(Time,blawx_becomes(' + text_relationship_name + '(' + parameters + '),datetime(Time)),Times),blawx_list_not_between(Times,Start,End).\n' + // not interrupted positive before end after bot + code += 'blawx_not_interrupted(datetime(bot),' + text_relationship_name + '(' + parameters + '),datetime(End)) :- End \\= eot, findall(Time,blawx_becomes(-' + text_relationship_name + '(' + parameters + '),datetime(Time)),Times),blawx_list_not_before(Times,End).\n' + // not interrupted negative before end after bot + code += 'blawx_not_interrupted(datetime(bot),-' + text_relationship_name + '(' + parameters + '),datetime(End)) :- End \\= eot, findall(Time,blawx_becomes(' + text_relationship_name + '(' + parameters + '),datetime(Time)),Times),blawx_list_not_before(Times,End).\n' + // not interrupted positive before eot after start + code += 'blawx_not_interrupted(datetime(Start),' + text_relationship_name + '(' + parameters + '),datetime(eot)) :- Start \\= bot, findall(Time,blawx_becomes(-' + text_relationship_name + '(' + parameters + '),datetime(Time)),Times),blawx_list_not_after(Times,Start).\n' + // not interrupted negative before eot after start + code += 'blawx_not_interrupted(datetime(Start),-' + text_relationship_name + '(' + parameters + '),datetime(eot)) :- Start \\= bot, findall(Time,blawx_becomes(' + text_relationship_name + '(' + parameters + '),datetime(Time)),Times),blawx_list_not_after(Times,Start).\n' + // not interrupted positive ever + code += 'blawx_not_interrupted(datetime(bot),' + text_relationship_name + '(' + parameters + '),datetime(eot)) :- blawx_initially(' + text_relationship_name + '(' + parameters + ')), blawx_ultimately(' + text_relationship_name + '(' + parameters + ')), findall(Time,blawx_becomes(-' + text_relationship_name + '(' + parameters + '),datetime(Time)),[]).\n' + // not interrupted negative ever + code += 'blawx_not_interrupted(datetime(bot),-' + text_relationship_name + '(' + parameters + '),datetime(eot)) :- blawx_initially(-' + text_relationship_name + '(' + parameters + ')), blawx_ultimately(-' + text_relationship_name + '(' + parameters + ')), findall(Time,blawx_becomes(' + text_relationship_name + '(' + parameters + '),datetime(Time)),[]).\n' + + // As of initially, positive + code += 'blawx_as_of(' + text_relationship_name + '(' + parameters + '),datetime(Time)) :- blawx_initially(' + text_relationship_name + '(' + parameters + ')), BeforeT #< Time,blawx_not_interrupted(datetime(bot),' + text_relationship_name + '(' + parameters + '),datetime(BeforeT)).\n' + // As of later positive + code += 'blawx_as_of(' + text_relationship_name + '(' + parameters + '),datetime(Time)) :- blawx_becomes(' + text_relationship_name + '(' + parameters + '),datetime(BeforeT)),BeforeT #< Time,blawx_not_interrupted(datetime(BeforeT),' + text_relationship_name + '(' + parameters + '),datetime(Time)).\n' + // As of initially, negative + code += 'blawx_as_of(-' + text_relationship_name + '(' + parameters + '),datetime(Time)) :- blawx_initially(-' + text_relationship_name + '(' + parameters + ')), BeforeT #< Time,blawx_not_interrupted(datetime(bot),-' + text_relationship_name + '(' + parameters + '),datetime(BeforeT)).\n' + // As of later negative + code += 'blawx_as_of(-' + text_relationship_name + '(' + parameters + '),datetime(Time)) :- blawx_becomes(-' + text_relationship_name + '(' + parameters + '),datetime(BeforeT)),BeforeT #< Time,blawx_not_interrupted(datetime(BeforeT),-' + text_relationship_name + '(' + parameters + '),datetime(Time)).\n' + + // During Positive Both + code += 'blawx_during(datetime(Start),' + text_relationship_name + '(' + parameters + '),datetime(End)) :- blawx_becomes(' + text_relationship_name + '(' + parameters + '),datetime(Start)), blawx_becomes(-' + text_relationship_name + '(' + parameters + '),datetime(End)), Start #< End, blawx_not_interrupted(datetime(Start),' + text_relationship_name + '(' + parameters + '),datetime(End)).\n'; + // During Positive End + code += 'blawx_during(datetime(bot),' + text_relationship_name + '(' + parameters + '),datetime(End)) :- blawx_initially(' + text_relationship_name + '(' + parameters + ')), blawx_becomes(-' + text_relationship_name + '(' + parameters + '),datetime(End)), blawx_not_interrupted(datetime(bot),' + text_relationship_name + '(' + parameters + '),datetime(End)).\n'; + // During Positive Start + code += 'blawx_during(datetime(Start),' + text_relationship_name + '(' + parameters + '),datetime(eot)) :- blawx_ultimately(' + text_relationship_name + '(' + parameters + ')), blawx_becomes(-' + text_relationship_name + '(' + parameters + '),datetime(Start)), blawx_not_interrupted(datetime(Start),' + text_relationship_name + '(' + parameters + '),datetime(eot)).\n'; + // During Positive Neither + code += 'blawx_during(datetime(bot),' + text_relationship_name + '(' + parameters + '),datetime(eot)) :- blawx_initially(' + text_relationship_name + '(' + parameters + ')), blawx_ultimately(' + text_relationship_name + '(' + parameters + ')), blawx_becomes(-' + text_relationship_name + '(' + parameters + '),datetime(Start)), blawx_not_interrupted(datetime(bot),' + text_relationship_name + '(' + parameters + '),datetime(eot)).\n'; + + // During Negative Both + code += 'blawx_during(datetime(Start),-' + text_relationship_name + '(' + parameters + '),datetime(End)) :- blawx_becomes(-' + text_relationship_name + '(' + parameters + '),datetime(Start)), blawx_becomes(' + text_relationship_name + '(' + parameters + '),datetime(End)), Start #< End, blawx_not_interrupted(datetime(Start),-' + text_relationship_name + '(' + parameters + '),datetime(End)).\n'; + // During Negative End + code += 'blawx_during(datetime(bot),-' + text_relationship_name + '(' + parameters + '),datetime(End)) :- blawx_initially(-' + text_relationship_name + '(' + parameters + ')), blawx_becomes(' + text_relationship_name + '(' + parameters + '),datetime(End)), blawx_not_interrupted(datetime(bot),-' + text_relationship_name + '(' + parameters + '),datetime(End)).\n'; + // During Negative Start + code += 'blawx_during(datetime(Start),-' + text_relationship_name + '(' + parameters + '),datetime(eot)) :- blawx_ultimately(-' + text_relationship_name + '(' + parameters + ')), blawx_becomes(' + text_relationship_name + '(' + parameters + '),datetime(Start)), blawx_not_interrupted(datetime(Start),-' + text_relationship_name + '(' + parameters + '),datetime(eot)).\n'; + // During Negative Neither + code += 'blawx_during(datetime(bot),-' + text_relationship_name + '(' + parameters + '),datetime(eot)) :- blawx_initially(-' + text_relationship_name + '(' + parameters + ')), blawx_ultimately(-' + text_relationship_name + '(' + parameters + ')), blawx_becomes(-' + text_relationship_name + '(' + parameters + '),datetime(Start)), blawx_not_interrupted(datetime(bot),-' + text_relationship_name + '(' + parameters + '),datetime(eot)).\n'; + return code; }; diff --git a/blawx/templates/blawx/scenario_editor.html b/blawx/templates/blawx/scenario_editor.html index 6d2997b5..00e7cd9c 100644 --- a/blawx/templates/blawx/scenario_editor.html +++ b/blawx/templates/blawx/scenario_editor.html @@ -210,7 +210,8 @@
Response
'is', 'date_add', 'date_compare', - 'duration_compare']; + 'duration_compare', + 'blawx_list_not_between']; function getNodeName(node,answer,explanation) { var node_name = ""; @@ -550,6 +551,10 @@
Response
return "ultimately, " + answerNLG(model.args[0],human); } else if (model.functor == "blawx_during") { return "from " + displayValue(model.args[0],human) + " to " + displayValue(model.args[2],human) + " " + answerNLG(model.args[1],human); + } else if (model.functor == "blawx_not_interrupted") { + return "between " + displayValue(model.args[0],human) + " and " + displayValue(model.args[2],human) + " it remained the case that " + answerNLG(model.args[1],human); + } else if (model.functor == "blawx_list_not_between") { + return displayValue(model.args[0],human) + " doesn't include elements between " + displayValue(model.args[1],human) + " and " + displayValue(model.args[2],human); } else if (model.functor == "abduced" && model.args[0].functor != "-") { return "it is hypothesized that " + answerNLG(model.args[0],human); } else if (model.functor == "abduced" && model.args[0].functor == "-") { diff --git a/blawx/templates/blawx/scenario_editor_gcweb.html b/blawx/templates/blawx/scenario_editor_gcweb.html new file mode 100644 index 00000000..ede4a2f1 --- /dev/null +++ b/blawx/templates/blawx/scenario_editor_gcweb.html @@ -0,0 +1,2230 @@ + +{% extends "gcweb.html" %} + +{% load guardian_tags %} +{% block breadcrumb %} + +{% endblock %} + +{% block main_content_card %} +{% get_obj_perms request.user for blawxtest as 'blawxtest_perms' %} + +
+ + + +
+ + + {% endblock %} \ No newline at end of file diff --git a/blawx/templates/gcweb.html b/blawx/templates/gcweb.html new file mode 100644 index 00000000..5a8d0547 --- /dev/null +++ b/blawx/templates/gcweb.html @@ -0,0 +1,332 @@ +{% load static %} + + + + + +Content page - Canada.ca + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+

Language selection

+ +
+ + + + + + +
+

Search

+
+
+ + + +
+
+ +
+
+
+ + +
+
+
+ + + + +
+ +
+ {% block breadcrumb %} + +{% endblock breadcrumb %} +{% block main_content_card %} +

Content page

+

From [Institution name]

+ +
+

Heading 2 (h2)

+
+

Heading 3 (h3)

+
+

Heading 4 (h4)

+
+
Heading 5 (h5)
+
+
Heading 6 (h6)
+

Paragraph - default appearance

+
+
+
+
+
+

Link

+
    +
  • unordered list (ul) - level 1 +
      +
    • unordered list (ul) - level 2 +
        +
      • unordered list (ul) - level 3
      • +
      +
    • +
    +
  • +
+
    +
  1. ordered list (ol) - level 1
  2. +
  3. ordered list (ol) - level 1 +
      +
    1. ordered list (ol) - level 2
    2. +
    3. ordered list (ol) - level 2 +
        +
      1. ordered list (ol) - level 3
      2. +
      3. ordered list (ol) - level 3
      4. +
      +
    4. +
    +
  4. +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Table caption
Table header (th)Table header (th)Table header (th)Table header (th)
Table data (td)Table data (td)Table data (td)Table data (td)
Table data (td)Table data (td)Table data (td)Table data (td)
Table data (td)Table data (td)Table data (td)Table data (td)
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+
+
+

"blockquote"

+
footer cite
+
+ +

Section with limited width content

+

Add the CSS class name .cnt-wdth-lmtd to a sectioning element <section class="cnt-wdth-lmtd">...<section> inside the main content of your page. More guidance are provided in the Content and IA specification.

+
+

Section example with limited width content

+

Different example text. Different example text. Different example text. Different example text. Different example text. Different example text. Different example text. Different example text.

+
+

Call to action button

+

Add the CSS class name .btn-call-to-action to a your button or link that define the main call for action for a page. For example the initiation button/link in a service initiation pages. More guidance are provided in the Content and IA specification.

+
+
+

Link

+

[Call to action]

+
<p><a class="btn btn-call-to-action" href="#">[Call to action]</a></p>
+
+
+

Button

+ +
<button class="btn btn-call-to-action" type="button">[Call to action]</button>
+
+
+{% endblock main_content_card %} +
+

Page details

+
+
Date modified:
+
+
+
+
+
+ +
+ + + + + + + + diff --git a/blawx/urls.py b/blawx/urls.py index f70615c5..20923733 100644 --- a/blawx/urls.py +++ b/blawx/urls.py @@ -33,6 +33,7 @@ path('/test//interview/',reasoner.interview, name="test_interview"), path('/test//bot/',views.BlawxBot.as_view(), name="blawx_bot"), path('/test//scenario/',views.ScenarioEditor.as_view(), name="scenario_editor"), + path('/test//scenario_gcweb/',views.ScenarioEditorGCWeb.as_view(), name="scenario_editor_gcweb"), path('//update/', views.update_code, name="update_workspace_code"), path('/all/get/', views.get_all_code, name="get_all_workspaces_code"), path('//get/', views.get_code, name="get_workspace_code"), diff --git a/blawx/views.py b/blawx/views.py index 88e141d4..1be4dabd 100644 --- a/blawx/views.py +++ b/blawx/views.py @@ -219,6 +219,20 @@ def get_context_data(self, **kwargs): context['ruledoc_list'] = RuleDoc.objects.all() return context +class ScenarioEditorGCWeb(PermissionRequiredMixin, generic.DetailView): + permission_required = "blawx.view_blawxtest" + template_name = "blawx/scenario_editor_gcweb.html" + model = BlawxTest + + def get_object(self): + return BlawxTest.objects.get(ruledoc=RuleDoc.objects.get(pk=self.kwargs['ruledoc']),test_name=self.kwargs['test_name']) + + def get_context_data(self, **kwargs): + context = super(ScenarioEditorGCWeb, self).get_context_data(**kwargs) + context['ruledoc_list'] = RuleDoc.objects.all() + return context + + class TestCreateView(PermissionRequiredMixin, CreateView): permission_required = "blawx.add_blawxtest_to_ruledoc" model = BlawxTest