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

Re: rdf for object serialization

From: Stefan Decker <stefan@db.stanford.edu>
Date: Tue, 29 Feb 2000 14:04:08 -0800
Message-Id: <4.2.0.58.20000229132534.00cb27f0@db.stanford.edu>
To: haustein@kimo.cs.uni-dortmund.de, www-rdf-interest@w3.org
Hi,

this was indeed already discussed a few weeks ago.
See:
http://lists.w3.org/Archives/Public/www-rdf-interest/1999Dec/0113.html
http://lists.w3.org/Archives/Public/www-rdf-interest/1999Dec/0115.html
http://lists.w3.org/Archives/Public/www-rdf-interest/1999Dec/0147.html
http://lists.w3.org/Archives/Public/www-rdf-interest/2000Jan/0020.html

The discussion has not lead to a useful solution,  but i *needed* a 
solution for this problem
for the Protege RDF-storage infrastructure.
So my solution was to use facets for properties in a namespace "rdfutil" 
(which is preliminary)
which allows to define multiple domains and ranges.
A property can have multiple "facetResources", which defines a set of 
facets for the property separately.
In your example the property "child" would have two "facetResources", one 
for each domain.

The documentation of the rdfutil-namespace is in preparation (it contains 
also cardinality-constraints etc., which
were also needed for the protege-RDF serialization.

So the RDF-serialization of

>class Person {
>   String name;
>   Person child;
>}
>
>class Node {
>   Object content;
>   Node child;
>}
is (i omitted "content" and "name")


  <?xml version='1.0' encoding='ISO-8859-1'?>
<!-- Version Tue Feb 29 13:45:11 PST 2000 -->
<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#"
  xmlns:rdfutil="http://www.w3.org/rdfutil#">

  <rdfs:Class rdf:ID="#Node"/>

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

  <rdfs:Property rdf:ID="child">
    <rdfutil:facets>
     <rdfutil:facetResource>
      <rdfutil:domain rdf:resource="#Node"/>
      <rdfutil:range rdf:resource="#Node"/>
     </rdfutil:facetResource>
    </rdfutil:facets>

    <rdfutil:facets>
     <rdfutil:facetResource>
      <rdfutil:domain rdf:resource="#Person"/>
      <rdfutil:range rdf:resource="#Person"/>
     </rdfutil:facetResource>
    </rdfutil:facets>

  </rdfs:Property>
<rdf:RDF>

-------------------------------------------------------------------------------

Please note that the property definition can be split into two separate 
definitions, thus
the Java-classes can be serialized interdependently (this is actually the 
approach used in Protege).

  <rdfs:Property rdf:ID="child">
    <rdfutil:facets>
     <rdfutil:facetResource>
      <rdfutil:domain rdf:resource="#Node"/>
      <rdfutil:range rdf:resource="#Node"/>
     </rdfutil:facetResource>
    </rdfutil:facets>
  </rdfs:Property>



  <rdfs:Property rdf:ID="child">
    <rdfutil:facets>
     <rdfutil:facetResource>
      <rdfutil:domain rdf:resource="#Person"/>
      <rdfutil:range rdf:resource="#Person"/>
     </rdfutil:facetResource>
    </rdfutil:facets>
  </rdfs:Property>


Ciao,

         Stefan





>Where serialzed instances should look like
>
><rdf xmlns:rdf="..."
>      xmlns="..."
>
>   <Person rdf:about="....">
>      <name>Harry Hacker</name>
>      <child rdf:"ressurce="...."/>
>   </Person>
>
>   <Node rdf:about="....">
>      <content rdf:ressource="..."/>
>      <child rdf:ressource="..."/>
>   </Node>
></rdf>
>
>
>AFAIK, that is not possible at all because in RDF the domain
>of a property is not part of the property
>name (in contrast to OOPL).
>
>So I could add the class name to the property name manually,
>but renaming child to Person-child and Node-child would
>look ugly in the RDF code and not meet the spirit of
>OOP. I could also use the RDF syntax for object
>serialization but ignore RDF schema.
>
>Does anybody have a good suggestions?
>
>Is there any special reason why the domain name is not part
>of the property name in RDF schema like in standard OOP?
>Or did I misread the specs? Is object serialization a
>relevant application of RDF?
>
>Best regards
>
>Stefan
>
>
>--
>Stefan Haustein
>University of Dortmund
>Computer Science VIII
>www-ai.cs.uni-dortmund.de
Received on Tuesday, 29 February 2000 17:03:10 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:51:42 GMT