OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   re: XML Object Model Challenge: RDF vs. XMI

[ Lists Home | Date Index | Thread Index ]
  • From: David Megginson <david@megginson.com>
  • To: "XML Developers' List" <xml-dev@ic.ac.uk>
  • Date: Sat, 29 May 1999 06:33:24 -0400 (EDT)

This message contains my original Java version of a set of classes,
the RDF schema representation (corrected so that rdfs:range and
rdfs:domain are transposed), and an autogenerated XMI representation
contributed by Don Park.  The XMI representation is painfully verbose,
probably because it was created by a machine rather than by a human
(it also seems to define a lot of generic Java stuff), so perhaps it
could be made much shorter with human intervention -- can anyone trim
it down?

Here's my original Java version, again:


====================8<====================8<====================
 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[];
 }
====================8<====================8<====================


Here's a corrected version of my RDF schema, with rdfs:range and
rdfs:domain transposed:


====================8<====================8<====================
 <?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:domain rdf:resource="#Entity"/>
 <rdfs:range 
   rdf:resource="http://www.w3.org/TR/1999/PR-rdf-schema-19990303#Literal"/>
 </rdf:Property>

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

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

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

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

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

 </rdf:RDF>
====================8<====================8<====================


Here's the auto-generated XMI that Don Park posted:


====================8<====================8<====================
 <?xml version = "1.0" encoding = "ISO-8859-1" ?>
 <!DOCTYPE XMI SYSTEM "uml.dtd" >
 <XMI>
   <XMI.header>
     <XMI.documentation>
       <XMI.exporter>Argo/UML</XMI.exporter>
       <XMI.exporterVersion>0.7.0</XMI.exporterVersion>
     </XMI.documentation>
     <XMI.metamodel name="uml" version="1.1"/>
   </XMI.header>
   <XMI.content>
     <Model XMI.id = "S.100025">
       <name>untitledpackage</name>
       <visibility XMI.value = "public"/>
       <isAbstract XMI.value="false"/>
       <isLeaf XMI.value="false"/>
       <isRoot XMI.value="false"/>
       <ownedElement>
	 <Class XMI.id = "S.100027">
	   <name>Entity</name>
	   <visibility XMI.value = "public"/>
	   <isAbstract XMI.value="false"/>
	   <isLeaf XMI.value="false"/>
	   <isRoot XMI.value="false"/>
	   <isActive XMI.value = "false"/>
	   <feature>
	     <Attribute XMI.id = "S.100075">
	       <name>name</name>
	       <visibility XMI.value = "public"/>
	       <ownerScope XMI.value="instance"/>
	       <changeable XMI.value="none"/>
	       <multiplicity>1</multiplicity>
	       <targetScope XMI.value="instance"/>
	       <initialValue>
	       </initialValue>
	       <type> <XMI.reference target="S.100003"/> </type>
	       <!-- Type is: String -->
	     </Attribute>
	   </feature>
	   <feature>
	     <Attribute XMI.id = "S.100077">
	       <name>startDate</name>
	       <visibility XMI.value = "public"/>
	       <ownerScope XMI.value="instance"/>
	       <changeable XMI.value="none"/>
	       <multiplicity>1</multiplicity>
	       <targetScope XMI.value="instance"/>
	       <initialValue>
	       </initialValue>
	       <type> <XMI.reference target="S.100003"/> </type>
	       <!-- Type is: String -->
	     </Attribute>
	   </feature>
	   <feature>
	     <Attribute XMI.id = "S.100078">
	       <name>endDate</name>
	       <visibility XMI.value = "public"/>
	       <ownerScope XMI.value="instance"/>
	       <changeable XMI.value="none"/>
	       <multiplicity>1</multiplicity>
	       <targetScope XMI.value="instance"/>
	       <initialValue>
	       </initialValue>
	       <type> <XMI.reference target="S.100003"/> </type>
	       <!-- Type is: String -->
	     </Attribute>
	   </feature>
	 </Class>
       </ownedElement>
       <ownedElement>
	 <Class XMI.id = "S.100079">
	   <name>Being</name>
	   <visibility XMI.value = "public"/>
	   <isAbstract XMI.value="false"/>
	   <isLeaf XMI.value="false"/>
	   <isRoot XMI.value="false"/>
	   <isActive XMI.value = "false"/>
	   <feature>
	     <Attribute XMI.id = "S.100083">
	       <name>sire</name>
	       <visibility XMI.value = "public"/>
	       <ownerScope XMI.value="instance"/>
	       <changeable XMI.value="none"/>
	       <multiplicity>1</multiplicity>
	       <targetScope XMI.value="instance"/>
	       <initialValue>
	       </initialValue>
	       <type> <XMI.reference target="S.100079"/> </type>
	       <!-- Type is: Being -->
	     </Attribute>
	   </feature>
	   <feature>
	     <Attribute XMI.id = "S.100084">
	       <name>dame</name>
	       <visibility XMI.value = "public"/>
	       <ownerScope XMI.value="instance"/>
	       <changeable XMI.value="none"/>
	       <multiplicity>1</multiplicity>
	       <targetScope XMI.value="instance"/>
	       <initialValue>
	       </initialValue>
	       <type> <XMI.reference target="S.100079"/> </type>
	       <!-- Type is: Being -->
	     </Attribute>
	   </feature>
	 </Class>
       </ownedElement>
       <ownedElement>
	 <Class XMI.id = "S.100080">
	   <name>Person</name>
	   <visibility XMI.value = "public"/>
	   <isAbstract XMI.value="false"/>
	   <isLeaf XMI.value="false"/>
	   <isRoot XMI.value="false"/>
	   <isActive XMI.value = "false"/>
	   <feature>
	     <Attribute XMI.id = "S.100087">
	       <name>nationality</name>
	       <visibility XMI.value = "public"/>
	       <ownerScope XMI.value="instance"/>
	       <changeable XMI.value="none"/>
	       <multiplicity>1</multiplicity>
	       <targetScope XMI.value="instance"/>
	       <initialValue>
	       </initialValue>
	       <type> <XMI.reference target="S.100090"/> </type>
	       <!-- Type is: String[] -->
	     </Attribute>
	   </feature>
	 </Class>
       </ownedElement>
       <ownedElement>
	 <Generalization XMI.id = "S.100088">
	   <name></name>
	   <visibility XMI.value = "public"/>
	   <discriminator>
	   </discriminator>
	   <subtype> <XMI.reference target="S.100079"/> </subtype>
	   <!-- subtype is: Being -->
	   <supertype> <XMI.reference target="S.100027"/> </supertype>
	   <!-- supertype is: Entity -->
	 </Generalization>
       </ownedElement>
       <ownedElement>
	 <Generalization XMI.id = "S.100089">
	   <name></name>
	   <visibility XMI.value = "public"/>
	   <discriminator>
	   </discriminator>
	   <subtype> <XMI.reference target="S.100080"/> </subtype>
	   <!-- subtype is: Person -->
	   <supertype> <XMI.reference target="S.100079"/> </supertype>
	   <!-- supertype is: Being -->
	 </Generalization>
       </ownedElement>
     </Model>
     <Class XMI.id = "S.100024">
       <name>Stack</name>
       <visibility XMI.value = "public"/>
       <isAbstract XMI.value="false"/>
       <isLeaf XMI.value="false"/>
       <isRoot XMI.value="false"/>
       <isActive XMI.value = "false"/>
     </Class>
     <Class XMI.id = "S.100019">
       <name>Rectangle</name>
       <visibility XMI.value = "public"/>
       <isAbstract XMI.value="false"/>
       <isLeaf XMI.value="false"/>
       <isRoot XMI.value="false"/>
       <isActive XMI.value = "false"/>
     </Class>
     <Class XMI.id = "S.100016">
       <name>Long</name>
       <visibility XMI.value = "public"/>
       <isAbstract XMI.value="false"/>
       <isLeaf XMI.value="false"/>
       <isRoot XMI.value="false"/>
       <isActive XMI.value = "false"/>
     </Class>
     <DataType XMI.id = "S.100008">
       <name>byte</name>
       <visibility XMI.value = "public"/>
       <isAbstract XMI.value="false"/>
       <isLeaf XMI.value="false"/>
       <isRoot XMI.value="false"/>
     </DataType>
     <DataType XMI.id = "S.100005">
       <name>char</name>
       <visibility XMI.value = "public"/>
       <isAbstract XMI.value="false"/>
       <isLeaf XMI.value="false"/>
       <isRoot XMI.value="false"/>
     </DataType>
     <Class XMI.id = "S.100021">
       <name>Color</name>
       <visibility XMI.value = "public"/>
       <isAbstract XMI.value="false"/>
       <isLeaf XMI.value="false"/>
       <isRoot XMI.value="false"/>
       <isActive XMI.value = "false"/>
     </Class>
     <DataType XMI.id = "S.100010">
       <name>float</name>
       <visibility XMI.value = "public"/>
       <isAbstract XMI.value="false"/>
       <isLeaf XMI.value="false"/>
       <isRoot XMI.value="false"/>
     </DataType>
     <Class XMI.id = "S.100014">
       <name>Boolean</name>
       <visibility XMI.value = "public"/>
       <isAbstract XMI.value="false"/>
       <isLeaf XMI.value="false"/>
       <isRoot XMI.value="false"/>
       <isActive XMI.value = "false"/>
     </Class>
     <DataType XMI.id = "S.100007">
       <name>boolean</name>
       <visibility XMI.value = "public"/>
       <isAbstract XMI.value="false"/>
       <isLeaf XMI.value="false"/>
       <isRoot XMI.value="false"/>
     </DataType>
     <Class XMI.id = "S.100018">
       <name>Double</name>
       <visibility XMI.value = "public"/>
       <isAbstract XMI.value="false"/>
       <isLeaf XMI.value="false"/>
       <isRoot XMI.value="false"/>
       <isActive XMI.value = "false"/>
     </Class>
     <Class XMI.id = "S.100003">
       <name>String</name>
       <visibility XMI.value = "public"/>
       <isAbstract XMI.value="false"/>
       <isLeaf XMI.value="false"/>
       <isRoot XMI.value="false"/>
       <isActive XMI.value = "false"/>
     </Class>
     <Class XMI.id = "S.100023">
       <name>Hashtable</name>
       <visibility XMI.value = "public"/>
       <isAbstract XMI.value="false"/>
       <isLeaf XMI.value="false"/>
       <isRoot XMI.value="false"/>
       <isActive XMI.value = "false"/>
     </Class>
     <Class XMI.id = "S.100020">
       <name>Point</name>
       <visibility XMI.value = "public"/>
       <isAbstract XMI.value="false"/>
       <isLeaf XMI.value="false"/>
       <isRoot XMI.value="false"/>
       <isActive XMI.value = "false"/>
     </Class>
     <DataType XMI.id = "S.100006">
       <name>int</name>
       <visibility XMI.value = "public"/>
       <isAbstract XMI.value="false"/>
       <isLeaf XMI.value="false"/>
       <isRoot XMI.value="false"/>
     </DataType>
     <Class XMI.id = "S.100013">
       <name>Integer</name>
       <visibility XMI.value = "public"/>
       <isAbstract XMI.value="false"/>
       <isLeaf XMI.value="false"/>
       <isRoot XMI.value="false"/>
       <isActive XMI.value = "false"/>
     </Class>
     <Class XMI.id = "S.100012">
       <name>Character</name>
       <visibility XMI.value = "public"/>
       <isAbstract XMI.value="false"/>
       <isLeaf XMI.value="false"/>
       <isRoot XMI.value="false"/>
       <isActive XMI.value = "false"/>
     </Class>
     <Class XMI.id = "S.100015">
       <name>Byte</name>
       <visibility XMI.value = "public"/>
       <isAbstract XMI.value="false"/>
       <isLeaf XMI.value="false"/>
       <isRoot XMI.value="false"/>
       <isActive XMI.value = "false"/>
     </Class>
     <Class XMI.id = "S.100090">
       <name>String[]</name>
       <visibility XMI.value = "public"/>
       <isAbstract XMI.value="false"/>
       <isLeaf XMI.value="false"/>
       <isRoot XMI.value="false"/>
       <isActive XMI.value = "false"/>
     </Class>
     <Class XMI.id = "S.100022">
       <name>Vector</name>
       <visibility XMI.value = "public"/>
       <isAbstract XMI.value="false"/>
       <isLeaf XMI.value="false"/>
       <isRoot XMI.value="false"/>
       <isActive XMI.value = "false"/>
     </Class>
     <DataType XMI.id = "S.100011">
       <name>double</name>
       <visibility XMI.value = "public"/>
       <isAbstract XMI.value="false"/>
       <isLeaf XMI.value="false"/>
       <isRoot XMI.value="false"/>
     </DataType>
     <Class XMI.id = "S.100017">
       <name>Float</name>
       <visibility XMI.value = "public"/>
       <isAbstract XMI.value="false"/>
       <isLeaf XMI.value="false"/>
       <isRoot XMI.value="false"/>
       <isActive XMI.value = "false"/>
     </Class>
     <DataType XMI.id = "S.100009">
       <name>long</name>
       <visibility XMI.value = "public"/>
       <isAbstract XMI.value="false"/>
       <isLeaf XMI.value="false"/>
       <isRoot XMI.value="false"/>
     </DataType>
     <DataType XMI.id = "S.100004">
       <name>void</name>
       <visibility XMI.value = "public"/>
       <isAbstract XMI.value="false"/>
       <isLeaf XMI.value="false"/>
       <isRoot XMI.value="false"/>
     </DataType>
   </XMI.content>
 </XMI>
====================8<====================8<====================


All the best,


David

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

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@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@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)






 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS