N3 Splunge Script

Conveniently prints out an N3 file.

$ u n3s { \?p rdf:predicate :q\; rdf:object :r . :r rdfs:comment :s }
log:implies { :RDF :q :s } .
@prefix : <#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

this log:forAll :p .
{ :p rdf:predicate :q; rdf:object :r .
:r rdfs:comment :s } log:implies { :RDF :q :s } .

or try the retro mode, dumping all the prefixes:-

$ u n3s -r { \?x \?y \?z } =\> { \?z \?y \?p } .
@prefix : <#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix string: <http://www.w3.org/2000/10/swap/string#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix doc: <http://www.w3.org/2000/10/swap/pim#> .
@prefix crypto: <http://www.w3.org/2000/10/swap/crypto#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
@prefix daml: <http://www.daml.org/2001/03/daml+oil#> .
@prefix earl: <http://www.w3.org/2001/03/earl/0.95#> .

{ ?x ?y ?z } => { ?z ?y ?p } .

the same thing in smart mode:-

$ u n3s { \?x \?y \?z } =\> { \?z \?y \?p } .
@prefix : <#> .
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

this log:forAll :x, :y, :z, :z, :y, :p .
{ :x :y :z } log:implies { :z :y :p } .

shame about the repeated variables, but I can save that for a future
version. It only started out as a five minute hack.

--
Kindest Regards,
Sean B. Palmer
@prefix : <http://purl.org/net/swn#> .
:Sean :homepage <http://purl.org/net/sbp/> .

Received on Wednesday, 10 April 2002 21:54:59 UTC