W3C home > Mailing lists > Public > www-archive@w3.org > April 2002

N3 Splunge Script

From: Sean B. Palmer <sean@mysterylights.com>
Date: Thu, 11 Apr 2002 02:53:59 +0100
Message-ID: <002601c1e0fb$c1802b20$4c570150@localhost>
To: <www-archive@w3.org>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 7 November 2012 14:17:17 GMT