RDF over SOAP notes towards closure of XMLP issue #29 The XML Protocols WG have an issue related to the exchange of RDF graph serializations using SOAP. Discussion of this has refined our understanding of the problem, and the question has been recouched in a way that distinguishes between SOAP-as-protocol and the SOAP Encoding of the SOAP Data Model. Questions from XMLP WG We are now looking for answers to two questions from the XMLP group: Is it true that... * Q1: "you can use the SOAP Encoding to transport RDF" * Q2: "there exists an encoding that enables RDF to be transported in SOAP messages" 1 Answers Taken literally, there is a simple 'yes' answer to both questions. Just as AVI video files, MP3s, tar.gz archives and anything else with a bytestream representation can be encoded (eg. base64) and transported using XML documents, so can RDF. There are also applications in existence (eg. RDFAuthor's SOAP-based RDF query facility) that transport RDF-based data, eg. tables of RDF query results, using a custom data structure (arrays of hashtables, etc) using the SOAP Encoding XML format. There are potentially better 'yes' answers to both questions, however. Base-64 encoding an XML/RDF document would be a last resort. The first question "can you use the SOAP Encoding to transport RDF" can be taken in two senses. 1. Can RDF graphs be transferred losslessly through SOAP Encoding XML documents? Yes (obviously), just as any other data structure can (fallback proof: base64 encoding). 2. The more interesting sense of this question: Can RDF graphs be mapped to the SOAP Encoding Data Model (and hence to the SOAP Encoding XML dialect)? This is much harder to answer. It is also (perhaps more importantly) not yet clear how much we should care about a negative answer to this question. It may not matter if RDF doesn't map to SOAP encoding, although many who explored this topic consider the models potentially isomorphic. Q1: RDF and soap encoding The SOAP Encoding Data Model (per the last published SOAP Adjuncts spec, Dec 2001) defines an XML serialization for an edge-labeled graph structure, using XML, namespaces and some aspects of the XML Schema language to encode a certain class of data structures in XML. As of Dec 2001, the spec includes a section 3 ("The SOAP Data Model") and section 4 ("SOAP Encoding"). Section 3 is marked as a placeholder, noting that the relationship between the encoding and the data model needs clarification in future versions of the spec. The current (March 2002) state of play seems to be that few applications use SOAP Encoding for anything other than RPC-style serialization of programmatic data structures. Within typical SOAP applications, there does not seem to have been much call for a clearer distinction between the SOAP Data Model and its standard SOAP Encoding. RDF-based apps have also used SOAP Encoding for query and manipulation of RDF via Web service interfaces; however they do not, to date, seem to have explored in any detail the apparent isomorphism between the SOAP and the RDF abstract graph models. Since the current SOAP draft on w3.org suggests the data model will be more clearly articulated in future versions, it may be that developers are awaiting its formal specification before attempting to map between the two models. Summary: at the current time, nobody knows if the RDF graph and SOAP Encoding graph models are isomorphic. Notes on isomorphism between SOAP Encoding and RDF: * SOAP 4.4 compound types: "SOAP serialization does not require that the underlying serialization make an ordering distinction among accessors, but if such an order exists, the accessor MUST be encoded in that sequence.". This is confusing: while it does not affect the mapping of RDF to SOAP Encoding (since RDF edge labels are unordered), it does affect any attempt to map SOAP Encoding to RDF, since it is not clear how we could tell whether ordering was significant. An application receiving a chunk of SOAP-Encoding would not know whether mapping it to RDF would be lossy. * SOAP 4.4.3 generic compound types: SOAP-Enc allows for accessors to be distinguished by a combination of name and ordinal role. This has no direct correlation to RDF, although various techniques could be adopted to achieve the same effect. * Privileged role of URIs. In RDF, nodes in the graph can be labelled with URIs, 'blank', or literal (text, markup etc). The SOAP Encoding doesn't privilege URIs in the same way as RDF; URIs for the nodes in a SOAP graph would simply be more data fields in the graph. Applications that wanted to map between RDF and SOAP Encoding would need to know about such conventions; it is not necessarily the role of the core SOAP spec to achieve this (eg. through datatyping the URI reference). URIs also provide a mechanism for merging the data in a SOAP message with other URI-based data structures (RDF, in particular). in a * Alternate encodings It is not yet clear how much we should care about mapping RDF to the SOAP Encoding Data Model. If, for example, query, storage and data maipulation tools are being provided for SOAP Encoding data, we should probably attach more urgency to clearly specifying the abstract SOAP Data Model so that a mapping to RDF can be documented and tested. If SOAP Encoding is really just for RPC, the lack of a canonical mapping between the RDF graph model and SOAP Encoding may not matter much. Q: Can alternate SOAP Encodings be used to transport RDF (in it's native RDF/XML form)? A: yes, usually. We can use the SOAP protocol to ship RDF around, by using SOAP's mechanism for switching to alternate encodings. SOAP allows an alternate URI to be used to indicate the encoding style adopted. It does not provide explicit guidance on the selection of these URIs. For example, we could, but might not always, use http://www.w3.org/1999/02/22-rdf-syntax-ns# as an indication that the enclosed content uses RDF/XML serialized according to the RDF specification. @@todo: get RDFCore or SW CG input on this. Should we recommend a specific URI for indicating RDF is the encoding format, or does this couple our specs too tightly? (possibly a separate W3C Note?) Issues There are a number of corner cases where the encoding of an RDF/XML document as a SOAP message payload may be problematic. These include (but are probably not limited to) the following: + When IDs in the RDF clash with XML IDs in the surrounding XML markup + When a different character set is used + ...(@@rdfcore input here?) Summary There are a number of techniques we can use to ship RDF data around in a SOAP environment. If we decide not to use SOAP Encoding, the remaining issues are pretty minor, and probably subsumed by general problems for any app that tries to carry XML inside XML. The concept of SOAP with attachments(@@ref?) may be the focus for addressing these issues; they don't seem particularly RDF specific. If we try to use SOAP's SOAP Encoding Data Model, the issues are more subtle. We don't really know what the SOAP model itself looks like, except for it's manifestation in the SOAP Encoding XML dialect. Since it is (apparently) mostly used for RPC, the absence of a full "SOAP Data Model" section from the current spec may be more of a problem for RDF implementors than for most mainstream SOAP applications. There are a few points where the SOAP Encoding model seems to differ from RDF, but as yet the notion of a formal mapping remains speculative. When the Model section of the spec is finalised (last call?) we should encourage more detailed attention from the RDF developer community. Next steps? Write up some examples, both with SOAP Encoding and with RDF as the encoding. Nearby + msg to chairs list re last call (member only) __________________________________________________________________________________ danbri@w3.org