if store same markup in 2 separate documents, 1 xml, other json, in marklogic 6, marklogic automatically convert json equivalent xml, , index in regard, or both stored in respective formats?
what i'm getting @ is, marklogic store documents xml, regardless, , apply json transformations json documents when queried?
if documents stored in native format, there advantage, in terms of performance, storing documents in json on xml?
below example code-snippet:
if($outputformat="json") (: result in json format :) let $custom-config := let $config := json:config("custom") return (map:put($config, "array-element-names",(xs:qname("lp:lesson_plan"), xs:qname("lp:instructional_segment"), xs:qname("lp:strand_type"), xs:qname("lp:resource"), xs:qname("lp:level"), xs:qname("lp:discipline"), xs:qname("lp:language"), xs:qname("lp:program"), xs:qname("lp:grade"), xs:qname("res:strand_type"), xs:qname("res:resource"), xs:qname("res:isbn"), xs:qname("res:level"), xs:qname("res:standard"), xs:qname("res:secondaryurl"), xs:qname("res:grade"), xs:qname("res:keyword"))), map:put($config, "whitespace","ignore"), map:put($config, "text-value","value"), $config) return json:transform-to-json($finalresult, $custom-config) else (: finalresult in xml format :) $finalresult
on disk, marklogic stores highly compressed c++ data structures represent hierarchical trees , corresponding indexes. (ok, that’s over-simplification, illustrative nonetheless.) there 2 places developer typically interact data structures: 1) building queries , application logic 2) deserializing/serializing data , out of internal data model. today, marklogic uses xml data model (xdm) latter and, correspondingly, xquery, xpath, , xslt former. chose stack several reasons: xml @ representing both text mark-up data structures , tooling around xml mature , widespread.
having said that, json has emerged popular serialization of hierarchical data structures—the “x” in ajax. while don't have same watertight abstraction between json , marklogic’s internal data model today, provide set of tools allow efficiently , losslessly convert between json , xml data model. additionally, our rest , java apis allow store, retrieve, , query tree structures originated json without having think conversion step; apis handle in plumbing.
as performance, there little overhead converting between json , xdm representation. however, i’d expect negligible applications. real benefits of xml in expressiveness of xquery, xpath, , xslt in working data. there no widespread equivalent these in json world today.
Comments
Post a Comment