XML Object Model Challenge: RDF vs. XMI

David Megginson david at megginson.com
Fri May 28 23:50:05 BST 1999


I think that it would be very useful for someone to us to post the
same simple object model in both the W3C's RDF Schema and the OMG's
XMI, to help XML developers compare the two.  I've included some
simple Java classes and my attempt at an RDF Schema in this message;
any takers for writing the equivalent XMI?

Here's a very dumb object model as a set of Java classes (I'm using
variables for class attributes instead of get/set methods with
interfaces just to keep things short):

  public class Entity
  {
    public String name;
    public String startDate;
    public String endData;
  }

  public class Being extends Entity
  {
    public Being sire;
    public Being dame;
  }

  public class Person extends Being
  {
    public String nationality[];
  }

In RDF, I cannot express the fact that more than one nationality is
allowed for Person, but otherwise, here's my best attempt at a
bare-bones RDF Schema for the same object model:

  <?xml version="1.0"?>

  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	   xmlns:rdfs="http://www.w3.org/TR/1999/PR-rdf-schema-19990303#">

  <rdfs:Class ID="Entity"/>

  <rdfs:Class ID="Being">
  <rdfs:subClassOf rdf:resource="#Entity"/>
  </rdfs:Class>

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

  <rdf:Property ID="name">
  <rdfs:range rdf:resource="#Entity"/>
  <rdfs:domain 
    rdf:resource="http://www.w3.org/TR/1999/PR-rdf-schema-19990303#Literal"/>
  </rdf:Property>

  <rdf:Property ID="startDate">
  <rdfs:range rdf:resource="#Entity"/>
  <rdfs:domain 
    rdf:resource="http://www.w3.org/TR/1999/PR-rdf-schema-19990303#Literal"/>
  </rdf:Property>

  <rdf:Property ID="endDate">
  <rdfs:range rdf:resource="#Entity"/>
  <rdfs:domain 
    rdf:resource="http://www.w3.org/TR/1999/PR-rdf-schema-19990303#Literal"/>
  </rdf:Property>

  <rdf:Property ID="sire">
  <rdfs:range rdf:resource="#Being"/>
  <rdfs:domain rdf:resource="#Being"/>
  </rdf:Property>

  <rdf:Property ID="dame">
  <rdfs:range rdf:resource="#Being"/>
  <rdfs:domain rdf:resource="#Being"/>
  </rdf:Property>

  <rdf:Property ID="nationality">
  <rdfs:range rdf:resource="#Person"/>
  <rdfs:domain 
    rdf:resource="http://www.w3.org/TR/1999/PR-rdf-schema-19990303#Literal"/>
  </rdf:Property>

  </rdf:RDF>

I'd love to see the same thing in XMI.  Any takers?


All the best,


David

-- 
David Megginson                 david at megginson.com
           http://www.megginson.com/

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)





More information about the Xml-dev mailing list