[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] What does "optional" mean?
- From: Mukul Gandhi <gandhi.mukul@gmail.com>
- To: "Costello, Roger L." <costello@mitre.org>
- Date: Sun, 26 Feb 2012 20:21:48 +0530
Hi Roger,
I've no disagreements so far with any of your statements in this post.
To take this discussion little further, can I please present a
possibly relevant use case for these scenarios.
Following is an use case, that probably makes the notion of "optional"
in XML documents *necessary*,
Let's assume, that a book object may be represented in an XML format
in either of following ways,
<book isbn="123">
<name>book1</name>
</book>
OR
<book>
<isbn>123</isbn>
<name>book1</name>
</book>
i.e, an ISBN number of book may be represented either as an attribute
or as a child element of element book, but not at both of these
places. To define a schema for this need (at least with XSD I
believe), a schema author I think *must* make the attribute "isbn" and
the element "isbn" as optional and constrain a singular cardinality of
the semantic information "isbn" via another schema constraint.
On Sun, Feb 26, 2012 at 7:41 PM, Costello, Roger L. <costello@mitre.org> wrote:
> Hi Folks,
>
> Every schema language (DTD, XSD, RNG) has the notion of optional -- optional elements and optional attributes.
>
> But what does it mean to declare an element or attribute optional?
>
> Here are some possibilities:
>
> 1. The information that would be contained within the element or attribute is of secondary or lesser importance. This is in contrast to a mandatory element or attribute which contains information of primary importance. Thus, optionality is an indication of the importance (rather, the lack of importance) of the information contained within the element or attribute. This is analogous to the common practice in textbooks to place the core concepts first and the non-core concepts last. Under this interpretation, it would be perfectly reasonable for a consumer to ignore optional elements and attribute because they provide only non-core information.
>
> 2. Yesterday Jim Melton and Michael Kay beautifully described schemas as an abstraction [1][2]. That is, a schema is a determination of the information that is relevant when modeling the real world. But if a certain property is determined relevant (and thus included in the schema), then why would one turn around and make it optional? Isn't that tantamount to saying it's not relevant? Isn't that a contradiction?
>
> 3. A third possibility is that optional means "Hey, if you don't have the information then you can omit this element (or attribute)."
>
> I've listed three possible meanings of "optional":
>
> -- In the first meaning, it indicates: of-lesser-importance.
>
> -- In the second meaning, it indicates: irrelevance.
>
> -- In the third meaning, it indicates: lack-of-knowledge.
>
> So what does "optional" really mean?
>
> You may reply, "It means anything you want it to mean." If so, how can there be an effective exchange of information? Surely there must be more precision to the term than "It means anything."
>
> What do you think "optional" means?
>
> /Roger
>
> [1] http://lists.xml.org/archives/xml-dev/201202/msg00248.html
>
> [2] http://lists.xml.org/archives/xml-dev/201202/msg00249.html
--
Regards,
Mukul Gandhi
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]