Describing Structure and Semantics of Graphs Using an RDF Vocabulary

John R. Punin
Mukkai Krishnamoorthy


Rensselaer Polytechnic Institute
Department of Computer Science
2001

Outline

Resource Description Framework (RDF)

RDF Model and Syntax

Application Areas

Basic RDF Model

Three object types:

Statement Example

John Punin is the creator of the web page http://www.cs.rpi.edu/~puninj/XMLJ/


RDF statement figure

RDF Property Elements

   <?xml version="1.0"?>
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	    xmlns:dc="http://purl.org/dc/elements/1.1/">
     <rdf:Description rdf:about="http://www.cs.rpi.edu/~puninj/XMLJ/">
       <dc:creator>John Punin</dc:creator>
     </rdf:Description>
   </rdf:RDF>
RDF Syntax Diagram

Describing Multiple Properties

   <?xml version="1.0"?>
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	    xmlns:dc="http://purl.org/dc/elements/1.1/">
     <rdf:Description rdf:about="http://www.cs.rpi.edu/~puninj/XMLJ/">
       <dc:creator>John Punin</dc:creator>
       <dc:title>Programming XML in Java</dc:title>
       <dc:date>2001-04-10</dc:date>
     </rdf:Description>
   </rdf:RDF>
RDF Syntax Diagram

Using Abbreviated RDF Syntax

Third basic abbreviation syntax:

   <?xml version="1.0"?>
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   	    xmlns:dc="http://purl.org/dc/elements/1.1/">
     <rdf:Description rdf:about="http://www.cs.rpi.edu/~puninj/XMLJ/">
       <rdf:type rdf:resource="http://www.schemas.org/www/Webpage"/>
       <dc:creator>John Punin</dc:creator>
       <dc:title>Programming XML in Java</dc:title>
       <dc:date>2001-04-10</dc:date>
     </rdf:Description>
   </rdf:RDF>

   <?xml version="1.0"?>
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	    xmlns:dc="http://purl.org/dc/elements/1.1/"
	    xmlns:s="http://www.schemas.org/www/">
     <s:WebPage rdf:about="http://www.cs.rpi.edu/~puninj/XMLJ/">
       <dc:creator>John Punin</dc:creator>
       <dc:title>Programming XML in Java</dc:title>
       <dc:date>2001-04-10</dc:date>
     </s:WebPage>
   </rdf:RDF>
Statement Diagram with new fact

RDF Containers

Using the Bag Container

Statement: The authors of the book 0201000237 are Alfred, John and Jeffrey

Statement using Bag Container
   <?xml version="1.0"?>
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   	    xmlns:dc="http://purl.org/dc/elements/1.1/">
     <rdf:Description rdf:about="urn:ISBN:0-201-00023-7">
       <dc:creator>
           <rdf:Bag>
	      <rdf:li>Alfred</rdf:li>
	      <rdf:li>John</rdf:li>
	      <rdf:li>Jeffrey</rdf:li>
           </rdf:Bag>
       </dc:creator>
     </rdf:Description>
   </rdf:RDF>

RDF Schema

RDF Classes and Properties

RDF Graph Modeling Language (RGML)

Graph XML vocabularies

   <graph>
      <node id="n1"/>
      <node id="n2"/>
      <edge source="n1" target="n2"/>
   </graph>

WWWPal System - Analysis and Organization of Web Sites

Display of a Graph of a Web Site

Graph of a website

WWWPal System (2)

Web site

Website Graph

WWWPal System (3)

IP network

Graph of IP network

WWWPal System (4)

Log Graphs

Image of RPI Website

RGML Classes and Properties

Objectives of RGML

RGML Schema


<?xml version="1.0" ?> 
<!-- 
     RDF Schema declaration for RDF Graph Modeling Language (RGML) 1.0 
     <http://purl.org/puninj/2001/05/rgml-schema#>
     
     John Punin (puninj@cs.rpi.edu)
     05-26-2001
-->
<rdf:RDF 
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
     xmlns:rgml="http://purl.org/puninj/2001/05/rgml-schema#">

<!-- Class Declarations -->

<!-- Graph Class declaration -->

  <rdfs:Class rdf:ID="Graph" 
    rdfs:label="Graph"
    rdfs:comment="A Graph Description">
    <rdfs:isDefinedBy rdf:resource="http://purl.org/puninj/2001/05/rgml-schema#"/>
  </rdfs:Class>

<!-- Node Class declaration -->

  <rdfs:Class rdf:ID="Node" 
    rdfs:label="Node"
    rdfs:comment="A Node Description">
    <rdfs:isDefinedBy rdf:resource="http://purl.org/puninj/2001/05/rgml-schema#"/>
  </rdfs:Class>

<!-- Edge Class declaration -->

  <rdfs:Class rdf:ID="Edge" 
    rdfs:label="Edge"
    rdfs:comment="An Edge Description">
    <rdfs:isDefinedBy rdf:resource="http://purl.org/puninj/2001/05/rgml-schema#"/>
  </rdfs:Class>

<!-- Property declarations -->

<!-- Global Properties -->

 <rdf:Property rdf:ID="label"
    rdfs:label="label"
    rdfs:comment="Text representation of the graph elements">
   <rdfs:isDefinedBy rdf:resource="http://purl.org/puninj/2001/05/rgml-schema#"/> 
   <rdfs:domain rdf:resource="http://purl.org/puninj/2001/05/rgml-schema#Graph"/>
   <rdfs:domain rdf:resource="http://purl.org/puninj/2001/05/rgml-schema#Node"/>
   <rdfs:domain rdf:resource="http://purl.org/puninj/2001/05/rgml-schema#Edge"/>
   <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
 </rdf:Property>

<!-- Graph Properties -->

 <rdf:Property rdf:ID="directed"
    rdfs:label="directed"
    rdfs:comment="Boolean value to indicate whether the Graph is directed or not">
   <rdfs:isDefinedBy rdf:resource="http://purl.org/puninj/2001/05/rgml-schema#"/> 
   <rdfs:domain rdf:resource="http://purl.org/puninj/2001/05/rgml-schema#Graph"/>
   <rdfs:domain rdf:resource="http://purl.org/puninj/2001/05/rgml-schema#Edge"/>
   <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#boolean"/>
 </rdf:Property>

 <rdf:Property rdf:ID="nodes"
   rdfs:label="Nodes"
   rdfs:comment="List of the nodes belong to the graph">
   <rdfs:domain rdf:resource="http://purl.org/puninj/2001/05/rgml-schema#Graph"/>
   <rdfs:domain rdf:resource="http://purl.org/puninj/2001/05/rgml-schema#Edge"/>
   <rdfs:range rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Resource"/>
 </rdf:Property>

 <rdf:Property rdf:ID="edges"
   rdfs:label="Edges"
   rdfs:comment="List of the edges belong to the graph">
   <rdfs:domain rdf:resource="http://purl.org/puninj/2001/05/rgml-schema#Graph"/>
   <rdfs:range rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag"/>
 </rdf:Property>

 <rdf:Property rdf:ID="graphs"
   rdfs:label="Subgraphs"
   rdfs:comment="List of subgraphs belong to the graph">
   <rdfs:domain rdf:resource="http://purl.org/puninj/2001/05/rgml-schema#Graph"/>
   <rdfs:range rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag"/>
 </rdf:Property>

<!-- Node Properties -->

 <rdf:Property rdf:ID="weight"
    rdfs:label="weight"
    rdfs:comment="Value (usually numerical) to show the node or edge weight">
   <rdfs:isDefinedBy rdf:resource="http://purl.org/puninj/2001/05/rgml-schema#"/> 
   <rdfs:domain rdf:resource="http://purl.org/puninj/2001/05/rgml-schema#Node"/>
   <rdfs:domain rdf:resource="http://purl.org/puninj/2001/05/rgml-schema#Edge"/>
   <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
 </rdf:Property>

<!-- Edge Properties -->

 <rdf:Property rdf:ID="source"
    rdfs:label="source"
    rdfs:comment="The source node of the edge">
   <rdfs:isDefinedBy rdf:resource="http://purl.org/puninj/2001/05/rgml-schema#"/> 
   <rdfs:domain rdf:resource="http://purl.org/puninj/2001/05/rgml-schema#Edge"/>
   <rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf-schema#Resource"/>
 </rdf:Property>

 <rdf:Property rdf:ID="target"
    rdfs:label="target"
    rdfs:comment="The target node of the edge">
   <rdfs:isDefinedBy rdf:resource="http://purl.org/puninj/2001/05/rgml-schema#"/> 
   <rdfs:domain rdf:resource="http://purl.org/puninj/2001/05/rgml-schema#Edge"/>
   <rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf-schema#Resource"/>
 </rdf:Property>

</rdf:RDF>

RGML Schema (Graph Visualization using FRODO RDFSViz)

RDF Schema Diagram

Simple Graph

Simple Graph Image

RGML file:

<?xml version="1.0" encoding="utf-8"?> 

<rdf:RDF 
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
  xmlns="http://purl.org/puninj/2001/05/rgml-schema#"
  xmlns:rgml="http://purl.org/puninj/2001/05/rgml-schema#"
> 

<Graph rdf:ID="g1" rgml:directed="#true">
   <nodes>
      <rdf:Bag>
         <rdf:li rdf:resource="#n1"/>
         <rdf:li rdf:resource="#n2"/>
         <rdf:li rdf:resource="#n3"/>
      </rdf:Bag>
   </nodes>

   <edges>
      <rdf:Bag>
         <rdf:li rdf:resource="#e1"/>
         <rdf:li rdf:resource="#e2"/>
      </rdf:Bag>
   </edges>
</Graph>

<Node rdf:ID="n1"/>
<Node rdf:ID="n2"/>
<Node rdf:ID="n3"/>

<Edge rdf:ID="e1">
    <source rdf:resource="#n1"/>
    <target rdf:resource="#n2"/>
</Edge>
<Edge rdf:ID="e2">
    <source rdf:resource="#n1"/>
    <target rdf:resource="#n3"/>
</Edge>

</rdf:RDF>

Webgraph Example

Webgraph Example

RGML file:

<?xml version="1.0" encoding="utf-8"?> 

<rdf:RDF 
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
  xmlns="http://purl.org/puninj/2001/05/rgml-schema#"
  xmlns:rgml="http://purl.org/puninj/2001/05/rgml-schema#"
  xmlns:dc="http://purl.org/dc/elements/1.1/"> 

<Graph rdf:ID="g1" rgml:directed="true">
   <nodes>
      <rdf:Bag>
         <rdf:li rdf:resource="#n1"/>
         <rdf:li rdf:resource="#n2"/>
         <rdf:li rdf:resource="#n3"/>
      </rdf:Bag>
   </nodes>

   <edges>
      <rdf:Bag>
         <rdf:li rdf:resource="#e1"/>
         <rdf:li rdf:resource="#e2"/>
      </rdf:Bag>
   </edges>
</Graph>

<Node rdf:ID="n1" rgml:label="http://www.cs.rpi.edu/" 
      rgml:weight="3678">
  <dc:title>Rensselaer Computer Science Department</dc:title>
  <dc:date>2001-03-01</dc:date>
  <dc:format>text/html</dc:format>
</Node>
<Node rdf:ID="n2" rgml:label="http://www.cs.rpi.edu/people/" 
      rgml:weight="10611">
  <dc:title>People at Rensselaer Computer Science Department</dc:title>
  <dc:date>2001-02-26</dc:date>
  <dc:format>text/html</dc:format>
</Node>
<Node rdf:ID="n3" rgml:label="http://www.cs.rpi.edu/courses/"
      rgml:weight="6968">
  <dc:title>Courses at Rensselaer Computer Science Department</dc:title>
  <dc:date>2001-01-25</dc:date>
  <dc:format>text/html</dc:format>
</Node>

<Edge rdf:ID="e1" rgml:label="Courses">
    <source rdf:resource="#n1"/>
    <target rdf:resource="#n2"/>
</Edge>
<Edge rdf:ID="e2" rgml:label="People">
    <source rdf:resource="#n1"/>
    <target rdf:resource="#n3"/>
</Edge>

</rdf:RDF>

Hypergraph Example

RGML file:

<?xml version="1.0" encoding="utf-8"?> 

<rdf:RDF 
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
  xmlns="http://purl.org/puninj/2001/05/rgml-schema#"
  xmlns:rgml="http://purl.org/puninj/2001/05/rgml-schema#"
> 

<Graph rdf:ID="g1" rgml:directed="true">
   <nodes>
      <rdf:Bag>
         <rdf:li rdf:resource="#n1"/>
         <rdf:li rdf:resource="#n2"/>
         <rdf:li rdf:resource="#n3"/>
         <rdf:li rdf:resource="#n4"/>
      </rdf:Bag>
   </nodes>

   <edges>
      <rdf:Bag>
         <rdf:li rdf:resource="#e1"/>
         <rdf:li rdf:resource="#e2"/>
      </rdf:Bag>
   </edges>
</Graph>

<Node rdf:ID="n1"/>
<Node rdf:ID="n2"/>
<Node rdf:ID="n3"/>
<Node rdf:ID="n4"/>


<Edge rdf:ID="e1">
    <source rdf:resource="#n1"/>
    <target rdf:resource="#n2"/>
</Edge>

<Edge rdf:ID="e2">
   <nodes>
      <rdf:Seq>
         <rdf:li rdf:resource="#n2"/>
         <rdf:li rdf:resource="#n3"/>
         <rdf:li rdf:resource="#n4"/>
      </rdf:Seq>
   </nodes>
</Edge>

</rdf:RDF>

Subgraph Example

Subgraph Example

RGML file:

<?xml version="1.0" encoding="utf-8"?> 

<rdf:RDF 
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
  xmlns="http://purl.org/puninj/2001/05/rgml-schema#"
  xmlns:rgml="http://purl.org/puninj/2001/05/rgml-schema#">

<Graph rdf:ID="g1" rgml:directed="true">
   <graphs>
      <rdf:Bag>
         <rdf:li rdf:resource="#g2"/>
         <rdf:li rdf:resource="#g3"/>
      </rdf:Bag>
   </graphs>
</Graph>

<Graph rdf:ID="g2" rgml:directed="true">
   <nodes>
      <rdf:Bag>
         <rdf:li rdf:resource="#n1"/>
         <rdf:li rdf:resource="#n2"/>
      </rdf:Bag>
   </nodes>

   <edges>
      <rdf:Bag>
         <rdf:li rdf:resource="#e1"/>
      </rdf:Bag>
   </edges>
</Graph>

<Graph rdf:ID="g3" rgml:directed="true">
   <nodes>
      <rdf:Bag>
         <rdf:li rdf:resource="#n3"/>
         <rdf:li rdf:resource="#n4"/>
      </rdf:Bag>
   </nodes>

   <edges>
      <rdf:Bag>
         <rdf:li rdf:resource="#e2"/>
      </rdf:Bag>
   </edges>
</Graph>

<Node rdf:ID="n1"/>
<Node rdf:ID="n2"/> 
<Node rdf:ID="n3"/>
<Node rdf:ID="n4"/>

<Edge rdf:ID="e1">
    <source rdf:resource="#n1"/>
    <target rdf:resource="#n2"/>
</Edge>
<Edge rdf:ID="e2">
    <source rdf:resource="#n3"/>
    <target rdf:resource="#n4"/>
</Edge>

</rdf:RDF>

Notation 3

RDF triples: Subject, Predicate, Object
   <#pat> <#child>  <#al>, <#chaz>, <#mo> ;
          <#age>    "24" ;
          <#eyecolor> "blue" .
Making Vocabularies
   @prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
   @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

   :Person a rdfs:Class.
   :Pat a :Person.
   :Woman a rdfs:Class; subClassOf :Person .
   :sister rdfs:domain :Person; rdfs:range :Woman.

RGML using Notation 3

Simple Graph

@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 xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix : <simple_graph#> .

:g1 a rgml:Graph; 
    rgml:directed "true";
    rgml:nodes :n1;
    rgml:nodes :n2;
    rgml:nodes :n3;
    rgml:edges :e1;
    rgml:edges :e2 .

:n1 a rgml:Node .
:n2 a rgml:Node .
:n3 a rgml:Node .

:e1 a rgml:Edge ;
    rgml:source :n1;
    rgml:target :n2 .

:e2 a rgml:Edge ;
    rgml:source :n1;
    rgml:target :n3 .

#ends

RGML Graph rules


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 :
  @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.

Proof Engines

Graph Path

Path - sequence of consecutive nodes

This example is a modification of Jos De Roo's graph example

    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)

Notation 3 :
   @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.

Conclusions