RE: Is there a diff-like utility for SXML documents?
"Newcombe, Chris" <[email protected]> Wed, 17 Aug 2005 08:40:13 -0700
| Newsgroups | gmane.lisp.scheme.ssax-sxml |
|---|---|
| Message-ID | <548334CFD2F7594FAB7B013CAA81128304C2203F@ex-mail-sea-02.ant.amazon.com> |
>>I can also recommend the following older paper:
>>http://citeseer.ist.psu.edu/chawathe96change.html <http://citeseer.ist.psu.edu/chawathe96change.html>
Thanks for the link and the code.
Here's a new paper (from the Harmony team) with more on leveraging schemas while merging. (Still no comments on one case I'm worried about: what to do if the schema has changed while disconnected?)
www.cis.upenn.edu/~jnfoster/papers/schema-sync.pdf <http://www.cis.upenn.edu/~jnfoster/papers/schema-sync.pdf>
Below is another paper that I just stumbled across (again, from the Harmony folks) that sounds interesting from the sxml perspective:
(my emphasis):
"We then instantiate this
semantic framework in the form of a collection of lens
combinators that can be assembled to describe
transformations on trees. These combinators include
familiar constructs from functional programming
(composition, mapping, projection, conditionals,
recursion) together with some novel primitives for
manipulating trees (splitting, pruning, copying,
merging, etc.). We illustrate the expressiveness of
these combinators by developing a number of
bi-directional list-processing transformations as
derived forms."
Chris
TITLE = {Combinators for Bi-Directional Tree Transformations:
{A} Linguistic Approach to the View Update Problem},
BOOKTITLE = {ACM {SIGPLAN--SIGACT} {S}ymposium on {P}rinciples of {P}rogramming {L}anguages ({POPL}), Long Beach, CA},
PAGES = {233--246},
MONTH = JAN,
YEAR = {2005},
NOTE = {Extended version available as University of Pennsylvania technical report MS-CIS-03-08.},
CONF = {http://www.cis.upennedu/~jnfoster/papers/focal.pdf <http://www.cis.upennedu/~jnfoster/papers/focal.pdf> },
TR = {http://www.cis.upenn.edu/~jnfoster/papers/focal-tr.pdf <http://www.cis.upenn.edu/~jnfoster/papers/focal-tr.pdf> },
SLIDES = {http://www.cis.upenn.edu/~jnfoster/papers/focal-slides.pdf <http://www.cis.upenn.edu/~jnfoster/papers/focal-slides.pdf> },
ABSTRACT = {We propose a novel approach to the well-known view
update problem for the case of tree-structured data: a
domainspecific programming language in which all
expressions denote bi-directional transformations on
trees. In one direction, these transformations---dubbed
lenses---map a ``concrete'' tree into a simplified ``abstract
view''; in the other, they map a modified abstract view,
together with the original concrete tree, to a
correspondingly modified concrete tree. Our design
emphasizes both robustness and ease of use, guaranteeing
strong well-behavedness and totality properties for
well-typed lenses.
We identify a natural mathematical space of well-behaved
bi-directional transformations over arbitrary
structures, study definedness and continuity in this
setting, and state a precise connection with the
classical theory of ``update translation under a constant
complement'' from databases. We then instantiate this
semantic framework in the form of a collection of lens
combinators that can be assembled to describe
transformations on trees. These combinators include
familiar constructs from functional programming
(composition, mapping, projection, conditionals,
recursion) together with some novel primitives for
manipulating trees (splitting, pruning, copying,
merging, etc.). We illustrate the expressiveness of
these combinators by developing a number of
bi-directional list-processing transformations as
derived forms. An extended example shows how our
combinators can be used to define a lens that translates
between a native HTML representation of browser
bookmarks and a generic abstract bookmark format.},
-----Original Message-----
From: Dmitry Lizorkin [mailto:[email protected] <mailto:[email protected]> ]
Sent: Wednesday, August 17, 2005 7:09 AM
To: [email protected]; Newcombe, Chris
Cc: [email protected]
Subject: Re: [ssax-sxml] Is there a diff-like utility for SXML documents?
Hello!
You may be interested in looking at the following _naive_ diff tool for
SXML:
http://modis.ispras.ru/Lizorkin/Download/Tmp/sxml-diff.scm <http://modis.ispras.ru/Lizorkin/Download/Tmp/sxml-diff.scm>
Node matching implemented there is not quite intellectual, although
sufficient for our practical tasks.
Given two SXML nodes, the function `sxml:diff' returns the differences
between them in the form of a list (the empty list is returned for
equavalent SXML nodes):
(sxml:diff
'(table
(@ (class "code-sample") (align "center") (border 0))
(tr "First table row")
(tr "Second table row")
(tr "Third table row" (br)))
'(table
(@ (border 0) (align "left") (class "code-sample") (width "80%"))
(tr "First table row")
(tr "Third table row" (br))))
==>
((diff
(message "Attribute value changed")
(fragment1 (@ (xpath "/@align")) "center")
(fragment2 (@ (xpath "/@align")) "left"))
(diff
(message "Attribute inserted")
(fragment2 (@ (xpath "/@width")) (width "80%")))
(diff
(message "Node deleted")
(fragment1 (@ (xpath "/tr[2]")) (tr "Second table row"))))
> (Described and analyzed at length in this thesis:
http://www.cs.hut.fi/~ctl/3dm/thesis.pdf <http://www.cs.hut.fi/~ctl/3dm/thesis.pdf> .)
>
> Here is another approach:
www.cis.upenn.edu/~bcpierce/papers/harmony-sync-tr.pdf
Chris, thank you a lot for the useful links.
I can also recommend the following older paper:
http://citeseer.ist.psu.edu/chawathe96change.html <http://citeseer.ist.psu.edu/chawathe96change.html>
Best regards,
Dmitry