|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] Serialization of XDMDavid A. Lee dlee at calldei.comMon Sep 14 09:32:10 PDT 2009
A step towards defining an XDM Serialization would be to knock at the edges of the problem. 1) I think people would agree that a Document should be Serialized (and read) in existing standard XML text form. -- This preserves the most common use case 2) I think it is desirable that a single atomic xs:string be serialized as plain string unescaped and unencoded. -- I think this is a common use case, for example generating plain text, or even things like CSV from xquery It MAY be desirable that any atomic type be serialized as if it were first converted to xs:string ... e.g. xs:integer(1) -> "1" Now comes the fun part, Since it is impossible to distinguish a "Sequence of one item" from "One item" then we need to serialize a Sequence of One identically to One. My guess is this is where the committees started having problems and decided to avoid the issue altogether. If, say a sequence of 1 integer is serialized as "1", but as Kurt suggested a sequence notation could be used for sequences, then say a sequence of 2 integers ( for example) could be "(1,2)". this means that sequences of 1 and sequences of N>1 are serialized differently ! I suggest this is undesirable. There is a common practice that avoids this. That is by using a syntax that avoids header and trailing markup so that an single value is serialized the same as a sequence of 1 value. One example is simply using a separator such as LF or space. The terminator being supplied by the wrapper (such as EOF or NUL or end-of-element). This requires (as any markup) a way of escaping or quoting so that the seperatator can be contained within the data. In order to conform to #2 (simple string output as plain text) that leads out quoting, but does require escaping. Depending on the separator used, this could be annoying or inconsequential. It could also be variable (defined by the environmen). This is essentially CSV ... or its variants ... That would buy us sequences. Even sequences of documents ! *IFF* XML parsers would be so nice as to stop reading when they have read the closing tag instead of throw an error (I believe this is a requirement of a conforming parser, not sure why). But this can be hacked. (I'd prefer a hack *inside* the XML parsers but if not then wrappers can be written which reuse existing XML parsers , not pretty though). Certainly a parser would have to know its reading XDM not XML ahead of time. Well thats a start, its an outline for how to serialize sequences which preserves common use cases. Further work is needed to define the individual item serialization forms and decide if preserving type is critical or not. I.e. if you write an xs:integer is it OK to get back an xs:string ? David A. Lee http://x-query.com/mailman/listinfo/talk http://www.calldei.com http://www.xmlsh.org 812-482-5224 Kurt Cagle wrote: > I'm inclined to thing here that there are multiple issues hiding in > the question of serialization of XDM. Serialization of turtle node, as > Evgeny suggests, points to a non-XML syntax serialization. Similarly, > consider a simple sequence of values: > > for $a in (1 to 5) return $a * 5 > > This cannot be serialized in XML notation at all in any meaningful > way. Personally I think that this is where output to sequence notation > makes sense: > > (5,10,15,20,25) > > which would also be consistent with an XQuery consumption model. > > This is probably something worth talking to Dr. Michael Kay on, as he > was the editor of the XQuery/XSLT Serialization spec, but it would > seem to me that any XDM serialization should either resolve to a > specific type'd entity, a document node, a sequence of type'd entities > or a sequence of document nodes. This would hold true just as readily > for the RDF/Turtle use case; in an XQuery environment each assertion > would be given either as a text node() or, if supported, as a distinct > item(), and the results of a SPARQL query would then be a sequence of > such nodes. > > Kurt Cagle > Managing Editor > http://xmlToday.org > > > On Sun, Sep 13, 2009 at 11:56 PM, Evgeny Gazdovsky > <http://x-query.com/mailman/listinfo/talk <mailto:http://x-query.com/mailman/listinfo/talk>> wrote: > > What about RDF (any not XML notation) and SPARQL/xSPARQL? > _______________________________________________ > http://x-query.com/mailman/listinfo/talk <mailto:http://x-query.com/mailman/listinfo/talk> > http://x-query.com/mailman/listinfo/talk > > > ------------------------------------------------------------------------ > > _______________________________________________ > http://x-query.com/mailman/listinfo/talk > http://x-query.com/mailman/listinfo/talk -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090914/afaad0f8/attachment.htm
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






