OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

relax-ng-comment message

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


Subject: Re: RNC -- where to find newbie help?


You don't have to do anything special to have content depend on 
attribute.  If the allowed content for an element <foo> depends on the 
value of an attribute t, then just write a pattern for each possible 
value of t and combine them with choice.

element foo {
   (attribute t { "x" }, element x { empty })
   | (attribute t { "y" }, element y { empty })
}

Bruce D'Arcus wrote:
> 
> BTW, here's what I want to post, in case it's easier to just forward it.
> 
> Bruce
> =======
> 
> I hope you don't mind newbie questions.  I am trying to design at least 
> the beginning framework of a schema for bibliographic data.  However, I 
> am new both to xml design (and I'm an academic; not a software 
> developer!), and to Relax NG.  As such, the questions here will mix more 
> general issues of data design with more specific issues of RNG, and RNC 
> syntax.
> 
> (If you want to jump to my most basic question in this rather long 
> message, it's marked with ***)
> 
> What I need:
> 
> I am working with a few people -- Peter Flynn among them -- who are 
> trying put together a DTD/Schema-independent bibliographic formatting 
> engine; in essence a turbo-charged XML version of BibTeX for the 21st 
> century.
> 
> The logic of this system is based on the new MODS XML Schema from the 
> Library of Congress, though it is agnostic about input data.  The data 
> model of MODS is ideal as a basis because it focuses not on concrete 
> classifications like articles or books, but rather on the structure of 
> bibliographic data.  Here you focus not on "articles" or "book 
> chapters", but rather on parts that are linked to containers, etc.  This 
> makes it much more flexible than existing bibliographic data models like 
> BibTeX, etc.
> 
> While this is great for a formatter and for archiving purposes, it does 
> present difficulties for data entry in XML editors.  To wit, I want to 
> write an input schema in RNC that civilizes the structural logic of 
> MODS.  I have chosen RNC because it is simpler for me than even DTDs but 
> leaves lots of room to grow as I learn, and because of Trang.
> 
> Anyway, I am thinking of a sample record like this:
> 
> <bibentry type="article" id="Doe1999a">
>    <name role="author">
>       <givenName>John</givenName>
>       <familyName>Doe</familyName>
>    </name>
>    <titles>
>       <title>A Title</title>
>       <subtitle>A Subtitle</subtitle>
>    </titles>
>    <originInfo>
>     <date year="1999" month="6"/>
>    </originInfo>
>    <in type="periodical" genre="journal">
>       <titles>
>          <title>A journal</title>
>       </titles>
>       <part>
>          <volume>3</volume>
>          <issue>4</issue>
>          <pages>
>             <start>23</start>
>             <end>54</end>
>          </pages>
>       </part>
>    </in>
> </bibentry>
> 
> So I'd have top-level elements like titles, names, originInfo, in (with 
> type attributes that distinguish between monographs and serials), etc.
> 
> They'd then be plugged together something like:
> 
> Article = element article {
>        Name*, Titles, originInfo, In.Periodical
>        }
> 
> Chapter = element chapter {
>        Name*, Titles, originInfo, In.Monograph
>        }
> 
> Book = element book {
>        Name*, Titles, originInfo
>        )
> 
> Note: the above isn't right because I think the types should be defined 
> in an attribute within a bibentry element.  However, I'm not sure how to 
> do this.
> 
> ***
> So, question 1: can I have the mix of elements be dependent on the type 
> attribute in the bibentry element?  If yes, how?
> Finally, I need to build in extensibility such that new "types" can be 
> added by different users that -- and this is key -- preserve the 
> structural logic of MODS so data is portable and transformation 
> reliable.  The type attribute here thus becomes in essence a named 
> proxy.  (MODS has no concept of such typing, and this is a good thing, 
> but it probably makes data entry more difficult.)
> 
> Anyway, here's the skeleton of where I'm at, with places of confusion 
> indicated with the ???:
> 
> ============ BEGIN ================
> 
> start = Biblio
> 
> Biblio = element biblio { Bibentry+ }
> 
> # Below I need to say "the mix of elements in bibentry depends on the
> # type attribute value. (The ext... thing is to allow future extension, 
> BTW.)
> 
> Bibentry = element bibentry { ??? } |ext.Bibentry
> 
> # So in the following two examples (there will be a long list) I want to 
> define which
> # pieces to include when the type attribute is equal to name on the 
> left.  Does this make
> # sense??
> 
> Article = ???
> 
> Book = ???
> 
> ###################################
> 
> Titles = element titles
> 
> Names = element names
> 
> OriginInfo = element originInfo
> 
> # Below I (think) I need to distinguish between "in" containers that
> # are monographs (books) and those that are serials (journals).
> #
> # Note: this presents some issues because in the example record
> # above I am using specific element names like volume that will
> # be contained in this element.  However, MODS just uses generic
> # element names for these data and codes the type in an attribute.
> # This might be more flexible.  Below I use this approach.
> 
> In = element in { Name*, Titles, OriginInfo, Part }
> 
> Part = element part {Single*, Range*}
> 
> # an alternative for the above is something like:
> # part {Volume?, Issue?, Section?, Paragraph?, Pages?}
> 
> ####################################
> 
> # Here's where I want the extension that allows additional named types
> # to be added.  I've no idea how best to do this though, and I've no 
> idea how
> # or whether this extension mechanism ought to extend to the "in" element
> # as well.
> 
> ext.Bibentry = notAllowed
> 
> ============= END =================
> 
> Help and suggestions much appreciated.  Am I even on the right track here?
> 
> Bruce
> 
> 




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