OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: [xml-dev] XMap: A Mechanism for Mapping Names

[ Lists Home | Date Index | Thread Index ]

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


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?

> |>| 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"
           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"
           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"))

;; 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
                         (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)
  (:method ((form t)) form))

;; 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:title='Sleeping Kitty' xmlns:nsp-1='http://www.w3.org/1999/xlink'>some content or other</img>



News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS