Re: How to represent step-by-step procedures in XML?
Dimitre Novatchev <[email protected]>
| Newsgroups | gmane.text.xml.devel |
|---|---|
| Message-ID | <CAK4KnZec0D3k8wYRsayyjqjF1yeHjsQAHD0o49WQ-BBeM08wMg@mail.gmail.com> |
(1) > I am seeking a high-level XML representation, one that is understandable by a manager (2) > and at the same time is sufficiently detailed that it can be executed I think both parts of this sentence are almost mutually exclusive ... For the first part, though, a few types of UML diagrams can probably be well understood by managers? Such as Use case diagram or Activity diagram just to name a few? I even think UML was invented primarily with this purpose And of course, one needs a definition of "manager". For me "manager" implies abstraction, overall level of control and perception, and no need to go into fine-grain details. Thanks, Dimitre On Sat, Aug 20, 2022 at 9:30 AM Roger L Costello <[email protected]> wrote: > Hi Folks, > > Before I get to my question, please allow me to share a short story. > > Early versions of Fortran did not have high-level programming language > constructs such as while-loops, so some smart person came along and created > RATFOR (Rational Fortran), which extended Fortran with several high-level > constructs. That person then created a preprocessor which converted > programs expressed in RATFOR into equivalent Fortran programs. For example, > here is a RATFOR program that uses the high-level while-loop construct: > > while (getc(c) != EOF) > call putc(c) > > The RATFOR preprocessor converts it to this equivalent Fortran code: > > 10 if (getc(c) .eq. EOF goto 20 > call putc(c) > goto 10 > 20 continue > > Now for my question. > > *Question*: How to represent step-by-step procedures in XML? The XML > representation must be: > > - Sufficiently detailed and precise that a program could input it and > carry out the procedure being described. Alternatively, a preprocessor > could take the description and convert it into an existing programming > language which may then be executed. > - The XML representation must be high-level enough that it is > understandable by managers. > > What follows is a real-world example to illustrate my question. > > I have a file named ARPT.xml which contains a list of records for all the > airports in the world. Each record contains data about an airport. > > I have another file named NAV.xml which contains a list of records for all > the navigation aids (navaids) in the world. Each record contains data about > a navaid. > > Some navaids are placed in locations to help airplanes fly between > airports. Other navaids are placed in locations to help airplanes fly in > and out of airports. > > Some airports are close to each other, so some navaids are used by more > than one airport. In some cases, the same navaid is used by airports in > different countries; for example, at the US-Canada border there might be a > navaid that is shared between airports in the US and Canada. > > Since a navaid may be used by more than one airport, there is a file named > ANAV.xml that is intermediary between ARPT.xml and NAV.xml; it maps a nav > ID and country ID to the navaid records for the airport. In other words, > there is a level of indirection to obtaining the navaid records for an > airport. We use the airport ID from ARPT.xml as a foreign key into ANAV.xml > to obtain a set of ANAV records, and for each ANAV record, we use its nav > ID and country ID as a composite foreign key into NAV.xml. The selected NAV > records are the airport’s navaids. > > How to represent in XML the procedure for obtaining the navaid records for > an airport? > > You might wonder, “Why create an XML representation of a * procedure*?” > > The answer is threefold: > > 1. An XML representation will provide a precise description of how to > obtain the navaid records for an airport. > 2. With that precise, machine-processable description, I can then use > it as input into a program that performs the procedure. The program simply, > blindly follows the description in the XML. Alternatively, a preprocessor > could take the XML description and convert it into an existing programming > language that may then be executed. > 3. The procedure I just described is one of many procedures that I > need to capture. Many of the procedures are more complicated than the one I > described above. A standard, machine-processable way to express all > procedures will prove invaluable. > > Here is one possible XML representation of the procedure: > > <Procedure> > <variable name="ARPT.XML" select="doc('ARPT.xml')"/> > <variable name="ANAV.XML" select="doc('ANAV.xml')"/> > <variable name="NAV.XML" select="doc('NAV.xml')"/> > <airports> > <for-each select="$ARPT.XML/record"> > <airport> > <variable name="airport-ID" select="child::airport-ID" /> > <for-each select="child::*"> > <copy-of select="."/> > </for-each> > <for-each select="$ANAV.XML/record[child::airport-ID eq > $airport-ID]"> > <variable name="country-ID" > select="child::country-ID']" /> > <variable name="nav-ID" select="child::nav-ID" /> > <for-each select="$NAV.XML/record[child::nav-ID eq > $nav-ID][child::country-ID eq $country-ID"> > <navaid> > <for-each select="child::*"> > <copy-of select="."/> > </for-each> > </navaid> > </for-each> > </for-each> > </airport> > </for-each> > </airports> > </Procedure> > > Readers may recognize that as XSLT code, minus the xsl namespace prefix. > > That XML representation is simply not acceptable. It probably can be > understood by a developer who knows XSLT, but to most developers and to > most managers it is pure gibberish. It is analogous to the Fortran shown > about. > > I am seeking a high-level XML representation, one that is understandable > by a manager and at the same time is sufficiently detailed that it can be > executed, or I can write a preprocessor which converts it into equivalent > lower-level programming language code (analogous to how the RATFOR > preprocessor converts programs written in the high-level RATFOR into > equivalent low-level Fortran). > > I seek your suggestions on a high-level XML representation of the > airport/navaid procedure I described. > > /Roger > > >