@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . <> doc "add.n3 - Add Numbers Together"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . add doc "Two valued version of the builtin add function"; def ((p q) (add p q) ) . main script ( (say (add 35 150)) ) . # EOF
- add.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . <> doc "argv.n3 - Print Out Argv Value 0"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . main script ( (say (argv 0)) (say (argv 1)) ) . # EOF
- argv.n3
@keywords . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . <> doc "chain.n3 - Quoted Arguments Test"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . chain def (((list a) (list b)) (say a) (say b) ) . date def (() (say "Date:") (return "2007-10-25") ) . time def (() (say "Time:") (return "12:25 PM") ) . main script ((chain date time)) . # EOF
- chain.n3
@keywords . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . <> doc "chain.n3 - Quoted Arguments Test"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . chain def (((list a) (list b)) (say (a)) (say (b)) ) . date def (() (say "Date:") (return "2007-10-25") ) . time def (() (say "Time:") (return "12:25 PM") ) . main script ((chain date time)) . # EOF
- chain2.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . <> doc "dbslurp.n3 - DBPedia Slurp"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . data def (() (var resources (list)) (select ?s ?p ?o where { ?s ?p ?o } (for t in (list ?s ?p ?o) (if (startswith t "http://dbpedia.org/resource/") (push t resources)))) (return resources) ) . main script ( (for resource in (data) (store (semantics resource))) (output) ) . # EOF
- dbslurp.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix db: <http://dbpedia.org/property/> . <> doc "dbslurp2.n3 - DBPedia Slurp 2"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . data def (() (var resources (list)) (select ?s ?p ?o where { ?s ?p ?o } (for t in (list ?s ?p ?o) (if (startswith t "http://dbpedia.org/resource/") (push t resources)))) (return resources) ) . main script ( (var names (list)) (for resource in (data) (push ( (semantics resource))) (output) ) . # EOF
- dbslurp2.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . <> doc "dbslurp3.n3 - DBPedia Slurp 3"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . main script ( (select ?s ?p ?o where { ?s ?p ?o } (for t in (list ?s ?p ?o) (if (startswith t "http://dbpedia.org/resource/") (store (semantics t))))) (output) ) . # EOF
- dbslurp3.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix u: <delete.n3#> . <> doc "delete.n3 - Delete a Statement"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . main script ( (store stdin) (delete { ?s ?p u:Test }) (output) ) . # EOF
- delete.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix log: <http://www.w3.org/2000/10/swap/log#> . <> doc "double.n3 - Double Call Test"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . shout def ((arg) (out arg) (say "!") ) . main script ( (shout "Yo") (shout "Dude") ) . # EOF
- double.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . <> doc "join.n3 - Join and Say Hello World"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . main script ( (dump "program") ) . # EOF
- dump.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix u: <friends.n3#> . <> doc "foaf.n3 - Print a List of Friends"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . # @forSome test . main script ( (say "<ul>") (store (semantics <http://inamidst.com/sbp/foaf.rdf>)) (var names (select ?name where { [ foaf:name "Sean B. Palmer"; foaf:knows [ foaf:name ?name ] ]})) (for name in (sort names) (say ("<li>" name "</li>"))) (say "</ul>") ) . # EOF
- foaf.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix u: <friends.n3#> . <> doc "foaf.n3 - Print a List of Friends"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . main script ( (store (semantics <http://inamidst.com/sbp/foaf.rdf>)) (var Q {[ foaf:name "Sean B. Palmer"; foaf:knows [ foaf:name ?name ] ]}) (for name in (sort (select ?name where Q)) (say name)) ) . # EOF
- foaf2.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix u: <friends.n3#> . <> doc "foaf.n3 - Print a List of Friends"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . main script ( (store <http://inamidst.com/sbp/foaf.rdf>) (var Q {[ foaf:name "Sean B. Palmer"; foaf:knows [ foaf:name ?name ] ]}) (for name in (sort (select ?name where Q)) (say name)) ) . # EOF
- foaf3.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix u: <friends.n3#> . <> doc "friends.n3 - Print a List of Friends"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . main script ( (say "<ul>") (for name in (select ?name where { ?f u:friend ?name }) (say ("<li>" name "</li>"))) (say "</ul>") ) . # EOF
- friends.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix u: <friends.n3#> . <> doc "friends2.n3 - Print a List of Friends"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . main script ( (say "<ul>") (select ?name where { ?f u:friend ?name } (say ("<li>" ?name "</li>"))) (say "</ul>") ) . # EOF
- friends2.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix e: <grep#> . @prefix i: <grep.n3#> . <> doc "grep.n3 - Search Files for Pattern"; usage ("grep.n3" opts "pattern" "filenames+" ("-h" "--help" "Display a help message") ("-t" "--test" "Perform builtin code tests")); dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . e:grep def ((i:filenames i:pattern) (doc "Grep through filenames for pattern") (example (e:grep ("tag:pluvo.org,2006:words") "ria") (prints "20. Thesmophoriazousae")) (for i:line (lines i:filenames) (if (search i:pattern i:line) do (out i:line))) . e:args main ((if (arg "--help") or (not args) do (help)) (if (arg "--test") do (check e:grep) (quit)) (e:grep args.filenames args.pattern)) . # EOF
- grep.p3.n3
<> :doc "grep.n3 - Search Files for Pattern"; dc:author [ foaf:name "Sean B. Palmer"; foaf:homepage <http://inamidst.com/sbp/> ]; :usage ("grep.n3" :options "pattern" "filenames+" "-h/--help 'Display a help message'" "-t/--test 'Perform builtin code tests'") . _:grep :def ((_:filenames _:pattern) (:Comment "Grep through filenames for pattern) (:Example (_:grep ("tag:pluvo.org,2006:words") "ria") (:prints "20. Thesmophoriazousae")) (:for _:line (:lines _:filenames) ((:Regexp _:pattern) _:line (:out _:line))) _:main :main ((_:argv) (or (:Arg "--help") (:not :args) (:help)) ((:Arg "--test") (:check _:grep) (_:quit)) (_:grep (:args!"filenames") (:args!"pattern"))) # EOF
- grep.plan3.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . <> doc "hello.n3 - Hello World Test"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . hello def (() (say "Hello, world!")) . main script ((hello)) . # EOF
- hello.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . <> doc "index.n3 - List Index Test"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . main script ( (var letters (list "p" "q" "r" "s" "t")) (say (letters 1)) ) . # EOF
- index.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . <> doc "join.n3 - Join and Say Hello World"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . main script ( (var output (join " " ("Hello" "world!"))) (say output) ) . # EOF
- join.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . <> doc "out.n3 - Output Test"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . main script ( (out "Hello world!") (say) ) . # EOF
- out.n3
@prefix log: <http://www.w3.org/2000/10/swap/log#> . :chaffy a log:Chaff . :p :q :r . :chaffy :b :c . :a :chaffy :c . :notchaffy :b :c . :a :b :chaffy . # EOF
- purge-example.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix log: <http://www.w3.org/2000/10/swap/log#> . <> doc "purge.n3 - Do the Equivalent of --purge"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . purge def (() (select ?p where { ?p a log:Chaff } ((delete { ?p [] [] }) (delete { [] ?p [] }) (delete { [] [] ?p }))) ) . main script ( (store <purge-example.n3>) (purge) (output) ) . # EOF
- purge.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . <> doc "query.n3 - Query Test"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . main script ( (query { <> doc ?s }) ) . # EOF
- query.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix p3: <http://example.org/ns/plan3-funcs#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . <> doc "say.n3 - Function Disambiguation Test"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . say def (() (p3:say "Hello world!") ) . main script ((say)) . # EOF
- say.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . <> doc "select.n3 - Query Select Test"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . @forAll s. main script ( (select s from { <> doc s }) ) . # EOF
- select.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . <> doc "select2.n3 - Query Select Test"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . main script ( (var docs (select ?s from program where { <> doc ?s })) (say (docs 0)) ) . # EOF
- select2.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . <> doc "stdin.n3 - Read Stdin to the Working Context"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . main script ( (store stdin) (select ?s ?p ?o where { ?s ?p ?o } (say ?s ?p ?o)) ) . # EOF
- stdin.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . <> doc "dbslurp3.n3 - DBPedia Slurp 3"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . main script ( (store { { ?s a Test } => { ?s a Tested } . something a Test }) (think) (select ?tested where { ?tested a Tested } (say "Tested: " ?tested)) ) . # EOF
- think.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . <> doc "types.n3 - Print Out Various Types"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . main script ( (out "<http://example.org/>: ") (type <http://example.org/>) (out "<http://example.org/#frag>: ") (type <http://example.org/#frag>) (out "_:test: ") (type _:test) (out "\"test\": ") (type "test") (out "?test: ") (type ?test) (out "{ p q r }: ") (type { p q r }) (out "(): ") (type ()) (out "(p q r): ") (type (p q r)) (out "1: ") (type 1) (out "1.1: ") (type 1.1) ) . # EOF
- types.n3
@keywords a . @prefix : <http://example.org/ns/plan3#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix log: <http://www.w3.org/2000/10/swap/log#> . <> doc "values.n3 - Dictionary-Like Behaviour"; dc:author [ foaf:homepage <http://inamidst.com/sbp/> ] . get def ((subj pred) ((select ?obj where { subj pred ?obj }) 0) ) . set def ((subj pred obj) (delete { subj pred ?o }) (store { subj pred obj }) ) . show def (() (select ?s ?p ?o where { ?s ?p ?o } (say ?s ?p ?o)) (say) ) . main script ( (say "Setting: Bob friends 2") (set Bob friends 2) (out "get Bob friends: ") (say (get Bob friends)) (say "Setting: Bob friends 3") (set Bob friends 3) (out "get Bob friends: ") (say (get Bob friends)) (say "Working context: ") (show) ) . # EOF
- values.n3