Adding Graph Rules using RGML and Logic Primitives

Tim Berners-Lee has designed a new language, Notation 3 [NOT3] to describe the RDF data model [RDF] . Using Notation 3, we can add logic primitives to RGML to generate RDF properties [RDFS] that are commonly used to describe graph information such as, cycle, adjacent, path, etc. We will add simple rules to define two graph concepts: adjacency and paths between nodes. The latter is a modification of the example given by the Euler proof engine [EULER]

Two nodes are adjacent if they are connected by an edge. This can be expressed using two simple rules, where e is an edge, and u and v are nodes:
 

forall (e, u, v) : source(e,u) and target(e,v) -> adjacent(u,v) 
forall (u,v) : adjacent(u,v) -> adjacent(v,u) 

Using Notation 3 we can express these rules as:
 

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rgml: <http://purl.org/puninj/2001/05/rgml-schema#> .
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
@prefix : <rgml_rules#> .

:adjacent  rdfs:domain rgml:Node; rdfs:range rgml:Node.

{{:e rgml:source :u. :e rgml:target :v.} log:implies { :u :adjacent :v } } 
    a log:Truth; log:forAll :e, :u, :v.
{{ :u :adjacent :v. } log:implies { :v :adjacent :u. }; } 
   a log:Truth; log:forAll :u, :v.

A path is a sequence of consecutive nodes in a graph. Two nodes, u and v, are said to be consecutive if there is a directed edge from u to v, where u is the parent of v (rule 1). The second rule states that if the node u is the parent of the node v, there is a directed path from u to v. The third, a recursive rule, states the condition for the existence of a path from nodes u to w. These three rules are the following (where u, v, w are nodes; e is an edge and g is a graph) :
 

forall (g,e,u,v) : g is directed and source(e,u) and target(e,v) -> parent(u,v) 
forall (g,u,v) : g is directed and parent(u,v) -> path(u,v) 
forall (g,u,v,w) : g is directed and parent(u,v) and path(v,w) -> path(u,w) 

Using Notation 3 we can express these rules as:
 

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rgml: <http://purl.org/puninj/2001/05/rgml-schema#> .
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
@prefix : <rgml_rules#> .

:parent  rdfs:domain rgml:Node; rdfs:range rgml:Node.
:path  rdfs:domain rgml:Node; rdfs:range rgml:Node.

{{ :g rgml:directed "true". :e rgml:source :u. :e rgml:target :v.} 
   log:implies { :u :parent :v. }; } 
   a log:Truth; log:forAll :e, :u, :v , :g.

{{ :g rgml:directed "true". :u :parent :v} 
   log:implies {:u :path :v}} 
   a log:Truth; log:forAll :g, :u, :v.

{{ :g rgml:directed "true". :u :parent :v. :v :path :w} 
   log:implies {:u :path :w}} 
   a log:Truth; log:forAll :g, :u, :v, :w.

To express the rules we use the logic properties log:implies and log:forAll that are part of the logic schema [NOT3] . We use the cwm engine [CWM] to process these rules on a simple graph expressed in RGML.

References

[CWM] Tim Berners-Lee. Semantic Web Area for Play : Closed World Machine. http://www.w3.org/2000/10/swap/Overview.html, February, 2001.

[EULER] Jos De Roo. Euler proof mechanism. http://www.agfa.com/w3c/euler/, June, 2001 .

[NOT3] Tim Berners-Lee. Notation 3. http://www.w3.org/DesignIssues/Notation3.html, April, 2001.

[RDF] O. Lassila and R. Swick. W3C, Resource Description Framework (RDF) Model and Syntax Specification . http://www.w3.org/TR/REC-rdf-syntax, 1999.

[RDFS] D. Brickley and R.V. Guha. W3C, Resource Description Framework (RDF) Schema Specification 1.0. http://www.w3.org/TR/rdf-schema/, 2000.


to RGML Home Page

Updated: June 21 2001