Appendix: Mechanical Rules (Informative)

The GRDDL specification uses formal definitions such as...

Normative StatementMechanical Rule
(Informative)
If F and G are GRDDL results of IR, then the merge [RDF-MT] of F and G is also a GRDDL result of IR.
?IR grddl:result ?F, ?G.
(?F ?G) log:conjunction ?H.

?IR grddl:result ?H.

The premises and conclusions of the mechanical rules are written as SPARQL graph patterns[SPARQL].

The term grddl:result is introduced and specified in these rules. The RDF Semantics[RDF-MT] document doesn't define an RDF property for the merge of two RDF documents, but some research work, Semantic Web Tutorial Using N3 does define semantic extension of RDF where log:conjunction relates a list/set of RDF graphs to their merge, so we use that.

Other terms from various namespaces are used as follows:

In the first example in the specification, <http://www.w3.org/2001/sw/grddl-wg/td/titleauthor.html> has two GRDDL results. The following is a derivation of one of them from the following sources:

See Makefile for details.

1: <http://www.w3.org/2001/sw/grddl-wg/td/titleauthor.html> :uri "http://www.w3.org/2001/sw/grddl-wg/td/titleauthor.html" .
 [by built-in Axiom log:uri]

2: """glean_title.xsl http://www.w3.org/2001/sw/grddl-wg/td/getAuthor.xsl""" :normalize-space "glean_title.xsl http://www.w3.org/2001/sw/grddl-wg/td/getAuthor.xsl" .
 [by built-in Axiom fn:normalize-space]

3: ( "glean_title.xsl http://www.w3.org/2001/sw/grddl-wg/td/getAuthor.xsl" "[ \t\r\n]+" ) :tokenize ( "glean_title.xsl" "http://www.w3.org/2001/sw/grddl-wg/td/getAuthor.xsl" ) .
 [by built-in Axiom fn:tokenize]

4: ( "glean_title.xsl" "http://www.w3.org/2001/sw/grddl-wg/td/getAuthor.xsl" ) :member "glean_title.xsl" .
 [by built-in Axiom list:member]

5: ( "glean_title.xsl" "http://www.w3.org/2001/sw/grddl-wg/td/titleauthor.html" ) :resolve-uri "http://www.w3.org/2001/sw/grddl-wg/td/glean_title.xsl" .
 [by built-in Axiom fn:resolve-uri]

6: <http://www.w3.org/2001/sw/grddl-wg/td/glean_title.xsl> :uri "http://www.w3.org/2001/sw/grddl-wg/td/glean_title.xsl" .
 [by built-in Axiom log:uri]

7: ...
 [by parsing <grddl-rule-tests.n3>]

8: @forSome :_g28, :_g29, g:_g6 . ( g:_g6 "/*" ) gspec:xpath :_g28 . ( g:_g6 """/*/@*[local-name()="transformation" and namespace-uri()= "http://www.w3.org/2003/g/data-view#"]""" ) gspec:xpath :_g29 . :_g28 fn:base-uri "http://www.w3.org/2001/sw/grddl-wg/td/titleauthor.html" . :_g29 fn:string """glean_title.xsl http://www.w3.org/2001/sw/grddl-wg/td/getAuthor.xsl""" .
 [by erasure from step 7]

9: ...
 [by parsing <grddl-rules3.n3>]

10: @forAll :BASE, :E, :N, :REF, :TX, :TXURI, :V, :Vnorm . { @forSome run:_g30, run:_g31 . ( :N "/*" ) gspec:xpath :E . ( :N """/*/@*[local-name()="transformation" and namespace-uri()= "http://www.w3.org/2003/g/data-view#"]""" ) gspec:xpath run:_g30 . ( :REF :BASE ) fn:resolve-uri :TXURI . ( :Vnorm "[ \t\r\n]+" ) fn:tokenize run:_g31 . run:_g30 fn:string :V . run:_g31 list:member :REF . :E fn:base-uri :BASE . :TX log:uri :TXURI . :V fn:normalize-space :Vnorm . } log:implies {:N grddl:transformation :TX . } .
 [by erasure from step 9]

11: ...
 [by rule from step 10 applied to steps [2, 3, 4, 5, 6, 8]
  with bindings {'E': '[...]', 'TX': '<http://www.w3.org/2001/sw/grddl-wg/td/glean_title.xsl>', '_g_L14C16': '[...]', 'TXURI': '"http....xsl"', 'N': '<grddl-rule-tests.n3#_g6>', 'Vnorm': '"glea....xsl"', 'BASE': '"http...html"', 'V': '"glea....xsl"', '_g_L16C35': '?', 'REF': '"glea....xsl"'}]

12: @forSome :_g6 . :_g6 grddl:transformation <http://www.w3.org/2001/sw/grddl-wg/td/glean_title.xsl> .
 [by erasure from step 11]

13: ...
 [by parsing <data-view.rdf>]

14: :Transformation owl:onProperty :transformationProperty; owl:someValuesFrom :TransformationProperty .
 [by erasure from step 13]

15: :transformation s:range :Transformation .
 [by erasure from step 13]

16: @forSome :_g6 . :_g6 grddl:transformation <http://www.w3.org/2001/sw/grddl-wg/td/glean_title.xsl> .
 [by erasure from step 11]

17: ...
 [by parsing <owlAx.n3>]

18: @forAll :C, :O . { @forSome run:_g32, run:_g33 . run:_g32 run:_g33 :O . run:_g33 s:range :C . } log:implies {:O a :C . } .
 [by erasure from step 17]

19: ...
 [by rule from step 18 applied to steps [15, 16]
  with bindings {'C': '<http://www.w3.org/2003/g/data-view#Transformation>', '_g_L2C6': '<http://www.w3.org/2003/g/data-view#transformation>', '_g_L2C3': '<grddl-rule-tests.n3#_g6>', 'O': '<http://www.w3.org/2001/sw/grddl-wg/td/glean_title.xsl>'}]

20: <http://www.w3.org/2001/sw/grddl-wg/td/glean_title.xsl> a :Transformation .
 [by erasure from step 19]

21: @forAll :C, :P, :S . { @forSome run:_g34 . run:_g34 owl:onProperty :P; owl:someValuesFrom :C . :S a run:_g34 . } log:implies { @forSome run:_g35 . run:_g35 a :C . :S :P run:_g35 . } .
 [by erasure from step 17]

22: ...
 [by rule from step 21 applied to steps [14, 20]
  with bindings {'P': '<http://www.w3.org/2003/g/data-view#transformationProperty>', 'C': '<http://www.w3.org/2003/g/data-view#TransformationProperty>', '_g_L3C8': '<http://www.w3.org/2003/g/data-view#Transformation>', 'S': '<http://www.w3.org/2001/sw/grddl-wg/td/glean_title.xsl>'}]

23: @forSome :_g24 . <http://www.w3.org/2001/sw/grddl-wg/td/glean_title.xsl> grddl:transformationProperty :_g24 .
 [by erasure from step 22]

24: @forSome :_g6 . "http://www.w3.org/2001/sw/grddl-wg/td/titleauthor.html" fn:doc :_g6 .
 [by erasure from step 7]

25: <http://www.w3.org/2001/sw/grddl-wg/td/glean_title.xsl> :uri "http://www.w3.org/2001/sw/grddl-wg/td/glean_title.xsl" .
 [by built-in Axiom log:uri]

26: @forSome :_g24 . <http://www.w3.org/2001/sw/grddl-wg/td/glean_title.xsl> grddl:transformationProperty :_g24 .
 [by erasure from step 22]

27: @forSome :_g1, :_g6 . "http://www.w3.org/2001/sw/grddl-wg/td/glean_title.xsl" fn:doc :_g1 . ( :_g1 :_g6 ) gspec:resultTree [ gspec:rdfParse {<http://musicbrainz.org/mm-2.1/album/6b050dcf-7ab1-456d-9e1b-c3c41c18eed2> <http://purl.org/dc/elements/1.1/title> "Are You Experienced?" . } ] .
 [by erasure from step 7]

28: @forAll :G, :R, :RDFXML, :TP, :TXDOC, :TXNODE . { @forSome run:_g25 . ( :TXNODE :R ) gspec:resultTree :RDFXML . run:_g25 fn:doc :TXNODE . :RDFXML gspec:rdfParse :G . :TXDOC log:uri run:_g25; grddl:transformationProperty :TP . } log:implies {:R :TP :G . } .
 [by erasure from step 9]

29: ...
 [by rule from step 28 applied to steps [25, 26, 27]
  with bindings {'TXDOC': '<http://www.w3.org/2001/sw/grddl-wg/td/glean_title.xsl>', '_g_L111C11': '"http....xsl"', 'G': '{6b050dcf-7ab1-456d-9e1b-c3c41c18eed2 dc:title "Are ...ced?"}', 'TP': '[...]', 'R': '<grddl-rule-tests.n3#_g6>', 'RDFXML': '[...]', 'TXNODE': '<grddl-rule-tests.n3#_g1>'}]

30: @forSome :_g24, g:_g6 . g:_g6 :_g24 {<http://musicbrainz.org/mm-2.1/album/6b050dcf-7ab1-456d-9e1b-c3c41c18eed2> <http://purl.org/dc/elements/1.1/title> "Are You Experienced?" . } .
 [by erasure from step 29]

31: @forAll :G, :IR, :R, :TP . { @forSome run:_g26, run:_g27 . run:_g26 fn:doc :R . run:_g27 grddl:transformationProperty :TP . :IR log:uri run:_g26 . :R grddl:transformation run:_g27; :TP :G . } log:implies {:IR grddl:result :G . } .
 [by erasure from step 9]

32: ...
 [by rule from step 31 applied to steps [1, 12, 23, 24, 30]
  with bindings {'_g_L24C13': '"http...html"', '_g_L25C25': '<http://www.w3.org/2001/sw/grddl-wg/td/glean_title.xsl>', 'G': '{6b050dcf-7ab1-456d-9e1b-c3c41c18eed2 dc:title "Are ...ced?"}', 'IR': '<http://www.w3.org/2001/sw/grddl-wg/td/titleauthor.html>', 'TP': '[...]', 'R': '<grddl-rule-tests.n3#_g6>'}]

33: <http://www.w3.org/2001/sw/grddl-wg/td/titleauthor.html> :result {<http://musicbrainz.org/mm-2.1/album/6b050dcf-7ab1-456d-9e1b-c3c41c18eed2> <http://purl.org/dc/elements/1.1/title> "Are You Experienced?" . } .
 [by erasure from step 32]

Changes

$Log: spec_rules.html,v $
Revision 1.11  2007/04/26 15:07:32  connolly
introduce htmlBase

Revision 1.10  2007/03/01 17:45:09  connolly
fix httpLink id

Revision 1.9  2007/03/01 17:44:32  connolly
add doctype for pubrules-happiness

Revision 1.8  2007/02/20 18:24:45  connolly
simplify HTML linking constructs while mixing in HTTP stuff

Revision 1.7  2007/02/20 01:38:07  connolly
elaborated rules appendix; rationalized namespaces

Revision 1.6  2007/02/15 18:34:39  connolly
2 more steps to get to the relevant result

Revision 1.5  2007/02/15 06:58:48  connolly
replace nicely marked-up proof with one that's
un-retouched (other than truncation after the first
interesting result at step 24 of 149)

Revision 1.4  2007/02/15 06:54:22  connolly
add x:xpath in 2007/ont/xml namespace
add webarch namespace (not sure it's needed)

Revision 1.3  2007/02/07 08:21:50  connolly
move mechanical rule explanation to this separate file