[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: RE: Auto-generating XML documents from Schematron (was:N-Q

  • From: Rick Jelliffe <rjelliffe@allette.com.au>
  • To: "Costello, Roger L." <costello@mitre.org>
  • Date: Thu, 6 Apr 2017 19:29:36 +1000

Re:  RE: Auto-generating XML documents from Schematron (was:N-Q
Is the issue really 'Can Alloy generate models etc that Schematron cannot?' Or is it 'can a Schematron/XPath schema be translated into an Alloy model?'

Seeing that Michael made an XPath 1.0 data model to Alloy converter, it seems likely to me that the conversion is entirely possible, to some degree of completeness. There are also papers detailing the translation of XPath into predicate logic IIRC that would provide more info. 

Then the issue would be whether the particular schema is closed and complete enough to generate documents, I expect.


On 6 Apr 2017 00:58, "Costello, Roger L." <costello@mitre.org> wrote:

Oops! My drawing of the chessboard had an error. Here’s the correct version:




From: Costello, Roger L.
Sent: Wednesday, April 5, 2017 10:49 AM
To: xml-dev@lists.xml.org
Subject: Auto-generating XML documents from Schematron (was: N-Queens problem)


Hi Folks,

As you know, Schematron can be used to express powerful data relationships. We saw an example of this with the N-Queens problem.

The Schematron document for the N-Queens problem can be used to validate XML instance documents, to check that they contain a valid solution to the N-Queens problem.


But, but, but, …

Finding a valid solution to the N-Queens problem can be difficult, particularly for large chessboards.

It would be useful if we could auto-generate valid solutions directly from the Schematron document.

I am not aware of any tool that can auto-generate XML instances from Schematron.

With Alloy, you can express the same powerful data relationships that you can express with Schematron. Plus, the Alloy Analyzer can auto-generate solutions. In fact, the Analyzer can auto-generate a comprehensive set of solutions.

For example, at the bottom of this message is an Alloy model of the N-Queens problem. I instructed the Alloy Analyzer to generate solutions for a 5 x 5 chessboard. The Analyzer generated a complete set of solutions. Here are two of the solutions that it auto-generated:



Alloy Model (thanks Loïc Gammaitoni)

sig Queen {
    column: Column,
    row: Row

fact Queens_Not_On_Same_Row_Or_Column {
    no disj q, q': Queen | q.column = q'.column
    no disj q, q': Queen | q.row = q'.row

fact Queens_Not_On_Diagonal {
    no disj q, q': Queen |
        some a,b: Int {
            add[q.column.id, a] = q'.column.id
            add[q.row.id, b] = q'.row.id
            a=b or a=sub[0,b]

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.