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

Statement Example (2)

John Punin whose e-mail is puninj@cs.rpi.edu is the creator of the web page http://www.cs.rpi.edu/~puninj/XMLJ

RDF statement figure

Basic Serialization Syntax

The RDF root element and namespace:
   <?xml version="1.0"?>
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    .
    .
    .
   </rdf:RDF>

The RDF Description Element

   <?xml version="1.0"?>
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
     <rdf:Description about="http://www.cs.rpi.edu/~puninj/XMLJ/">
      .
      .
      .
     </rdf:Description>
   </rdf:RDF>

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 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 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

Describing Multiple Resources

   <?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 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:Description about="http://www.cs.rpi.edu/~puninj/XGMML/">
       <dc:creator>John Punin</dc:creator>
       <dc:title>Extensible Graph Markup and Modeling Language</dc:title>
       <dc:date>2001-04-04</dc:date>
     </rdf:Description>
   </rdf:RDF>
RDF Syntax Diagram

Nesting Resources

   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	    xmlns:dc="http://purl.org/dc/elements/1.1/"
	    xmlns:vcard="http://imc.org/vCard/3.0#">
     <rdf:Description about="http://www.cs.rpi.edu/~puninj/XMLJ/">
       <dc:creator>
          <rdf:Description>
             <vcard:FN>John Punin</vcard:FN>
             <vcard:EMAIL>puninj@cs.rpi.edu</vcard:EMAIL>
          </rdf:Description>
       </dc:creator>
     </rdf:Description>
   </rdf:RDF>
RDF Syntax Diagram

Referring to Resources by Reference


   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	    xmlns:dc="http://purl.org/dc/elements/1.1/"
	    xmlns:vcard="http://imc.org/vCard/3.0#">
     <rdf:Description about="http://www.cs.rpi.edu/~puninj/XMLJ/">
       <dc:creator rdf:resource="http://www.cs.rpi.edu/students/puninj"/>
     </rdf:Description>

     <rdf:Description about="http://www.cs.rpi.edu/students/puninj">
         <vcard:FN>John Punin</vcard:FN>
         <vcard:EMAIL>puninj@cs.rpi.edu</vcard:EMAIL>
     </rdf:Description>
   </rdf:RDF>

Statement Diagram with rdf:Resource

Using XML in Property Elements

   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	    xmlns="http://www.w3.org/1998/Math/MathML"
	    xmlns:dc="http://purl.org/dc/elements/1.1/">
     <rdf:Description about="http://www.cs.rpi.edu/TR/tr01/">
       <dc:title rdf:parseType="Literal">
         Solving 
           <mrow>
            <mrow><msup><mi>x</mi><mn>2</mn></msup><mo>+</mo><mn>1</mn></mrow>
            <mo>=</mo><mn>0</mn>
           </mrow>
       </dc:title>
       <dc:date>2020-01-30</dc:date>
     </rdf:Description>
   <rdf:RDF>

Using Abbreviated RDF Syntax

First 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 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>


<?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 about="http://www.cs.rpi.edu/~puninj/XMLJ/"
    dc:creator="John Punin" dc:title="Programming XML in Java"
    dc:date="2001-04-10"/>
</rdf:RDF>

Using Abbreviated RDF Syntax (2)

Second basic abbreviation syntax:
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
            xmlns:dc="http://purl.org/dc/elements/1.1/"
            xmlns:vcard="http://imc.org/vCard/3.0#">
     <rdf:Description about="http://www.cs.rpi.edu/~puninj/XMLJ/">
       <dc:creator>
          <rdf:Description about="http://www.cs.rpi.edu/students/puninj">
             <vcard:FN>John Punin</vcard:FN>
             <vcard:EMAIL>puninj@cs.rpi.edu</vcard:EMAIL>
          </rdf:Description>
       </dc:creator>
     </rdf:Description>
   </rdf:RDF>

   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	    xmlns:dc="http://purl.org/dc/elements/1.1/"
	    xmlns:vcard="http://imc.org/vCard/3.0#">
     <rdf:Description about="http://www.cs.rpi.edu/~puninj/XMLJ/">
       <dc:creator rdf:resource="http://www.cs.rpi.edu/students/puninj"
                   vcard:FN="John Punin"
                   vcard:EMAIL="puninj@cs.rpi.edu"/>
     </rdf:Description>
   </rdf:RDF>

Using Abbreviated RDF Syntax (2)

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 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 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 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>

Using the Seq Container

Statement:   The students of the course csci-2962 in alphabetical order are Elizabeth, George and John.

Statement using Seq Container
   <?xml version="1.0"?>
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	    xmlns:s="http://www.schemas.org/Course/">
     <rdf:Description about="http://www.cs.rpi.edu/courses/csci-2962">
       <s:students>
           <rdf:Seq>
	      <rdf:li rdf:resource="http://www.cs.rpi.edu/students/er"/>
	      <rdf:li rdf:resource="http://www.cs.rpi.edu/students/gl"/>
	      <rdf:li rdf:resource="http://www.cs.rpi.edu/students/js"/>
           </rdf:Seq>
       </s:students>
     </rdf:Description>
   </rdf:RDF>

Using the Alt Container

Statement:   The format of the book 0201000237 are plain text, html and postscript.

Statement using the Alt 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 about="urn:ISBN:0-201-00023-7">
       <dc:format>
           <rdf:Alt>
	      <rdf:li>text/html</rdf:li>
	      <rdf:li>text/plain</rdf:li>
	      <rdf:li>application/postscript</rdf:li>
           </rdf:Alt>
       </dc:format>
     </rdf:Description>
   </rdf:RDF>

Making Statements about Containers

   <?xml version="1.0"?>
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	    xmlns:s="http://www.schemas.org/Course/"
	    xmlns:dc="http://purl.org/dc/elements/1.1/">
     <rdf:Description about="http://www.cs.rpi.edu/~puninj/XMLJ/">
       <s:homeworks>
           <rdf:Bag ID="pages">
	      <rdf:li rdf:resource="http://www.cs.rpi.edu/~puninj/XMLJ/hw1.html">
	      <rdf:li rdf:resource="http://www.cs.rpi.edu/~puninj/XMLJ/hw2.html">
           </rdf:Bag>
       </s:homeworks>
     </rdf:Description>

     <rdf:Description about="#pages">
        <dc:creator>John Punin</dc:creator>
     </rdf:Description>
   </rdf:RDF>

Making Statements about the Items in a Container

   <?xml version="1.0"?>
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	    xmlns:s="http://www.schemas.org/Course/"
	    xmlns:dc="http://purl.org/dc/elements/1.1/">
     <rdf:Description about="http://www.cs.rpi.edu/~puninj/XMLJ/">
       <s:homeworks>
           <rdf:Bag ID="pages">
	     <rdf:li rdf:resource="http://www.cs.rpi.edu/~puninj/XMLJ/hw1.html"/>
	     <rdf:li rdf:resource="http://www.cs.rpi.edu/~puninj/XMLJ/hw2.html"/>
           </rdf:Bag>
       </s:homeworks>
     </rdf:Description>

     <rdf:Description aboutEach="#pages">
        <dc:creator>John Punin</dc:creator>
     </rdf:Description>
   </rdf:RDF>

Statements about Statements

Using Reification

RDF defines the following properties:


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

Statemens about Statments Diagram
   <?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/schema/">
     <rdf:Description>
       <rdf:subject rdf:resource="http://www.cs.rpi.edu/~puninj/XMLJ/"/>
       <rdf:predicate rdf:resource="http://purl.org/dc/elements/1.1/creator"/>
       <rdf:object>John Punin</rdf:object>
       <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/>
       <s:attributedTo>Gerard Uffelman</s:attributedTo>
     </rdf:Description>
   </rdf:RDF>

Non-Binary Relations


Statement: The cost of the book 0201000237 is $45.00

Statement
   <?xml version="1.0"?>
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	    xmlns:s="http://www.schemas.org/Units/">
     <rdf:Description about="urn:ISBN:0-201-00023-7">
       <s:price rdf:parseType="Resource">
          <rdf:value>45.00</rdf:value>
          <s:units rdf:resource="http://www.schemas.org/Units/USdollar"/>
       </s:price>
     </rdf:Description>
   </rdf:RDF>

The Dublin Core Metadata


   <?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 about="http://www.cs.rpi.edu/~puninj/XMLJ/">
       <dc:creator>John Punin</dc:creator>
       <dc:title>Programming XML in Java</dc:title>
       <dc:description>Home Page of Programming XML in Java course</dc:description>
       <dc:date>2001-04-10</dc:date>
       <dc:format>text/html</dc:format>
       <dc:identifier>http://www.cs.rpi.edu/~puninj/XMLJ/</dc:identifier>
       <dc:subject>XML, Java, Computer Science Course</dc:subject>
       <dc:publisher>RPI Computer Science Department</dc:publisher>
       <dc:language>en</dc:language>
       <dc:type>electronic document</dc:type>
     </rdf:Description>
   </rdf:RDF>

Content hiding for RDF inside HTML

   <html>
     <head>
       <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 about=""
                           dc:creator="John Punin"
			   dc:title="Programming XML in Java"
			   dc:date="2001-04-10"/>
       </rdf:RDF>
       <title>Programming XML in Java</title>
     </head>
     <body>
      .
      .
      .
     </body>
   </html>

RDF Resources and Tools

RDF Schema

RDF Classes and Properties

RDF Core Classes

RDF Core Properties

RDF Constraints

RDF Documentation

RDF Schema Example

   <?xml version="1.0"?> 
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
            xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">

   <rdfs:Class rdf:ID="Person">
     <rdfs:comment>Person Class</rdfs:comment>
     <rdfs:subClassOf 
          rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Resource"/>
   </rdfs:Class>

   <rdfs:Class rdf:ID="Student">
     <rdfs:comment>Student Class</rdfs:comment>
     <rdfs:subClassOf rdf:resource="#Person"/>
   </rdfs:Class>

   <rdfs:Class rdf:ID="Teacher">
     <rdfs:comment>Teacher Class</rdfs:comment>
     <rdfs:subClassOf rdf:resource="#Person"/>
   </rdfs:Class>

   <rdfs:Class rdf:ID="Course">
     <rdfs:comment>Course Class</rdfs:comment>
     <rdfs:subClassOf rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Resource"/>
   </rdfs:Class>

   <rdf:Property rdf:ID="teacher">
      <rdfs:comment>Teacher of a course</rdfs:comment>
      <rdfs:domain rdf:resource="#Course"/>	      
      <rdfs:range rdf:resource="#Teacher"/>	      
   </rdf:Property>

   <rdf:Property rdf:ID="students">
      <rdfs:comment>List of Students of a course in alphabetical order</rdfs:comment>
      <rdfs:domain rdf:resource="#Course"/>	      
      <rdfs:range rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq"/>
   </rdf:Property>

   <rdf:Property rdf:ID="name">
      <rdfs:comment>Name of a Person or Course</rdfs:comment>
      <rdfs:domain rdf:resource="#Person"/>	      
      <rdfs:domain rdf:resource="#Course"/>	      
      <rdfs:range rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Literal"/>	      
   </rdf:Property>

   </rdf:RDF>

RDF Example

   <?xml version="1.0"?> 
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	    xmlns="http://www.cs.rpi.edu/~puninj/XMLJ/course_schema.rdf#">
     <Course rdf:ID="csci_2962">
        <name>Programming XML in Java</name>
        <teacher>
            <Teacher rdf:ID="jp">
               <name>John Punin</name>
	    </Teacher>
        </teacher>
        <students>
            <rdf:Seq>
	        <rdf:li>
	           <Student rdf:ID="er">
		      <name>Elizabeth Roberts</name>
		   </Student>
	        </rdf:li>
	        <rdf:li>
	           <Student rdf:ID="gl">
		      <name>George Lucas</name>
		   </Student>
	        </rdf:li>
	        <rdf:li>
	           <Student rdf:ID="js">
		      <name>John Smith</name>
		   </Student>
	        </rdf:li>
            </rdf:Seq>
        </students>
     </Course>
   </rdf:RDF>

Triples of the RDF Example

   1 (online:#csci_2962, http://www.w3.org/1999/02/22-rdf-syntax-ns#type,
   http://www.cs.rpi.edu/~puninj/XMLJ/course_schema.rdf#Course)
   2 (online:#csci_2962,
   http://www.cs.rpi.edu/~puninj/XMLJ/course_schema.rdf#name Programming,
   XML in Java)
   3 (online:#jp, http://www.w3.org/1999/02/22-rdf-syntax-ns#type
   http://www.cs.rpi.edu/~puninj/XMLJ/course_schema.rdf#Teacher)
   4 (online:#jp, http://www.cs.rpi.edu/~puninj/XMLJ/course_schema.rdf#name,
   John Punin)
   5 (online:#csci_2962,
   http://www.cs.rpi.edu/~puninj/XMLJ/course_schema.rdf#teacher,
   online:#jp)
   6 (online:#genid5, http://www.w3.org/1999/02/22-rdf-syntax-ns#type,
   http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq)
   7 (online:#er, http://www.w3.org/1999/02/22-rdf-syntax-ns#type,
   http://www.cs.rpi.edu/~puninj/XMLJ/course_schema.rdf#Student)
   8 (online:#er,
   http://www.cs.rpi.edu/~puninj/XMLJ/course_schema.rdf#name, 
   Elizabeth Roberts)
   9 (online:#genid5, http://www.w3.org/1999/02/22-rdf-syntax-ns#_1,
   online:#er)
   10 (online:#gl, http://www.w3.org/1999/02/22-rdf-syntax-ns#type,
   http://www.cs.rpi.edu/~puninj/XMLJ/course_schema.rdf#Student)
   11 (online:#gl,
   http://www.cs.rpi.edu/~puninj/XMLJ/course_schema.rdf#name, George Lucas)
   12 (online:#genid5, http://www.w3.org/1999/02/22-rdf-syntax-ns#_2,
   online:#gl)
   13 (online:#js, http://www.w3.org/1999/02/22-rdf-syntax-ns#type,
   http://www.cs.rpi.edu/~puninj/XMLJ/course_schema.rdf#Student)
   14 (online:#js, http://www.cs.rpi.edu/~puninj/XMLJ/course_schema.rdf#name,
   John Smith)
   15 (online:#genid5, http://www.w3.org/1999/02/22-rdf-syntax-ns#_3,
   online:#js)
   16 (online:#csci_2962,
   http://www.cs.rpi.edu/~puninj/XMLJ/course_schema.rdf#students,
   online:#genid5)

   The number of triples = 16