- From: Gabe Beged-Dov <begeddov@jfinity.com>
- Date: Tue, 29 Feb 2000 08:05:48 -0800
- To: haustein@kimo.cs.uni-dortmund.de
- CC: www-rdf-interest@w3.org
Stefan Haustein wrote: > > Hello, > > I would like to use RDF for object serialization if possible. My problem > is that I am not sure how to express the following Java classes in > RDF schema (using a single namespace)? > > class Person { > String name; > Person child; > } > > class Node { > Object content; > Node child; > } My approach is to map each class to a namespace and use the typedNode syntax as you do. The above classes become: <Person:This xmlns:Person="urn:jclass:com.foo.Person"> <Person:name>Harry Hacker</Person:name> <Person:child rdf:resource="...."/> </Person:This> <Node:This xmlns:Node="urn:jclass:com.foo.Node"> <Node:content rdf:resource="...."/> <Node:child rdf:resource="...."/> </Node:This> One question that comes up with this approach is how to handle data members that are defined by a superclass. There are two possibilities, you either use the namespace of the superclass, or you uniformly use the namespace of the subclass. For example: class Employee extends Person { Person Boss; } would either be: <Employee:This xmlns:Person="urn:jclass:com.foo.Person" xmlns:Employee="urn:jclass:com.foo.Employee"> <Person:name>Harry Hacker</Person:name> ... </Employee:This> or: <Employee:This xmlns:Employee="urn:jclass:com.foo.Employee"> <Employee:name>Harry Hacker</Employee:name> ... </Employee:This> I have found this to be the most direct way to map OO classes to XML. You end up with something pretty similar if you want to be able to register per class serialization handlers as opposed to per-module handlers which is what you'd get from a namespace that defines a set of classes. Cordially from Corvallis, Gabe Beged-Dov -- --------------------------- http://www.jfinity.com/gabe
Received on Tuesday, 29 February 2000 11:18:24 UTC