W3C home > Mailing lists > Public > www-rdf-interest@w3.org > February 2000

Re: rdf for object serialization

From: Gabe Beged-Dov <begeddov@jfinity.com>
Date: Tue, 29 Feb 2000 08:05:48 -0800
Message-ID: <38BBEE5C.5AEA13BA@jfinity.com>
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="...."/>

<Node:This xmlns:Node="urn:jclass:com.foo.Node">
  <Node:content rdf:resource="...."/>
  <Node:child rdf:resource="...."/>

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"
  <Person:name>Harry Hacker</Person:name>


<Employee:This xmlns:Employee="urn:jclass:com.foo.Employee">
  <Employee:name>Harry Hacker</Employee:name>

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

Received on Tuesday, 29 February 2000 11:18:24 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:07:29 UTC