Describing Structure and Semantics of Graphs Using an RDF Vocabulary
John R. Punin
Mukkai Krishnamoorthy
Rensselaer Polytechnic Institute
Department of Computer Science
2001
Outline
- Introduction to Resource Description Framework (RDF)
- RDF Graph Modeling Language (RGML)
- WWWPal System
- RGML Schema
- RGML Examples
- Notation 3 and Graph Rules
- Conclusions
Resource Description Framework (RDF)
RDF Model and Syntax
- Language to describe resources
- Use metadata (data about data) to describe Web resources
- Provides interoperability between applications that exchange
machine-understandable information on the Web
- Use XML as a syntax
Application Areas
- Resource discovery - better search engine capabilities
- Cataloging - describe content and content relationship (web pages)
- Intelligent software agents - knowledge sharing
- Content Rating - PICS
- Collections of pages
- Intellectual property rights
- Privacy preferences and policies
- Digital signatures - build the "Web of Trust"
Basic RDF Model
Three object types:
- Resources - Things being described by RDF expressions. Resources are always named by URIs
- HTML Document
- Specific XML element within the document source.
- Collection of pages
- Book
- Properties - Specific aspect, characteristic, attribute or relation used
to describe a resource
- Statements - Resource (Subject) +
Property (Predicate) +
Property Value (Object)
Statement Example
John Punin is the creator of the web page http://www.cs.rpi.edu/~puninj/XMLJ/
- Subject (Resource) - http://www.cs.rpi.edu/~puninj/XMLJ/
- Predicate (Property) - Creator
- Object (Literal) - John Punin
RDF Property Elements
- Property names must be associated with a schema.
- Qualify property names with a namespace prefix
- Production propertyElt :
<PropertyName> Value </PropertyName>
- Value - Description element or String
<?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>
Describing Multiple Properties
- Describing creator, title and date of the resource
http://www.cs.rpi.edu/~puninj/XMLJ/
<?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>
Using Abbreviated RDF Syntax
Third basic abbreviation syntax:
- New fact:
http://www.cs.rpi.edu/~puninj/XMLJ/
is an instance of a WebPage
- rdf:type element adds this new fact
- value of the rdf:type can be used directly as element name
<?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>
RDF Containers
- Bag - An unordered list of resources or literals
- Sequence - An ordered list of resources or literals
- Alternative - A list of resources or literals that represent alternatives
for the value of a property
Using the Bag Container
Statement: The authors of the book 0201000237 are Alfred, John and Jeffrey
<?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
- Basic vocabulary to describe RDF vocabularies
- Defines properties of the resources (e.g., title, author, subject, etc)
- Defines kinds of resources being describes (books, Web pages, people, etc)
- XML Schema gives specific constraints on the structure of an XML document
- RDF Schema provides information about the interpretation of the RDF statements
RDF Classes and Properties
- Namespace prefix:'rdfs' URI:'http://www.w3.org/2000/01/rdf-schema#'
- Resources may be instances of one or more classes
- Indicated by rdf:type property
- Resource http://www.cs.rpi.edu/students/puninj is rdf:type Student
- Resource http://www.cs.rpi.edu/students/puninj is rdf:type Person
- Student is rdfs:subClassOf Person
- Property-centric approach
- Define properties in terms of the classes of resource to which they apply
RDF Graph Modeling Language (RGML)
- RDF Vocabulary to describe graph structures
- Graphs, Nodes, Edges as Resources
- Relationships between graphs, nodes and edges
- graph G1 has a node N1 and edge E1
- node N1 is the source node of edge E1
- graph G2 is subgraph of graph G1
- Properties of graphs, nodes and edges
- graph G1 is an undirected graph
- node N1 has a weight of "300"
- edge E1 has a label "Table of Contents"
Graph XML vocabularies
- GraphML
- XGMML
- GXL
- GraphXML
<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
WWWPal System (2)
Web site
WWWPal System (3)
IP network
WWWPal System (4)
Log Graphs
RGML Classes and Properties
- RDF Classes
- rgml:Graph - Graph Class
- rgml:Node - Node Class
- rgml:Edge - Edge Class
- RDF Properties
- rgml:directed - direction of the edges
- rgml:label - text representation of graph objects
- rgml:nodes - bag of node resources
- rgml:edges - bag of edge resources
- rgml:graphs - bag of graph resources
- rgml:weight - weight value of the node or edge
- rgml:source - source node of the edge
- rgml:target - target node of the edge
Objectives of RGML
- Graph Structures
- Hypergraphs
- Mixed Graphs
- Directed and Undirected Graphs
- Subgraphs
- Graph Rules
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)
Simple Graph
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
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
- Set of Nodes and Hyperedges
- Hyperedge subset of set of Nodes
- Directed Hypergraph - Ordered set of Nodes
- Undirected Hypergraph - Unordered set of Nodes
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
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
- RDF vocabulary (RGML) to describe the structure and semantics of graphs
- Combine RDF vocabularies
- Logic rules to express graph properties.
- Semantic Portals