eye test.n3 files.n3 rules.n3
Last active
January 24, 2025 17:15
-
-
Save tpluscode/69e3af86056188a2b18f6643c27d601c to your computer and use it in GitHub Desktop.
n3 rule runs twice
This file contains hidden or 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
prefix e: <http://eulersharp.sourceforge.net/2003/03swap/log-rules#> | |
prefix string: <http://www.w3.org/2000/10/swap/string#> | |
prefix log: <http://www.w3.org/2000/10/swap/log#> | |
prefix file: <http://www.w3.org/2000/10/swap/file#> | |
{ | |
( ?suffix ) file:temp ?path . | |
} <= { | |
?uri log:uri ( "urn:rand:" ( 1000 )!e:random )!string:concatenation . | |
( | |
#"/tmp/" | |
?uri!log:uuid | |
?suffix | |
) string:concatenation ?path . | |
} . | |
{ | |
?path file:rm ?iDoNotCare . | |
} <= { | |
( "rm " ?path )!string:concatenation!e:exec . | |
} . |
This file contains hidden or 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
prefix e: <http://eulersharp.sourceforge.net/2003/03swap/log-rules#> | |
prefix log: <http://www.w3.org/2000/10/swap/log#> | |
prefix string: <http://www.w3.org/2000/10/swap/string#> | |
PREFIX tuner: <https://api-tuner.described.at/> | |
prefix file: <http://www.w3.org/2000/10/swap/file#> | |
{ | |
( ?method ?endpointUri ?header ?body ) tuner:response ?res . | |
} <= { | |
( ?method " " ?endpointUri )!string:concatenation^e:trace . | |
() file:temp ?responseBodyFile . | |
( ?responseBodyFile ".curl.json" ) string:concatenation ?responseHeadersFile . | |
( ?responseBodyFile ".n3" ) string:concatenation ?responseFile . | |
( | |
"curl -s -X " ?method " " ?endpointUri | |
" -H 'Content-Type:text/turtle' " | |
" --data-raw '" ?body!log:n3String "'" | |
" -w %{json} " | |
" -o " ?responseBodyFile | |
" > " ?responseHeadersFile | |
)!string:concatenation!e:exec . | |
?responseHeadersFile!file:rm . | |
?responseBodyFile!file:rm . | |
#?temp log:semanticsOrError ?res . | |
} . |
This file contains hidden or 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
PREFIX string: <http://www.w3.org/2000/10/swap/string#> | |
PREFIX log: <http://www.w3.org/2000/10/swap/log#> | |
PREFIX tuner: <https://api-tuner.described.at/> | |
prefix earl: <http://www.w3.org/ns/earl#> | |
PREFIX qlever: <https://qlever.described.at/> | |
prefix string: <http://www.w3.org/2000/10/swap/string#> | |
# Check OK response and | |
{ | |
( | |
"GET" "https://example.com" | |
{} | |
{ | |
} | |
) tuner:response ?res . | |
?res string:contains "Example" . | |
#?res tuner:statusCode 204 . | |
#?res tuner:body ?body . | |
} => { | |
[] earl:passed true | |
} . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment