[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XMap: A Mechanism for Mapping Names
three questions before i leave you to formulate the gory details: you wrote: > > > Structurally, the three part morphology > > xmlmap : n1 n2 > n1 : URI > n2 : e1 l1 e2 l2 .... > > is an association of the URI with the list (interpretable as a hash), like > in Perl: > > { ... > URI => { e1 => l1 > e2 => l2 > ... > } > } > 1. how to encode the mapping specification? what is the advantage of resolver == URI -> local-name -> external-name over resolver == local-name -> (URI x external-name) since the local name must be unique in any given context. this would suggest an alternative morphology, and thereby, encoding: xmlmap : n1 n2 n1 : (URI1 e1 l1) (URI2 e2 l2) whereby the URIs may be identical 2. ontology, taxonomy, or name set > |>| please do it in advance. please do not repeat the sins of "namespaces". > |> > |>I have no idea what you're talking about. > | > | the uncertainty as to whether what matters is the set of names or where > | they come from and or are used. > > The sins of Namespaces are on the heads of its (their?) advocates. It > always matters where the names we use *in processing* came from. Names > actually occuring in markup can be arbitrary. They are merely a scaffold > for the arch. why does "where the names came from" matter for a renaming transformation? 3. > |>| does the "element" scope entail contained elements? > |> > |> I "guess" so, but then again, maybe not. Seriously, I have no idea why > |> your notion of "scope" matters to you. > | > | it matters because, to the extent that XMap is intended to subsume > | namespaces in XML, under certain conditions it will behave the same, > | which means that while performing the transformation which XMap > | describes, the pairs in the control attributes are equivalent to variable > | bindings and the transformation itself is equivalent to beta-conversion. > > I don't see how. I'd say XMap is an analog of alpha renaming. it is alpha-conversion only if one posits an implicit binding for each name. an implementation looks a lot more like beta-conversion. taking the analog to the original example expression, reformulated in the alternative encoding: <img src="some.gif" xmlmap="yy" yy="{http://www.w3.org/1999/xlink}href {}src {http://www.w3.org/1999/xlink}type {}foo {http://www.w3.org/1999/xlink}role {}bar {http://www.w3.org/1999/xlink}title {}quux" foo="simple" bar="http://example.org/some/role" quux="Sleeping Kitty" > this can be represented with a model which has the following, simple, readable abstract syntax as ? (defParameter *form_* '(({}img ({}src . "some.gif") ({}xmlmap . "{}yy") ({}yy . "{http://www.w3.org/1999/xlink}href {}src {http://www.w3.org/1999/xlink}type {}foo {http://www.w3.org/1999/xlink}role {}bar {http://www.w3.org/1999/xlink}title {}quux") ({}foo . "simple") ({}bar . "http://example.org/some/role") ({}quux . "Sleeping Kitty")) "some content or other")) *FORM_* ;; which permits the following definition for XMap, (i hope this isn't wrapping too badly, and ;; neglect the special case for GI mapping and the question of scoping) ? (defGeneric XMap (form) (:method ((form list)) (labels ((read-names (string) (let ((names nil) (name nil)) (with-input-from-string (stream string) (loop (unless (setf name (read stream nil nil)) (return (nreverse names))) (push name names))))) (make-alist (mapping) (when mapping (acons (second mapping) (first mapping) (make-alist (cddr mapping)))))) (xmla:with-abstract-element ((gi &rest attributes) &rest content) form (xmla:with-abstract-attributes ((xmlmap-attr {}xmlmap)) attributes ;; collect the mappings from the attributes (let ((mappings (make-alist (apply #'append (mapcar #'read-names (mapcar #'(lambda (attr-name) (xmla:get-abstract-property-value attributes attr-name)) (read-names xmlmap-attr))))))) (setf form (apply #'xmla:make-element gi (copy-alist attributes) (mapcar #'XMap content))) (if mappings ;; perform the transformation if a mapping spec is present (nsublis mappings form) form)))))) (:method ((form t)) form)) #<STANDARD-GENERIC-FUNCTION XMAP #x63EAE96> ;; which, when applied to the example form, yields ? (pprint (xmap *form_*)) (({}img ({http://www.w3.org/1999/xlink}href . "some.gif") ({}xmlmap . "{}yy") ({}yy . "{http://www.w3.org/1999/xlink}href {}src {http://www.w3.org/1999/xlink}type {}foo {http://www.w3.org/1999/xlink}role {}bar {http://www.w3.org/1999/xlink}title {}quux") ({http://www.w3.org/1999/xlink}type . "simple") ({http://www.w3.org/1999/xlink}role . "http://example.org/some/role") ({http://www.w3.org/1999/xlink}title . "Sleeping Kitty")) "some content or other") ;; or alternatively, reserialized ? (write-node (xmap *form_*) *trace-output*) <img nsp-1:href='some.gif' xmlmap='{}yy' yy='{http://www.w3.org/1999/xlink}href {}src {http://www.w3.org/1999/xlink}type {}foo {http://www.w3.org/1999/xlink}role {}bar {http://www.w3.org/1999/xlink}title {}quux' nsp-1:type='simple' nsp-1:role='http://example.org/some/role' nsp-1:title='Sleeping Kitty' xmlns:nsp-1='http://www.w3.org/1999/xlink'>some content or other</img> NIL ...
|
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
|