[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Making a silk purse out of the schema sows ear - was [xml-
As noted since I don't know the ASL syntax I could be interpreting those examples you pointed to completely wrong. Cheers, Bryan Rasmussen On 2/9/06, bryan rasmussen <rasmussen.bryan@g...> wrote: > Well, looking at what you pointed to the first example also has > sorting, which is somewhat outside the bounds of what anyone has > discussed as validation before. As for the other ones I'm not exactly > sure what you're validating (maybe due to not having time to learn ASL > syntax)? > > Actually this one > http://reflex.gforge.inria.fr/tutorial/weather-report/schema2.asl > looks like you're changing the value of the temp attributes if scale > attribute equals the Fahrenheit scale. > > Another in the list of schema languages that people don't note too > often is DSD http://www.brics.dk/DSD/ > > Cheers, > Bryan Rasmussen > > > > On 2/9/06, Philippe Poulard <Philippe.Poulard@s...> wrote: > > This is a remark that has been made in comp.text.xml > > > > Unlike schematron, ASL computes content models, which allow > > tools such as editors to predict which element is allowed ; schematron > > is not predictive, it can only warn that a rule has not been followed > > AFTER the user has made the mistake, for example by inserting an element > > that is not allowed. > > > > There is a great difference between a tool such as schematron that > > checks if everything is right in the XML document, and other schema > > technologies (DTD, RelaxNG, WXS, ASL) that are able to draw up a > > contextual list of XML material (attributes, elements, text) that is > > legal to use. You can consider that the Active Schema Language is like a > > deep integration of known schemata (DTD, RNG, WXS) with an assertion > > language such as schematron ; a deep integration goes further than using > > schematron in WXS or RNG because even if they are located in the same > > XML instance, they are processed separately. > > > > Here is a mix of RNG + schematron : > > <?xml version="1.0" encoding="UTF-8"?> > > <grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0" > > xmlns:sch="http://www.ascc.net/xml/schematron"> > > <start> > > <element name="table"> > > <oneOrMore> > > <element name="column"> > > <sch:pattern name="Check to have the same number of cells in > > each column" id="cells"> > > <sch:rule context="column"> > > <sch:assert test="count(../column[1]/cell) = > > count(cell)">The number of cells in this > > column should be the same as in the firtst column, > > expected <sch:value-of > > select="count(../column[1]/cell)"/> but got > > <sch:value-of select="count(cell)"/>. > > </sch:assert> > > </sch:rule> > > </sch:pattern> > > <oneOrMore> > > <element name="cell"> > > <empty/> > > </element> > > </oneOrMore> > > </element> > > </oneOrMore> > > </element> > > </start> > > </grammar> > > > > Anyway, another point that is not covered by schematron is the > > capability to design smart data types such as semantic data types, as > > shown in this example : > > http://reflex.gforge.inria.fr/tutorial.html#N800F69 > > This is a very basic problem that known schematas can't resolve. > > I think that neither WXS nor schematron could perform the same result > > (just tell me how if I'm wrong) > > > > bryan rasmussen wrote: > > > In Schematron - however going for xslt implementation of schematron by > > > using the current function: > > > > > > <sch:rule context="table/column[1]"> > > > <sch:report > > > test="following-sibling::column[count(cell)>current()[count(cell)]]" > > > >cells need to be the same number per column > > > </sch:report> > > > > > > </sch:rule> > > > > > > Cheers, > > > Bryan Rasmussen > > > > > > > > > > > > > > > On 2/9/06, Philippe Poulard <Philippe.Poulard@s...> wrote: > > > > > >>hi, > > >> > > >>IMHO, the main difficulty that schema technologies encounter is their > > >>poor capabilities to express constraints because they are hard-coded in > > >>the schema. This is the case for occurrence constraints and content > > >>model definitions. > > >> > > >>I have experimented a schema language that allows to compute the > > >>occurrence constraints dynamically and that allows to switch from a > > >>declarative language to an imperative one, which increases dramatically > > >>the expressiveness of the schema. The idea is to push back the limits of > > >>the declarative language when they are reached. > > >> > > >>An example : > > >>a RelaxNG user was complaining about a constraint that he couldn't > > >>express : he had to design a <table> with any <column>s but <column>s > > >>should have the same number of <cell>s > > >> > > >>I respond that he could consider an alternative schema technology, such > > >>as these that I designed : > > >><asl:element name="column"> > > >> <asl:sequence> > > >> <xcl:if test="{ asl:element()/preceding-sibling::column }"> > > >> <xcl:then> > > >> <asl:element ref-elem="cell" min-occurs="{ > > >> $asl:max-occurs }" max-occurs="{ count( asl:element()/../column[1]/cell > > >> ) }"/> > > >> </xcl:then> > > >> <xcl:else> > > >> <asl:element ref-elem="cell" min-occurs="1" > > >> max-occurs="unbounded"/> > > >> </xcl:else> > > >> </xcl:if> > > >> </asl:sequence> > > >></asl:element> > > >>The full schema and the running results are available here : > > >>http://groups.google.com/group/comp.text.xml/browse_thread/thread/d97cd4adf1964fdb/2f92e65b7ad48dff?hl=en#2f92e65b7ad48dff > > >> > > >>This demonstrates that a simple if-then-else statement allows to build a > > >>made-to-measure content model with dynamic occurrence constraints. > > >> > > >>I named that schema language the Active Schema Language and I have an > > >>almost full implementation of it in Java, called RefleX : > > >>http://disc.inria.fr/perso/philippe.poulard/xml/active-tags/active-schema/active-schema.html > > >>http://reflex.gforge.inria.fr/ > > >>You can read the examples, download the tool and play with it. > > >> > > >>Moreover, ASL allows to design smart data types ; there is a tutorial in > > >>the RefleX web site that shows a semantic data type : the "temperature" > > >>data type, which is able to parse "32°F" and "20°C" ; as this type is > > >>used to augment the amount of information of the XML document, we can > > >>sort a list of attributes of this type not on the string values but on > > >>the typed values > > >>http://reflex.gforge.inria.fr/tutorial.html#N800F69 > > >> > > >>It is worth seeing because all the problems you consider in your message > > >>are pointed out and solutioned in ASL. > > >> > > >>Michael Champion wrote: > > >> > > >>>I think the reality is that lots of people flipped the Bozo Bit on the > > >>>XSD spec in 1999-2000. They went in different directions, however: > > >>>Some to alternative schema languages, some to radical simplification of > > >>>XML to de-emphasize schemas altogether. > > >>> > > >>> > > >>> > > >>>In hindsight, had people foreseen today's reality that we're stuck with > > >>>XSD as what the mainstream user thinks of as the "real standard", > > >>>clearly the energy would have been better spent debugging the wretched > > >>>thing rather than trying to pretend it doesn't exist or trying to drive > > >>>a stake thru its heart. I'm more interested in discussing what to do > > >>>going forward given the current mess. The problems I see are: > > >>> > > >>> > > >>> > > >>>- The W3C is more interested in moving the XSD spec forward than fixing > > >>>its numerous ambiguities. (Their pushback is that the people who want > > >>>to fix it are not represented on the WG, and the people who have skin in > > >>>the game want to move forward). > > >>> > > >>>- RELAX NG is clearly "better" for textual documents but doesn't have > > >>>much support for the data-oriented use cases. (Sure you can plug in the > > >>>XSD type system, but that's a big part of the problem). We now have an > > >>>unpleasant situation of fragmentation where there's little mainstream > > >>>tool support for RELAX NG due to lack of demand, exploitation of its > > >>>geek chic (partly to strike a blow against the empire, I suppose), with > > >>>the result that the normative definitions of Atom and ODF can't be used > > >>>with most commercial XML tools. Maybe a good guerilla tactic in the > > >>>open source wars, but for the moment it's the innocent who suffer the > > >>>collateral damage. > > >>> > > >>> > > >>> > > >>>- Schematron is moving forward as an ISO standard and has some good > > >>>implementations but has few normative references in vertical industry > > >>>standards nor mindshare. (Correct me if I'm wrong about the normative > > >>>references). > > >>> > > >>> > > >>> > > >>>- Lots of people complain about the limitations of XSD that Schematron > > >>>addresses and the W3C doesn't plan to, especially the lack of occurrence > > >>>constraints. > > >>> > > >>>The best way forward that I can see is to encourage end users to > > >>>employ XSD + Schematron as necessary, and encourage W3C to address XSD's > > >>> bugs and ambiguities before adding more onto an unstable foundation. > > >>>What does that miss that the world actually values? (as much as it > > >>>depresses me to say it, the world doesn't seem to value RELAX NG's > > >>>elegance and mathematical foundation very much). > > >>> > > >> > > >>-- > > >>Cordialement, > > >> > > >> /// > > >> (. .) > > >> --------ooO--(_)--Ooo-------- > > >>| Philippe Poulard | > > >> ----------------------------- > > >> http://reflex.gforge.inria.fr/ > > >> Have the RefleX ! > > >> > > >>----------------------------------------------------------------- > > >>The xml-dev list is sponsored by XML.org <http://www.xml.org>, an > > >>initiative of OASIS <http://www.oasis-open.org> > > >> > > >>The list archives are at http://lists.xml.org/archives/xml-dev/ > > >> > > >>To subscribe or unsubscribe from this list use the subscription > > >>manager: <http://www.oasis-open.org/mlmanage/index.php> > > >> > > >> > > > > > > ----------------------------------------------------------------- > > > The xml-dev list is sponsored by XML.org <http://www.xml.org>, an > > > initiative of OASIS <http://www.oasis-open.org> > > > > > > The list archives are at http://lists.xml.org/archives/xml-dev/ > > > > > > To subscribe or unsubscribe from this list use the subscription > > > manager: <http://www.oasis-open.org/mlmanage/index.php> > > > > > > > > > > > > -- > > Cordialement, > > > > /// > > (. .) > > --------ooO--(_)--Ooo-------- > > | Philippe Poulard | > > ----------------------------- > > http://reflex.gforge.inria.fr/ > > Have the RefleX ! > > >
|
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
|