[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] How to represent step-by-step procedures in XML?
- From: Stephen D Green <stephengreenubl@gmail.com>
- To: Roger L Costello <costello@mitre.org>
- Date: Sat, 20 Aug 2022 17:54:57 +0100
http://docs.oasis-open.org/tamie/xtemp/v1.0/xtemp-v1.0.html
----
Stephen D Green
On Sat, 20 Aug 2022 at 17:30, Roger L Costello <costello@mitre.org> 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:
>
> An XML representation will provide a precise description of how to obtain the navaid records for an airport.
> 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.
> 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
>
>
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]