-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixing universal statements and adding steps case
- Loading branch information
Showing
4 changed files
with
364 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.2.4 | ||
1.2.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,231 @@ | ||
PREFIX : <https://eyereasoner.github.io/lingua/etc/steps.trig#> | ||
PREFIX lingua: <http://www.w3.org/2000/10/swap/lingua#> | ||
PREFIX log: <http://www.w3.org/2000/10/swap/log#> | ||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
PREFIX list: <http://www.w3.org/2000/10/swap/list#> | ||
PREFIX vcard: <http://www.w3.org/2006/vcard/ns#> | ||
|
||
:model :is (_:bng_1 _:bng_2). | ||
:model :is (_:bng_1 _:bng_3 _:bng_2). | ||
|
||
# | ||
# lingua explanation | ||
# | ||
|
||
_:bng_4 lingua:explanation _:bng_5. | ||
_:bng_6 lingua:explanation _:bng_7. | ||
_:bng_8 lingua:explanation _:bng_9. | ||
_:bng_9 lingua:explanation _:bng_10. | ||
_:bng_4 lingua:explanation _:bng_11. | ||
_:bng_12 lingua:explanation _:bng_13. | ||
_:bng_14 lingua:explanation _:bng_15. | ||
_:bng_16 lingua:explanation _:bng_17. | ||
_:bng_17 lingua:explanation _:bng_18. | ||
|
||
GRAPH _:bng_19 { | ||
:Pat a vcard:Individual. | ||
:Pat :canDo :E. | ||
} | ||
|
||
GRAPH _:bng_20 { | ||
_:bng_24 log:sequent (_:bng_1 _:bng_25). | ||
} | ||
|
||
GRAPH _:bng_21 { | ||
_:bng_22 log:sequent (_:bng_2 _:bng_3). | ||
} | ||
|
||
GRAPH _:bng_1 { | ||
:Pat :canDo :A. | ||
} | ||
|
||
GRAPH _:bng_2 { | ||
:Pat :canDo :E. | ||
} | ||
|
||
GRAPH _:bng_27 { | ||
_:bng_28 log:sequent (_:bng_2 _:bng_29). | ||
} | ||
|
||
GRAPH _:bng_3 { | ||
:Pat :canDo :D. | ||
} | ||
|
||
GRAPH _:bng_4 { | ||
_:bng_19 log:call true. | ||
[] rdf:value true; log:callWithCut true. | ||
} | ||
|
||
GRAPH _:bng_5 { | ||
_:bng_19 :findModel ((_:bng_20 _:bng_21) (_:bng_1 _:bng_2) (_:bng_1 _:bng_2)). | ||
} | ||
|
||
GRAPH _:bng_6 { | ||
_:bng_22 log:sequent (_:bng_2 _:bng_3). | ||
(_:bng_2 _:bng_3) list:member _:bng_2. | ||
_:bng_22 log:call true. | ||
(_:bng_20) list:notMember _:bng_21. | ||
((_:bng_20) (_:bng_21)) list:append (_:bng_20 _:bng_21). | ||
((_:bng_1) (_:bng_2)) list:append (_:bng_1 _:bng_2). | ||
[] rdf:value true; log:becomes _:bng_2. | ||
_:bng_5 log:callWithCleanup _:bng_23. | ||
} | ||
|
||
GRAPH _:bng_7 { | ||
_:bng_19 :findModel ((_:bng_20) (_:bng_1) (_:bng_1 _:bng_2)). | ||
} | ||
|
||
GRAPH _:bng_8 { | ||
_:bng_24 log:sequent (_:bng_1 _:bng_25). | ||
(_:bng_1 _:bng_25) list:member _:bng_1. | ||
_:bng_24 log:call true. | ||
() list:notMember _:bng_20. | ||
(() (_:bng_20)) list:append (_:bng_20). | ||
(() (_:bng_1)) list:append (_:bng_1). | ||
[] rdf:value true; log:becomes _:bng_1. | ||
_:bng_7 log:callWithCleanup _:bng_26. | ||
} | ||
|
||
GRAPH _:bng_9 { | ||
_:bng_19 :findModel (() () (_:bng_1 _:bng_2)). | ||
} | ||
|
||
GRAPH _:bng_10 { | ||
:model :is (_:bng_1 _:bng_2). | ||
} | ||
|
||
GRAPH _:bng_11 { | ||
_:bng_19 :findModel ((_:bng_20 _:bng_21 _:bng_27) (_:bng_1 _:bng_3 _:bng_2) (_:bng_1 _:bng_3 _:bng_2)). | ||
} | ||
|
||
GRAPH _:bng_12 { | ||
_:bng_28 log:sequent (_:bng_2 _:bng_29). | ||
(_:bng_2 _:bng_29) list:member _:bng_2. | ||
_:bng_28 log:call true. | ||
(_:bng_20 _:bng_21) list:notMember _:bng_27. | ||
((_:bng_20 _:bng_21) (_:bng_27)) list:append (_:bng_20 _:bng_21 _:bng_27). | ||
((_:bng_1 _:bng_3) (_:bng_2)) list:append (_:bng_1 _:bng_3 _:bng_2). | ||
[] rdf:value true; log:becomes _:bng_2. | ||
_:bng_11 log:callWithCleanup _:bng_23. | ||
} | ||
|
||
GRAPH _:bng_13 { | ||
_:bng_19 :findModel ((_:bng_20 _:bng_21) (_:bng_1 _:bng_3) (_:bng_1 _:bng_3 _:bng_2)). | ||
} | ||
|
||
GRAPH _:bng_14 { | ||
_:bng_22 log:sequent (_:bng_2 _:bng_3). | ||
(_:bng_2 _:bng_3) list:member _:bng_3. | ||
_:bng_22 log:call true. | ||
(_:bng_20) list:notMember _:bng_21. | ||
((_:bng_20) (_:bng_21)) list:append (_:bng_20 _:bng_21). | ||
((_:bng_1) (_:bng_3)) list:append (_:bng_1 _:bng_3). | ||
[] rdf:value true; log:becomes _:bng_3. | ||
_:bng_13 log:callWithCleanup _:bng_30. | ||
} | ||
|
||
GRAPH _:bng_15 { | ||
_:bng_19 :findModel ((_:bng_20) (_:bng_1) (_:bng_1 _:bng_3 _:bng_2)). | ||
} | ||
|
||
GRAPH _:bng_16 { | ||
_:bng_24 log:sequent (_:bng_1 _:bng_25). | ||
(_:bng_1 _:bng_25) list:member _:bng_1. | ||
_:bng_24 log:call true. | ||
() list:notMember _:bng_20. | ||
(() (_:bng_20)) list:append (_:bng_20). | ||
(() (_:bng_1)) list:append (_:bng_1). | ||
[] rdf:value true; log:becomes _:bng_1. | ||
_:bng_15 log:callWithCleanup _:bng_26. | ||
} | ||
|
||
GRAPH _:bng_17 { | ||
_:bng_19 :findModel (() () (_:bng_1 _:bng_3 _:bng_2)). | ||
} | ||
|
||
GRAPH _:bng_18 { | ||
:model :is (_:bng_1 _:bng_3 _:bng_2). | ||
} | ||
|
||
GRAPH _:bng_24 { | ||
:Pat a vcard:Individual. | ||
} | ||
|
||
GRAPH _:bng_25 { | ||
:Pat :canDo :B. | ||
} | ||
|
||
GRAPH _:bng_22 { | ||
:Pat a vcard:Individual. | ||
:Pat :canDo :A. | ||
} | ||
|
||
GRAPH _:bng_28 { | ||
:Pat a vcard:Individual. | ||
:Pat :canDo :D. | ||
} | ||
|
||
GRAPH _:bng_2 { | ||
:Pat :canDo :E. | ||
} | ||
|
||
GRAPH _:bng_29 { | ||
:Pat :canDo :F. | ||
} | ||
|
||
GRAPH _:bng_19 { | ||
:Pat a vcard:Individual. | ||
:Pat :canDo :E. | ||
} | ||
|
||
GRAPH _:bng_20 { | ||
_:bng_24 log:sequent (_:bng_1 _:bng_25). | ||
} | ||
|
||
GRAPH _:bng_21 { | ||
_:bng_22 log:sequent (_:bng_2 _:bng_3). | ||
} | ||
|
||
GRAPH _:bng_1 { | ||
:Pat :canDo :A. | ||
} | ||
|
||
GRAPH _:bng_3 { | ||
:Pat :canDo :D. | ||
} | ||
|
||
GRAPH _:bng_5 { | ||
_:bng_19 :findModel ((_:bng_20 _:bng_21) (_:bng_1 _:bng_2) (_:bng_1 _:bng_2)). | ||
} | ||
|
||
GRAPH _:bng_23 { | ||
_:bng_2 log:becomes true. | ||
} | ||
|
||
GRAPH _:bng_7 { | ||
_:bng_19 :findModel ((_:bng_20) (_:bng_1) (_:bng_1 _:bng_2)). | ||
} | ||
|
||
GRAPH _:bng_26 { | ||
_:bng_1 log:becomes true. | ||
} | ||
|
||
GRAPH _:bng_27 { | ||
_:bng_28 log:sequent (_:bng_2 _:bng_29). | ||
} | ||
|
||
GRAPH _:bng_11 { | ||
_:bng_19 :findModel ((_:bng_20 _:bng_21 _:bng_27) (_:bng_1 _:bng_3 _:bng_2) (_:bng_1 _:bng_3 _:bng_2)). | ||
} | ||
|
||
GRAPH _:bng_13 { | ||
_:bng_19 :findModel ((_:bng_20 _:bng_21) (_:bng_1 _:bng_3) (_:bng_1 _:bng_3 _:bng_2)). | ||
} | ||
|
||
GRAPH _:bng_30 { | ||
_:bng_3 log:becomes true. | ||
} | ||
|
||
GRAPH _:bng_15 { | ||
_:bng_19 :findModel ((_:bng_20) (_:bng_1) (_:bng_1 _:bng_3 _:bng_2)). | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
# ---------------------------- | ||
# Policy model finding example | ||
# ---------------------------- | ||
# | ||
# Inspired by gps.trig | ||
|
||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
PREFIX list: <http://www.w3.org/2000/10/swap/list#> | ||
PREFIX log: <http://www.w3.org/2000/10/swap/log#> | ||
PREFIX vcard: <http://www.w3.org/2006/vcard/ns#> | ||
PREFIX lingua: <http://www.w3.org/2000/10/swap/lingua#> | ||
PREFIX var: <http://www.w3.org/2000/10/swap/var#> | ||
PREFIX : <#> | ||
|
||
# Pat is an individual | ||
:Pat a vcard:Individual. | ||
|
||
# if X is an individual then X can do A or B | ||
_:bng_1 log:sequent (_:bng_2 _:bng_3). | ||
|
||
GRAPH _:bng_1 { | ||
var:X a vcard:Individual. | ||
} | ||
|
||
GRAPH _:bng_2 { | ||
var:X :canDo :A. | ||
} | ||
|
||
GRAPH _:bng_3 { | ||
var:X :canDo :B. | ||
} | ||
|
||
# if X is an individual who can do A then X can do E or D | ||
_:bng_4 log:sequent (_:bng_5 _:bng_6). | ||
|
||
GRAPH _:bng_4 { | ||
var:X a vcard:Individual. | ||
var:X :canDo :A. | ||
} | ||
|
||
GRAPH _:bng_5 { | ||
var:X :canDo :E. | ||
} | ||
|
||
GRAPH _:bng_6 { | ||
var:X :canDo :D. | ||
} | ||
|
||
# if X is an individual who can do D then X can do E or F | ||
_:bng_7 log:sequent (_:bng_8 _:bng_9). | ||
|
||
GRAPH _:bng_7 { | ||
var:X a vcard:Individual. | ||
var:X :canDo :D. | ||
} | ||
|
||
GRAPH _:bng_8 { | ||
var:X :canDo :E. | ||
} | ||
|
||
GRAPH _:bng_9 { | ||
var:X :canDo :F. | ||
} | ||
|
||
# find model reaching goal | ||
_:bng_10 lingua:backward _:bng_11. | ||
|
||
GRAPH _:bng_10 { | ||
var:Goal :findModel (var:Steps var:Model var:Model). | ||
} | ||
|
||
GRAPH _:bng_11 { | ||
var:Goal log:call true. | ||
[] rdf:value true; log:callWithCut true. | ||
} | ||
|
||
_:bng_12 lingua:backward _:bng_13. | ||
|
||
GRAPH _:bng_12 { | ||
var:Goal :findModel (var:Steps1 var:Model1 var:Model). | ||
} | ||
|
||
GRAPH _:bng_13 { | ||
var:Prem log:sequent var:Cases. | ||
var:Cases list:member var:Case. | ||
var:Prem log:call true. | ||
var:Steps1 list:notMember _:bng_14. | ||
(var:Steps1 (_:bng_14)) list:append var:Steps2. | ||
(var:Model1 (var:Case)) list:append var:Model2. | ||
[] rdf:value true; log:becomes var:Case. | ||
_:bng_15 log:callWithCleanup _:bng_16. | ||
} | ||
|
||
GRAPH _:bng_14 { | ||
var:Prem log:sequent var:Cases. | ||
} | ||
|
||
GRAPH _:bng_15 { | ||
var:Goal :findModel (var:Steps2 var:Model2 var:Model). | ||
} | ||
|
||
GRAPH _:bng_16 { | ||
var:Case log:becomes true. | ||
} | ||
|
||
# query: find model where X is an individual who can do E | ||
_:bng_17 lingua:answer _:bng_18. | ||
|
||
GRAPH _:bng_17 { | ||
_:bng_19 :findModel (() () var:Model). | ||
} | ||
|
||
GRAPH _:bng_18 { | ||
:model :is var:Model. | ||
} | ||
|
||
GRAPH _:bng_19 { | ||
var:X a vcard:Individual. | ||
var:X :canDo :E. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters