Extended Examples (X Notation, NTriples, and RDF/XML)

Howdy folks,

The following are extended versions of the previous examples
showing the X Proposal graph model and notation, alongside 
equivalent NTriples and RDF/XML representations. 

The second example has also been corrected to have complete 
level 1 uriref compression as defined by the X Proposal.

It's interesting (to me at least ;-) to note that of all the
notations, the minimal X notation is by far the most concise,
which may make it more efficient for system dumps and raw
interchange of RDF knowlege than NTriples. If UUIDs are used 
for nodeIDs, then you can mix and match as you like between 
systems with no collisions, and the knowledge is highly portable. 
Just a thought... 

And the graphs generated for the RDF/XML examples when run through
http://www.w3.org/RDF/Validator look "dern perty"  ;-)

Regards,

Patrick

---

Example 1: "John says that Mary says that Bob says that the sky is green":

X Notation Arc Representation:

            -----------> [1,S]
            |              |
            |              ---- subject ------> [2,U,#Sky]
            |              |
            |              ---- predicate ----> [3,U,#is]
            |              |
            |              ---- object -------> [4,U,#green]
            |
      -----------------> [5,S]
      |     |              |
      |     --- subject ----
      |                    |
      |                    ---- predicate ----> [6,U,{rdfq:attributedTo}]
      |                    |
      |                    ---- object -------> [7,U,#Bob]
      |      
  ---------------------> [8,S]
  |   |                    |
  |   --------- subject ----
  |                        |
  |                        ---- predicate ----> [9,U,{rdfq:attributedTo}]
  |                        |
  |                        ---- object -------> [10,U,#Mary]
  |          
  |                      [11,S]
  |                        |
  ------------- subject ----
                           |
                           ---- predicate ----> [12,U,{rdfq:assertedBy}]
                           |
                           ---- object -------> [13,U,#John]
                                            

X Notation Minimal Representation:

   [1,S,2,3,4]
   [2,U,#Sky]
   [3,U,#is]
   [4,U,#green]
   [5,S,1,6,7]
   [6,U,{rdfq:attributedTo}]
   [7,U,#Bob]
   [8,S,5,9,10]
   [9,U,{rdfq:attributedTo}]
   [10,U,#Mary]
   [11,S,8,12,13]
   [12,U,{rdfq:assertedBy}]
   [13,U,#John]

In NTriples, Form 1:

   _:N1 rdfg:type rdfg:SNode .
   _:N1 rdfg:subject _:N2 .
   _:N1 rdfg:predicate _:N3 .
   _:N1 rdfg:object _:N4 .
   _:N2 rdfg:type rdfg:UNode .
   _:N2 rdfg:label <#Sky> .
   _:N3 rdfg:type rdfg:UNode .
   _:N3 rdfg:label <#is> .
   _:N4 rdfg:type rdfg:UNode .
   _:N4 rdfg:label <#green> .
   _:N5 rdfg:type rdfg:SNode .
   _:N5 rdfg:subject _:N1 .
   _:N5 rdfg:predicate _:N6 .
   _:N5 rdfg:object _:N7 .
   _:N6 rdfg:type rdfg:UNode .
   _:N6 rdfg:label rdfq:attributedTo .
   _:N7 rdfg:type rdfg:UNode .
   _:N7 rdfg:label <#Bob> .
   _:N8 rdfg:type rdfg:SNode .
   _:N8 rdfg:subject _:N5 .
   _:N8 rdfg:predicate _:N9 .
   _:N8 rdfg:object _:N10 .
   _:N9 rdfg:type rdfg:UNode .
   _:N9 rdfg:label rdfq:attributedTo .
   _:N10 rdfg:type rdfg:UNode .
   _:N10 rdfg:label <#Mary> .
   _:N11 rdfg:type rdfg:SNode .
   _:N11 rdfg:subject _:N8 .
   _:N11 rdfg:predicate _:N12 .
   _:N11 rdfg:object _:N13 .
   _:N12 rdfg:type rdfg:UNode .
   _:N12 rdfg:label rdfq:assertedBy .
   _:N13 rdfg:type rdfg:UNode .
   _:N13 rdfg:label <#John> .

In NTriples, Form 2:
   
  [
     rdfg:type rdfg:SNode;
     rdfg:subject
     [
        rdfg:type rdfg:SNode;
        rdfg:subject
        [
           rdfg:type rdfg:SNode;
           rdfg:subject
           [
              rdfg:type rdfg:SNode;
              rdfg:subject
	      [
	         rdfg:type rdfg:UNode;
	         rdfg:label <#Sky>
	      ];
              rdfg:predicate
	      [
	         rdfg:type rdfg:UNode;
	         rdfg:label <#is>
	      ];
              rdfg:object [
	         rdfg:type rdfg:UNode;
	         rdfg:label <#green>
	      ];
           ];
           rdfg:predicate
           [
              rdfg:type rdfg:UNode;
              rdfg:label rdfq:attributedTo
           ];
           rdfg:object
           [
              rdfg:type rdfg:UNode;
              rdfg:label <#Bob>
           ];
        ];
        rdfg:predicate
        [
           rdfg:type rdfg:UNode;
           rdfg:label rdfq:attributedTo
        ];
        rdfg:object
        [
           rdfg:type rdfg:UNode;
           rdfg:label <#Mary>
        ];
     ];
     rdfg:predicate
     [
        rdfg:type rdfg:UNode;
        rdfg:label rdfq:assertedBy
     ];
     rdfg:object
     [
        rdfg:type rdfg:UNode;
        rdfg:label <#John>
     ];
  ];

In RDF/XML, Form 1:

   <rdfg:SNode rdf:ID="N1">
      <rdfg:subject   rdf:resource="#N2"/>
      <rdfg:predicate rdf:resource="#N3"/>
      <rdfg:object    rdf:resource="#N4"/>
   </rdfg:SNode>
   <rdfg:UNode rdf:ID="N2"  rdfg:label="#Sky"/>
   <rdfg:UNode rdf:ID="N3"  rdfg:label="#is"/>
   <rdfg:UNode rdf:ID="N4"  rdfg:label="#green"/>
   <rdfg:SNode rdf:ID="N5">
      <rdfg:subject   rdf:resource="#N1"/>
      <rdfg:predicate rdf:resource="#N6"/>
      <rdfg:object    rdf:resource="#N7"/>
   </rdfg:SNode>
   <rdfg:UNode rdf:ID="N6"  rdfg:label="rdfq:attributedTo"/>
   <rdfg:UNode rdf:ID="N7"  rdfg:label="#Bob"/>
   <rdfg:SNode rdf:ID="N8">
      <rdfg:subject   rdf:resource="#N5"/>
      <rdfg:predicate rdf:resource="#N9"/>
      <rdfg:object    rdf:resource="#N10"/>
   </rdfg:SNode>
   <rdfg:UNode rdf:ID="N9"  rdfg:label="rdfq:attributedTo"/>
   <rdfg:UNode rdf:ID="N10" rdfg:label="#Mary"/>
   <rdfg:SNode rdf:ID="N11">
      <rdfg:subject   rdf:resource="#N8"/>
      <rdfg:predicate rdf:resource="#N12"/>
      <rdfg:object    rdf:resource="#N13"/>
   </rdfg:SNode>
   <rdfg:UNode rdf:ID="N12" rdfg:label="rdfq:assertedBy"/>
   <rdfg:UNode rdf:ID="N13" rdfg:label="#John"/>

In RDF/XML, Form 2:

   <rdfg:SNode>
      <rdfg:subject>
         <rdfg:SNode>
            <rdfg:subject>
               <rdfg:SNode>
                  <rdfg:subject>
                     <rdfg:SNode>
                        <rdfg:subject>
                           <rdfg:UNode rdfg:label="#Sky"/>
                        </rdfg:subject>
                        <rdfg:predicate>
                           <rdfg:UNode rdfg:label="#is"/>
                        </rdfg:predicate>
                        <rdfg:object>
                           <rdfg:UNode rdfg:label="#green"/>
                        </rdfg:object>
                     </rdfg:SNode>
                  </rdfg:subject>
                  <rdfg:predicate>
                     <rdfg:UNode rdfg:label="rdfq:attributedTo"/>
                  </rdfg:predicate>
                  <rdfg:object>
                     <rdfg:UNode rdfg:label="#Bob"/>
                  </rdfg:object>
               </rdfg:SNode>
            </rdfg:subject>
            <rdfg:predicate>
               <rdfg:UNode rdfg:label="rdfq:attributedTo"/>
            </rdfg:predicate>
            <rdfg:object>
               <rdfg:UNode rdfg:label="#Mary"/>
            </rdfg:object>
         </rdfg:SNode>
      </rdfg:subject>
      <rdfg:predicate>
         <rdfg:UNode rdfg:label="rdfq:assertedBy"/>
      </rdfg:predicate>
      <rdfg:object>
         <rdfg:UNode rdfg:label="#John"/>
      </rdfg:object>
   </rdfg:SNode>

----------------------------------------------------------------------

Example 2: Typed, Scoped Values

X Notation Arc Representation (with level 1 uriref compression):

         -----------> [1,S]
         |              |
         |              ---- subject ------> [2,U,#status]
         |              |
         |              ---- predicate ----> [3,U,{rdf:label}] <-----
         |              |                                           |
         |              ---- object -------> [4,L,Status]           |
         |                                                          |
         |            [5,S]                                         |
         |              |                                           |
         --- subject ----                                           |
                        |                                           |
                        ---- predicate ----> [6,U,{rdfq:scope}] <---|---
                        |                                           |  |
                        |                                           |  |
                        |                                           |  |
                        ---- object -------> [7,U,xsd:lang:en] <--  |  |
                                               ^ ^               |  |  |
                                               | |               |  |  |
         --------------------------------------- |               |  |  |
         |                                       |               |  |  |
         |            [8,S]                      |               |  |  |
         |              |                        |               |  |  |
         |              ---- subject -------------               |  |  |
         |              |                                        |  |  |
         |              ---- predicate --> [9,U,{rdf:type}]      |  |  |
         |              |                                        |  |  |
         |              ---- object -----> [10,U,{xsd:lang}]     |  |  |
         |                                                       |  |  |
   -----------------> [11,S]                                     |  |  |
   |     |              |                                        |  |  |
   |     --- subject ----                                        |  |  |
   |                    |                                        |  |  |
   |                    ---- predicate --------------------------|---  |
   |                    |                                        |     |
   |                    ---- object -------> [12,L,English]      |     |
   |                                                             |     |
   |                  [13,S]                                     |     |
   |                    |                                        |     |
   --------- subject ----                                        |     |
                        |                                        |     |
                        ---- predicate --------------------------|------
                        |                                        |
                        ---- object ------------------------------

X Notation Minimal Representation:

   [1,S,2,3,4]
   [2,U,#status]
   [3,U,{rdf:label}]
   [4,L,Status]
   [5,S,1,6,7]
   [6,U,{rdfq:scope}]
   [7,U,xsd:lang:en]
   [8,S,7,9,10]
   [9,U,{rdf:type}]
   [10,U,{xsd:lang}]
   [11,S,7,3,12]
   [12,L,English]
   [13,S,11,6,7]

In NTriples:

   _:N1 rdfg:type rdfg:SNode .
   _:N1 rdfg:subject _:N2 .
   _:N1 rdfg:predicate _:N3 .
   _:N1 rdfg:object _:N4 .
   _:N2 rdfg:type UNode . 
   _:N2 rdfg:label <#status> .
   _:N3 rdfg:type rdfg:UNode . 
   _:N3 rdfg:label rdf:label .
   _:N4 rdfg:type rdfg:LNode . 
   _:N4 rdfg:label "Status" .
   _:N5 rdfg:type rdfg:SNode .
   _:N5 rdfg:subject _:N1 .
   _:N5 rdfg:predicate _:N6 .
   _:N5 rdfg:object _:N7 .
   _:N6 rdfg:type rdfg:UNode . 
   _:N6 rdfg:label rdfq:scope .
   _:N7 rdfg:type rdfg:UNode . 
   _:N7 rdfg:label <xsd:lang:en> .
   _:N8 rdfg:type rdfg:SNode .
   _:N8 rdfg:subject _:N7 .
   _:N8 rdfg:predicate _:N9 .
   _:N8 rdfg:object _:N10 .
   _:N9 rdfg:type rdfg:UNode . 
   _:N9 rdfg:label rdf:type .
   _:N10 rdfg:type rdfg:UNode . 
   _:N10 rdfg:label xsd:lang .
   _:N11 rdfg:type rdfg:SNode .
   _:N11 rdfg:subject _:N7 .
   _:N11 rdfg:predicate _:N3 .
   _:N11 rdfg:object _:N12 .
   _:N12 rdfg:type rdfg:LNode . 
   _:N12 rdfg:label "English" .
   _:N13 rdfg:type rdfg:SNode .
   _:N13 rdfg:subject _:N11 .
   _:N13 rdfg:predicate _:N6 .
   _:N13 rdfg:object _:N7 .

In RDF/XML:

   <rdfg:SNode rdf:ID="N1">
      <rdfg:subject   rdf:resource="#N2"/>
      <rdfg:predicate rdf:resource="#N3"/>
      <rdfg:object    rdf:resource="#N4"/>
   </rdfg:SNode>
   <rdfg:UNode rdf:ID="N2"  rdfg:label="#status"/>
   <rdfg:UNode rdf:ID="N3"  rdfg:label="rdf:label"/>
   <rdfg:LNode rdf:ID="N4"  rdfg:label="Status"/>
   <rdfg:SNode rdf:ID="N5">
      <rdfg:subject   rdf:resource="#N1"/>
      <rdfg:predicate rdf:resource="#N6"/>
      <rdfg:object    rdf:resource="#N7"/>
   </rdfg:SNode>
   <rdfg:UNode rdf:ID="N6"  rdfg:label="rdfq:scope"/>
   <rdfg:UNode rdf:ID="N7"  rdfg:label="xsd:lang:en"/>
   <rdfg:SNode rdf:ID="N8">
      <rdfg:subject   rdf:resource="#N7"/>
      <rdfg:predicate rdf:resource="#N9"/>
      <rdfg:object    rdf:resource="#N10"/>
   </rdfg:SNode>
   <rdfg:UNode rdf:ID="N9"  rdfg:label="rdf:type"/>
   <rdfg:UNode rdf:ID="N10" rdfg:label="xsd:lang"/>
   <rdfg:SNode rdf:ID="N11">
      <rdfg:subject   rdf:resource="#N7"/>
      <rdfg:predicate rdf:resource="#N3"/>
      <rdfg:object    rdf:resource="#N12"/>
   </rdfg:SNode>
   <rdfg:LNode rdf:ID="N12" rdfg:label="English"/>
   <rdfg:SNode rdf:ID="N13">
      <rdfg:subject   rdf:resource="#N11"/>
      <rdfg:predicate rdf:resource="#N6"/>
      <rdfg:object    rdf:resource="#N7"/>
   </rdfg:SNode>


--
               
Patrick Stickler              Phone: +358 50 483 9453
Senior Research Scientist     Fax:   +358 7180 35409
Nokia Research Center         Email: patrick.stickler@nokia.com

Received on Tuesday, 13 November 2001 15:21:21 UTC