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
match | |
$x isa user; $r isa resource; | |
(accessor: $x, resource: $r) isa access, has permission $p; |
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
rule permission-write-read: | |
when { $access isa write-access; } | |
then { $access has permission "read"; }; | |
rule permission-read: | |
when { $access isa read-access; } | |
then { $access has permission "read"; }; | |
rule permission-write: | |
when { $access isa write-access; } |
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
insert | |
// entity with two attributes | |
$for-profit isa for-profit, has for-profit-id 99, has name "Google"; | |
// entity with two attributes | |
$charity isa non-profit, has charity-id 10, has name "Greenpeace"; | |
// entity with one explicitly declared attribute | |
$name isa name; $name = "Billy Joel"; |
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
match | |
(buyer: $b, seller: $s) isa contract; | |
$b has charity-id $cid; | |
===== after type inference ===== | |
$b may be [non-profit] | |
$s may be [for-profit, non-profit, person] | |
relation may be [resource-ownership] | |
$cid may be [charity-id] |
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
match $p isa person, has org-id $id; |
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
match | |
$org isa organisation; | |
(buyer: $org, seller: $contracted) isa contract; | |
$contracted has name $name; | |
===== after type inference ===== | |
$org may be [non-profit, for-profit] | |
$contracted may be [non-profit, for-profit, person] | |
$name may be [name] |
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
match | |
$org isa organisation; | |
(buyer: $org, seller: $contracted) isa contract; | |
$contracted has name $name; |
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
define | |
organisation sub entity, | |
abstract, | |
owns name, | |
owns org-id, | |
plays contract:buyer, | |
plays contract:seller; | |
for-profit sub organisation, | |
owns for-profit-id as org-id; | |
non-profit sub organisation, |
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
define | |
vertex sub entity, | |
owns label, | |
plays undirected-edge:end, | |
plays directed-edge:from, | |
plays directe-edge:to; | |
undirected-edge sub relation, | |
owns label, |
NewerOlder