World: r3wp
[XML] xml related conversations
older newer | first last |
Gabriele 27-Apr-2006 [423] | i'm just trying to get some ideas. not a real poll. but maybe we can post this on reboltalk too. |
Sunanda 27-Apr-2006 [424] | I'd lead towards 3. But that's because I heft XML into REBOL objects and fiddle with it from there. That gets away from the strict hierachy of XML, so I don't need to think about basically insane things like XSLT's axis processing |
Maxim 27-Apr-2006 [425x3] | and we already have data as trees in rebol, nested blocks and objects... so I don't think its going to help much. |
although getting XML:schema LOAD/SAVE , complete, native XML 1.0 LOAD/SAVE that would at least allow us to start using XML in the first place ;-) | |
so my vote 3) | |
Gabriele 27-Apr-2006 [428] | we already have data as trees - if you use that, then tree rewriting would be very useful for you, wouldn't it? |
Maxim 27-Apr-2006 [429] | can you further define "tree rewriting" |
yeksoon 27-Apr-2006 [430] | does having XSLT also means we can map that into /View? |
ScottT 27-Apr-2006 [431] | well, if you can write a stylesheet that outputs a layout. Not at all impossible, <xsl:output method="text" /> |
Gabriele 28-Apr-2006 [432x3] | max: tree rewriting is the technique that compilers use to get from the source AST to the final machine code; you can also imagine purely functional languages as special tree rewriting engines. |
basically, you have a tree, and you have a set of rules for rewriting; a rule is a pattern and a replacement for the matched node | |
Tree rewriting is a model of computation which is used in a variety of contexts within computer science, for example in semantic specification and compiler implementation | |
Maxim 28-Apr-2006 [435] | ok, so you pre-specify how path /aaa/bbb/ccc/ specifies data in another tree /xxx/yyy/zzz ? |
Gabriele 28-Apr-2006 [436x6] | no, you specify a pattern that can match a subtree, and replace that subtree with something else. |
xslt does something very similar; it matches a number of nodes (via xpath), then creates a new tree based on those nodes. rules are applied recursively so that you end up with a new tree starting from the initial tree. | |
there are only two votes so far, howeverr both voted for 3. maybe, we could introduce a new concept to CS, "dialect rewriting". :) it's the same as tree rewriting but without a tree. ;) | |
dialect rewriting is basically what my rewriting engine for rebcode does; it's rewriting where instead of using a regexp you use a parse rule; and instead of compiling a tree to another tree you compile a dialect to another dialect. | |
so it can be considered a superset of tree rewriting (since you can think of a dialect to represent trees) | |
i don't know if this concept can be generalized easily. but it would be interesting to figure out. | |
JaimeVargas 28-Apr-2006 [442] | But by avoiding the AST aren't you throwing the possibility for optimizations, a direct rewrite engine is more like a literal translator. The cool think of having an AST is all the tricks that you can play to produce more efficient code at the cost of pre-processing time. |
Anton 28-Apr-2006 [443] | Hmmm..... |
Pekr 28-Apr-2006 [444] | maybe noone votes for 3 because a) we have little understanding what xpath can do for us b) once we say "dialect" or rebol in general, we sometimess think it is cure for all proglems |
yeksoon 28-Apr-2006 [445] | the lack of vote for xpath and xslt.. maybe its because there is this thought of adding yet another layer just to manipulate the data etc (remember Carl's slide in DevCon 2004 ?... with REBOL on one side against a stack of others on the other side) |
Pekr 28-Apr-2006 [446] | maybe, but maybe not. We need to be able to interface XML (DOM) anyway .... (e.g. for plug-in ) |
JaimeVargas 28-Apr-2006 [447] | BTW, Gabriele you have my vote on tree rewriting. |
MichaelB 28-Apr-2006 [448] | Actually I don't care what directly is available (as a user), if just some things can be done: e.g. people need to process XML - thus people already knowing XSLT and XPATH would like to leverage their knowledge (I asume) - so if we get a dialect for this (2.) this is nice, but even nicer if there is some mechanism (a generalization) which allows to import an XSLT (ast?) or some XPATH query and return the (more rebolesque) according Rebol dialect 3. three has always this kind of attitude of being able to do everything better in Rebol itself - even if true (?), that's one of the problems with Rebol, that outsiders can't afford the time to do many things better (themself) or don't care, because they want use some standards nevertheless and Rebol drops out as an option so I vote for 2. with the ability for 1. maybe by the possibilities tree rewriting (or dialect rewriting) offers (I have not much glue about this - so some of the experts should know) |
Pekr 28-Apr-2006 [449] | I agree to MichaelB .... but maybe then I vote for 1, 2 and 3 as well, so that 3 can be translated to "standard" |
JaimeVargas 28-Apr-2006 [450] | I think Gabriel proposal is to rewrite the XML into an RXML "A easy to manipulate representation of XML in rebol". Then you rewrite back to XML if you need to. |
Pekr 28-Apr-2006 [451x2] | that sounds good ... so far my only experience with XML in rebol is Gawain's work - better than nothing .... but what exactly do you mean by XML here? |
this group exists for a long time, and IIRC initially we were more or less discussing rebol - XML interoperability - SAX or DOM parser in rebol .... while from what is being discussed now, sounds like slightly bit different topic? | |
MichaelB 28-Apr-2006 [453] | Jaime: that's what I meant too. But the discussion jumps around quite a bit and as some of these terms are unfamilar (besides the simple I know what you're talking about) - it's hard to know what to vote for :-). |
Ingo 28-Apr-2006 [454x2] | I guess people have _very_ differing needs in this. Some _really_ need to handle XML with all strings attached to it, and others just want to interface to existing technoglogies and read / write xml. I'd put myself in the second category, if ever I have to work with XML again, that is. And I surely hope this won't happen ;-) |
I once used XML as a file format, just to play around with it. And later I found out, that I'd broken so many rules, that no other gram was able to read it anyways. ;-) | |
Gabriele 28-Apr-2006 [456x6] | it turns out that i can do tree rewriting as a subset of dialect rewriting. it's a bit tricky but works well. |
and, it's a few lines of code (half a page or so) | |
on top of this, one could probably implement something similar to xslt, to translate a tree (parsed from xml) to another tree (maybe xhtml or another xml doc) | |
now, it remains to consider something like xpath for selection | |
basically, what sql's select is for relational data, xpath is for xml data. | |
can we think of a generic way to select data represented with a dialect? | |
BrianH 28-Apr-2006 [462] | I have often missed structural pattern matching in REBOL, something like the match statement in Nemerle (I'm sure it's in other functional languages but that's the first that came to mind). You could combine a structural pattern specification dialect (like XPath) with a structure building dialect (like XSLT), and then make the dialect compilable to REBOL code that can be used over and over again. It would be like a regex compiler for structures - I would use this every day. All you would have to do to implement actual XPath syntax would be to specify a standard mapping of XML semantics in REBOL data structures (see my block model in this group from last October) and then have compile the XPath syntax (in a string) to the structure matching dialect. Then you could work from there. (Gabriele, sorry if this seems redundant - I'm trying to explain tree rewriting in more REBOL-like terms). |
Gregg 28-Apr-2006 [463] | can we think of a generic way to select data represented with a dialect? Do you mean "selecting dialected data" or "a dialect to select data that's in format X"? |
Gabriele 29-Apr-2006 [464x6] | selecting dialected data |
i.e., if we think that dialects are better than trees for data. | |
when i think about representing data conceptually, i tend to always come up with a graph or a tree (then i map the conceptual graph to a relational model, or maybe to a dialect). so for selecting data a "navigation" approach (which is basically what xpath does) seems rather natural for me; then you can map the navigation to SELECT statements etc if needed. | |
so maybe my question is: is graph navigation (or, if you think it is general enough, tree navigation) a general enough selection model, or do you think that it would be missing something? | |
(maybe there just isn't any general solution to the problem of selection.) | |
brian: do you think that structural pattern matching could be done with parse rules too? or, do you think we need something like "longest match" (which can be implemented in parse but is tedious to do manually) | |
BrianH 29-Apr-2006 [470] | You can do some structural pattern matching with parse rules, but with how parse is currently implemented it can be a little awkward. The lack of arguments to parse rules make recursion quite difficult, and the lack of local variables make the rules difficult to use concurrently. It is difficult to examine both the data type and the value of elements in block parsing, to switch to string parsing mode for string elements, to parse lists, hashes or parens, to direct the parse flow based on semantic criteria (which is needed to work around any of these other problems). And don't even get me started on the difficulties of structure rebuilding. The thing that is the most difficult to do in parse is the easiest thing to do with regexes: Search and replace. Didn't we make a web site years ago collecting suggestions for improving parse? Wasn't a replace operation one of those suggestions? What happened with that? Structural pattern matching and rebuilding currently has to be done with a mix of parse and REBOL code that is tricky to write and debug. If parse doesn't get improved, I'd rather use a nice declarative dialect, preferably with before and after structures, and have the dialect processor generate the parse and REBOL code for me. If that dialect is powerful enough to be written in itself then we'll really be cooking. |
Graham 29-Apr-2006 [471] | Brian, did you post a rambo on parse after a discussion we have a while ago ? |
BrianH 29-Apr-2006 [472] | Yup. I've posted on rambo about everything I've suggested and more. I hope they consider these suggestions for REBOL 3. |
older newer | first last |