Skip to content

Instantly share code, notes, and snippets.

@phochste
Last active March 29, 2024 07:17
Show Gist options
  • Save phochste/ded5e6fe6add3ff7d67870b02157025d to your computer and use it in GitHub Desktop.
Save phochste/ded5e6fe6add3ff7d67870b02157025d to your computer and use it in GitHub Desktop.
@prefix : <urn:example:> .
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
@prefix list: <http://www.w3.org/2000/10/swap/list#> .
:test1
:policy :PolicyX ;
:has :A , :B , :C .
:PolicyX
a :Policy ;
:allOf :A, :B ;
:anyOf :C ;
:noneOf :D .
(_:Pol _:Test _:Field _:X) log:nand {
_:Test :policy _:Pol .
_:Pol a :Policy .
( { _:Pol :allOf _:Field } { _:Test :has _:Field } ) log:forAllIn _:X .
() log:nand {
_:Pol :pass :allOfTest .
} .
} .
(_:Pol _:Test _:Field _:List _:L _:X) log:nand {
_:Test :policy _:Pol .
_:Pol a :Policy .
( _:Field { _:Pol :anyOf _:Field . _:Test :has _:Field } _:List ) log:collectAllIn _:X .
_:List list:length _:L .
_:L log:notEqualTo 0 .
() log:nand {
_:Pol :pass :anyOfTest .
} .
} .
(_:Pol _:Test _:Field _:List _:L _:X) log:nand {
_:Test :policy _:Pol .
_:Pol a :Policy .
( _:Field { _:Pol :noneOf _:Field . _:Test :has _:Field } _:List ) log:collectAllIn _:X .
_:List list:length _:L .
_:L log:equalTo 0 .
() log:nand {
_:Pol :pass :noneOfTest .
} .
} .
(_:Pol) log:nand {
_:Pol a :Policy .
_:Pol :pass :allOfTest , :anyOfTest , :noneOfTest .
() log:nand {
:test :is true .
} .
} .
{
?S :is ?O .
}
log:query
{
?S :is ?O .
}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment