XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] How you interpret your business rules has a profoundimpact on XML design

Deciding which is the target/context of the assertion is similar, yes,
to deciding which is to be considered invalid. In this case, though,
you would have to admit that that decision is completely arbitrary.
What you have shown is that there are some categories of assertions
where the target/context is arbitrary. It's similar to saying that, in
grammatical terms

Fred is younger than Bob = Bob is older than Fred

However, which of the above two statements/assertions is chosen
will depend on other factors. It depends on the 'use case'/'scenario'.
It most likely depends on whether youth is the emphasis or agedness.
If I'm making the assertion in a scenario where youth is the emphasis
such as a discussion about who is the youngest then I'd use the first
but it would still be OK / valid to use the second.

----
Stephen D Green



On 24 March 2011 22:25, Costello, Roger L. <costello@mitre.org> wrote:
> Hi Folks,
>
> Consider this book store document:
>
> <?xml version="1.0"?>
> <BookStore storename="BarnesAndNoble">
>        <Book>
>                <Title>Don't Make Me Think</Title>
>                <Author>Steve Krug</Author>
>                <Date>2006</Date>
>                <ISBN>0-321-34475-8</ISBN>
>                <Publisher>New Riders</Publisher>
>        </Book>
>        ...
> </BookStore>
>
> The document is used by a community that has this business rule:
>
> -------------------------------------------------
> Business Rule
>
>    The value of Publisher depends on the store:
>
>       If the store is BarnesAndNoble then
>       Publisher can be either Wrox Press or
>       New Riders
>
>       If the store is Borders then Publisher can
>       be either Norton Press or friendsofed
> -------------------------------------------------
>
> Given that business rule, this is invalid (because 'friendsofed' is an invalid publisher for the store 'BarnesAndNoble'):
>
> <?xml version="1.0"?>
> <BookStore storename="BarnesAndNoble">
>        <Book>
>                <Title>Don't Make Me Think</Title>
>                <Author>Steve Krug</Author>
>                <Date>2006</Date>
>                <ISBN>0-321-34475-8</ISBN>
>                <Publisher>friendsofed</Publisher>
>        </Book>
> </BookStore>
>
>
> What is invalid?
>
>  - Is BookStore invalid?
>  - Or, is Publisher invalid?
>
> Is the business rule a statement about what are valid BookStores? Or, is the business rule a statement about what are valid values of Publisher given its context?
>
> The question is important. It's answer has a profound impact on XML design.
>
>
> IMPACT ON XML DESIGN
>
> If the business rule is a statement about what are valid BookStores then, when you design your XML Schema, you should position an <assert> element on the BookStore element declaration:
>
>   Assert: Book/Publisher = ('Wrox Press', 'New Riders')
>
> If the business rule is a statement about what are valid values of Publisher given its context then, when you design your XML Schema, you should position <alternative> elements in the Publisher element declaration:
>
>   Alternative: if @storename='BarnesAndNoble' then text() = ('Wrox Press', 'New Riders')
>   Alternative: if @storename='Borders' then text() = ('Norton Press', 'friendsofed')
>
> and you should declare the storename attribute to be "inheritable".
>
> You must specify the store name in an attribute value and not in an element name. The following XML design would make it impossible to implement the business rule:
>
> <?xml version="1.0"?>
> <BarnesAndNoble>
>        <Book>
>                <Title>Don't Make Me Think</Title>
>                <Author>Steve Krug</Author>
>                <Date>2006</Date>
>                <ISBN>0-321-34475-8</ISBN>
>                <Publisher>New Riders</Publisher>
>        </Book>
> </BarnesAndNoble>
>
>
> QUESTION
>
> Is the business rule a statement about what are valid BookStores or is it a statement about what are valid values of Publisher given its context?
>
> /Roger
>
> _______________________________________________________________________
>
> XML-DEV is a publicly archived, unmoderated list hosted by OASIS
> to support XML implementation and development. To minimize
> spam in the archives, you must subscribe before posting.
>
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
> subscribe: xml-dev-subscribe@lists.xml.org
> List archive: http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
>
>


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


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS