SOAP Encoding RDF

From W3C Wiki

SOAP Encoding RDF

Given a sample of RDF:

example RDF:

<rdf:Description rdf:about="bob">
  <drives><rdf:Description rdf:ID="mcycle" color="black"/></drives>
  <rides><rdf:Description rdf:ID="bicycle" color="red"/></rides>
  <owns rdf:resource="bicycle"/>
</rdf:Description>


with an ascii-art rendering:


   ,-drives-> mcycle1 -color-> "black"
bob -rides->  bicycle1 -color-> "red"
   ` -owns-> /


HFN's WWW9 Mapping

 Extrapolated from HFN's examples.


<env:Envelope><env:Body>
<rdf:Description>
  <rdf:about href="bob">
  <drives><rdf:about href="#mcycle"></drives>
  <rides><rdf:about href="#bicycle"></rides>
  <owns><rdf:about href="#bicycle"></owns>
</rdf:Description>

<rdf:Description id="mcycle"><color>black</color></rdf:Description>

<rdf:Description id="bicycle"><color>red</color></rdf:Description>


Graph Mutation

One issue with this mapping is that the rdf:about properties label nodes in RDF but are simply used as attributes in this SOAP encoding. The transormed data would have this graph structure:


   ,-drives-> mcycle1 -color-> "black"
[ ] -rides->  bicycle1 -color-> "red"
 \ ` -owns-> /
  \-rdf:about-> "bob"


or more likely:


[ ] -drives-> mcycle1 -color-> "black"
  \-rdf:about-> "bob"
  /-rdf:about-> "bob"
[ ] -rides->  bicycle1 -color-> "red"
[ ] -owns-> /
  \-rdf:about-> "bob"


The obvious fallback with this is that a query for nodes that have an object that they both ride and own (bob rides his own bicycle) would have to be re-written to ask for nodes that have a common rdf:about. In this respect, graph structure is transformed when it is mapped to RDF and all queries will also have to be transformed.

This problem can be solved when making a reference to a locally-defined node. SOAP's id attribute will tell the data consumer the name of the node having that attribute. If we settle for a local identifier for bob, we can say:


<env:Envelope><env:Body>
<rdf:Description id="bob">
  <drives><rdf:about href="#mcycle"></drives>
  <rides><rdf:about href="#bicycle"></rides>
  <owns><rdf:about href="#bicycle"></owns>
</rdf:Description>

<rdf:Description id="mcycle"><color>black</color></rdf:Description>

<rdf:Description id="bicycle"><color>red</color></rdf:Description>


But SOAP does not allow one to make assertions about objects identified by a full URI. It is like an rdf:Description with an *id* attribute but no *about* attribute.

See also Embedding RDF in SOAP