Making RDF Syntax Clear

Proposal of a DTD and minor syntax enhancement to RDF, to overcome many of the current practical difficulties.

Rick Jelliffe, Topologi Pty. Ltd.


The current RDF Recommendation is almost impossible to implement because the discipline of a DTD was not used. Consequently, RDF implementations lack exchangability, and most people coming to the RDF Spec (from outside the 'RDF Community') expecting clear description of syntax must go away disappointed/

Furthermore, the advent of RDFS raises compatability issues, in that certain elements are used in RDFS, but are only general names in RDF.

This proposal suggests the the situation could be improved by:

I propose that this DTD should be included as a normative part of the RDF specification, and the BNF sections removed or reworded to fit in with it.

Approach and Advantages

The main features of this proposal are:

Of course, this DTD does not reflect several constraints in RDF, such as the co-occurrence of value attributes and contents. However, XML Schemas cannot represent this either: some alternative like Schematron or RELAX could be used for that. The handling of the abbreviated syntax has always been problematic: the solution here is to allow the DTD creator to freely add their own _n declarations as needed. However, probably only Schematron can handle this constraint (i.e. where the names of allowed attributes can only be known by string matching not by enumeration.)


<!-- ===================================================================== -->
                Architectural DTD for Resource Description Framework (RDF)

                Created from the document:
                        "Resource Description Framework (RDF) Model and 
                        Syntax Specification "
                        W3C Recommendation 22 February 1999
                and   "Resource Description Framework (RDF) 
			Schema Specification 1.0"
			W3C Candidate Recommendation 27 March 2000
                Created by: 
                        Rick Jelliffe, Topologi, Pty. Ltd.
<!-- =================== PARAMETER ENTITY DECLARATIONS ==================== -->
        <!ENTITY % propEltAttr                        
               "rdf:ID              ID #IMPLIED
                rdf:parseType       ( Resource | Literal ) #IMPLIED 
                rdf:resource        CDATA #IMPLIED 
                rdf:bagID           NMTOKEN #IMPLIED
	        rdf:value       CDATA #IMPLIED"  >  

        <!ENTITY % rdf-propEltAttr                        
               "rdf:ID              ID #IMPLIED
                rdf:parseType       ( Resource | Literal ) #IMPLIED 
                rdf:resource        CDATA #IMPLIED 
                rdf:bagID           NMTOKEN #IMPLIED
	        rdf:value       CDATA #IMPLIED"  >  

	<!ENTITY % rdf-alt-syntax-atts
	'        rdf:_1 CDATA #IMPLIED
                rdf:_2 CDATA #IMPLIED
                rdf:_3 CDATA #IMPLIED
                rdf:_4 CDATA #IMPLIED
                rdf:_5 CDATA #IMPLIED
                rdf:_6 CDATA #IMPLIED
                rdf:_7 CDATA #IMPLIED
                rdf:_8 CDATA #IMPLIED   '>

	<!ENTITY % rdf-extra-containers "" >
	<!ENTITY % rdf-extra-property-types "" >
	<!ENTITY % rdf-li-types "" >

<!-- =================== ELEMENT TYPE DECLARATIONS =========================== --> 
        <!ELEMENT rdf:RDF       ( rdf:Description | rdf:Bag | rdf:Seq | rdf:Alt %rdf-extra-containers; )* >
        <!ATTLIST rdf:RDF
	        xsi:type CDATA #FIXED "rdf:RDF"
                xmlns:rdf CDATA #FIXED
                        "" >      
	<!ENTITY % rdf-RDF-content
'               ( rdf:Description | rdf:Bag | rdf:Seq | rdf:Alt %rdf-extra-containers; )*  
  	<!ENTITY % rdf-RDF-atts
'	        xsi:type CDATA #FIXED "rdf:RDF-type"
                xmlns:rdf CDATA #FIXED
        <!ELEMENT rdf:Description   ( rdf:Property | rdf:Seq | rdf:Alt | rdf:Bag |
		| rdf:subject | rdf:object | rdf:type | rdf:predicate %rdf-extra-property-types; )* >	
        <!ATTLIST rdf:Description 
	        xsi:type CDATA #FIXED "rdf:Description"
                ID                    ID #IMPLIED
                type                  CDATA #IMPLIED
                about                 CDATA #IMPLIED 
                aboutEach             CDATA #IMPLIED
                aboutEachPrefix       CDATA #IMPLIED    
                bagID                 NMTOKEN #IMPLIED >
	<!ENTITY % rdf-Description-contents
'		( rdf:Property | rdf:Seq | rdf:Alt | rdf:Bag |
		| rdf:subject | rdf:object | rdf:type | rdf:predicate %rdf-extra-property-types; )*
         <!ENTITY % rdf-Description-atts 
'		xsi:type CDATA #FIXED "rdf:Description-type"
                rdf:ID                    ID #IMPLIED
                rdf:type                  CDATA #IMPLIED
                rdf:about                 CDATA #IMPLIED 
                rdf:aboutEach             CDATA #IMPLIED
                rdf:aboutEachPrefix       CDATA #IMPLIED    
                rdf:bagID                 NMTOKEN #IMPLIED 
        <!ELEMENT rdf:Seq       ( rdf:li %rdf-li-types; )* >
        <!ATTLIST rdf:Seq
	        xsi:type CDATA #FIXED "rdf:Seq"
	<!ENTITY % rdf-container-contents
'		 ( rdf:li %rdf-li-types; )*
	<!ENTITY % rdf-Seq-atts
'	        xsi:type CDATA #FIXED "rdf:Seq-type"
		rdf:ID  ID #IMPLIED  
        <!ELEMENT rdf:Bag  (  rdf:li %rdf-li-types;)* >
        <!ATTLIST rdf:Bag
	        xsi:type CDATA #FIXED "rdf:Bag"
                ID  ID #IMPLIED
		%rdf-alt-syntax-atts;  >
	<!ENTITY % rdf-Bag-atts
'	        xsi:type CDATA #FIXED "rdf:Bag-type"
                rdf:ID  ID #IMPLIED   
        <!ELEMENT rdf:Alt  (  rdf:li %rdf-li-types;)* > 
        <!ATTLIST rdf:Alt
	        xsi:type CDATA #FIXED "rdf:Alt"
		%rdf-alt-syntax-atts; >
	<!ENTITY % rdf-Alt-atts
'	        xsi:type CDATA #FIXED "rdf:Alt-type"
        <!ELEMENT rdf:li  ANY > 
        <!ATTLIST rdf:li
	        xsi:type CDATA #FIXED "rdf:li"
                resource                CDATA #IMPLIED 
                parseType               ( Resource | Literal ) #IMPLIED  >         
	<!ENTITY % rdf-li-atts
'	        xsi:type CDATA #FIXED "rdf:li-type"
                rdf:resource                CDATA #IMPLIED 
                rdf:parseType               ( Resource | Literal ) #IMPLIED 
	<!ELEMENT rdf:Property  ANY >
	<!ATTLIST rdf:Property
	        xsi:type CDATA #FIXED "rdf:Property"
	              %propEltAttr; >
	<!ENTITY % rdf-Property-atts
'	        xsi:type CDATA #FIXED "rdf:Property-type"

        <!ELEMENT rdf:subject  ANY>
        <!ATTLIST rdf:subject
	        xsi:type CDATA #FIXED "rdf:subject"
                %propEltAttr; >
	<!ENTITY % rdf-subject-atts
'	        xsi:type CDATA #FIXED "rdf:subject-type"
                %rdf-propEltAttr; >
        <!ELEMENT rdf:predicate ANY>
        <!ATTLIST rdf:predicate
		xsi:type CDATA #FIXED "rdf:predicate"
                %propEltAttr; >
	<!ENTITY % rdf-predicate-atts
'		xsi:type CDATA #FIXED "rdf:predicate-type"
                %rdf-propEltAttr; >
        <!ELEMENT rdf:object    ANY>
        <!ATTLIST rdf:object
	        xsi:type CDATA #FIXED "rdf:object"
		%propEltAttr; >
	<!ENTITY % rdf-object-atts
'	        xsi:type CDATA #FIXED "rdf:object-type"
		%rdf-propEltAttr; >
        <!ELEMENT rdf:type      ANY>
        <!ATTLIST rdf:type
	        xsi:type CDATA #FIXED "rdf:type"
		%propEltAttr; >
	<!ENTITY % rdf-type-atts
'	        xsi:type CDATA #FIXED "rdf:type-type"
		%rdf-propEltAttr; >
        <!ELEMENT rdf:value ANY>
        <!ATTLIST rdf:value
	        xsi:type CDATA #FIXED "rdf:value"
	<!ENTITY % rdf-value-atts
'	        xsi:type CDATA #FIXED "rdf:value-type"

Why DTDs now?

Given the RDF communities obvious (from the lack of a DTD) antipathy to DTDs, I expect the obvious question will be "Why DTDs now?", since there is talk of XML Schemas and alternative syntaxes.

My answers would be some combination of