| 1 |
<HTML> |
| 2 |
<HEAD> |
| 3 |
<TITLE>stag-autoschema</TITLE> |
| 4 |
<LINK REV="made" HREF="mailto:[email protected]"> |
| 5 |
</HEAD> |
| 6 |
|
| 7 |
<BODY> |
| 8 |
|
| 9 |
<A NAME="__index__"></A> |
| 10 |
<!-- INDEX BEGIN --> |
| 11 |
|
| 12 |
<UL> |
| 13 |
|
| 14 |
<LI><A HREF="#name">NAME</A></LI> |
| 15 |
<LI><A HREF="#synopsis">SYNOPSIS</A></LI> |
| 16 |
<LI><A HREF="#description">DESCRIPTION</A></LI> |
| 17 |
<LI><A HREF="#arguments">ARGUMENTS</A></LI> |
| 18 |
<LI><A HREF="#limitations">LIMITATIONS</A></LI> |
| 19 |
</UL> |
| 20 |
<!-- INDEX END --> |
| 21 |
|
| 22 |
<HR> |
| 23 |
<P> |
| 24 |
<H1><A NAME="name">NAME</A></H1> |
| 25 |
<P>stag-autoschema.pl - writes the implicit stag-schema for a stag file</P> |
| 26 |
<P> |
| 27 |
<HR> |
| 28 |
<H1><A NAME="synopsis">SYNOPSIS</A></H1> |
| 29 |
<PRE> |
| 30 |
stag-autoschema.pl -w sxpr sample-data.xml</PRE> |
| 31 |
<P> |
| 32 |
<HR> |
| 33 |
<H1><A NAME="description">DESCRIPTION</A></H1> |
| 34 |
<P>Takes a stag compatible file (xml, sxpr, itext), or a file in any |
| 35 |
format plus a parser, and writes out the implicit underlying stag-schema</P> |
| 36 |
<P>stag-schema should look relatively self-explanatory.</P> |
| 37 |
<P>Here is an example stag-schema, shown in sxpr syntax:</P> |
| 38 |
<PRE> |
| 39 |
(db |
| 40 |
(person* |
| 41 |
(name "s" |
| 42 |
(address+ |
| 43 |
(address_type "s") |
| 44 |
(street "s") |
| 45 |
(street2? "s") |
| 46 |
(city "s") |
| 47 |
(zip? "s")))))</PRE> |
| 48 |
<P>The database db contains zero or more persons, each person has a |
| 49 |
mandatory name and at least one address.</P> |
| 50 |
<P>The cardinality mnemonics are as follows:</P> |
| 51 |
<DL> |
| 52 |
<DT><STRONG><A NAME="item_%2B">+</A></STRONG><BR> |
| 53 |
<DD> |
| 54 |
1 or more |
| 55 |
<P></P> |
| 56 |
<DT><STRONG><A NAME="item_%3F">?</A></STRONG><BR> |
| 57 |
<DD> |
| 58 |
0 or one |
| 59 |
<P></P> |
| 60 |
<LI> |
| 61 |
0 or more |
| 62 |
<P></P></DL> |
| 63 |
<P>The default cardinality is 1</P> |
| 64 |
<P> |
| 65 |
<HR> |
| 66 |
<H1><A NAME="arguments">ARGUMENTS</A></H1> |
| 67 |
<DL> |
| 68 |
<DT><STRONG><A NAME="item_%2Dp%7Cparser_FORMAT">-p|parser FORMAT</A></STRONG><BR> |
| 69 |
<DD> |
| 70 |
FORMAT is one of xml, sxpr or itext, or the name of a perl module |
| 71 |
<P>xml assumed as default</P> |
| 72 |
<P></P> |
| 73 |
<DT><STRONG><A NAME="item_%2Ddtd">-dtd</A></STRONG><BR> |
| 74 |
<DD> |
| 75 |
exports schema as DTD |
| 76 |
<P></P> |
| 77 |
<DT><STRONG><A NAME="item_%2Dw%7Cwriter_FORMAT">-w|writer FORMAT</A></STRONG><BR> |
| 78 |
<DD> |
| 79 |
FORMAT is one of xml, sxpr or itext, or the name of a perl module, OR DTD |
| 80 |
<P>The default is sxpr</P> |
| 81 |
<P>note that stag schemas exported as xml will be invalid xml, due to the |
| 82 |
use of symbols *, +, ? in the node names</P> |
| 83 |
<P></P></DL> |
| 84 |
<P> |
| 85 |
<HR> |
| 86 |
<H1><A NAME="limitations">LIMITATIONS</A></H1> |
| 87 |
<P>not event based - memory usage becomes exhorbitant on large files; |
| 88 |
prepare a small sample beforehand</P> |
| 89 |
|
| 90 |
</BODY> |
| 91 |
|
| 92 |
</HTML> |