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] Redundancy is an error?

> I am learning the Alloy modelling language. It is so cool. One interesting
> aspect of Alloy is this rule:
>
>                 An expression is erroneous if it can be shown
>                to be redundant, using types alone.
>

This statement shouldn't be interpreted as absolute.

I understand that in a system that has a number of facts and rules,
and using which it builds new facts and tries to find a contradiction
with existing facts, it is important that among the facts and rules
there isn't redundancy, because redundant (equivalent) fact and rules
can exponentially increase the chains of processing logic.

> I am trying to see if any of the XML technologies have an equivalent rule.

However, in many other systems redundancy can be actually a *good*
thing -- such as in the cases of error-correction and detection.

There is a good software - maintenance rule: "Write code that can
easily be deleted"  -- and one (at least initial) way of doing this is
to write redundant code so that it can be deleted easily, without
touching the original base.


Cheers,
Dimitre





On Sun, Nov 20, 2016 at 11:20 AM, Costello, Roger L. <costello@mitre.org> wrote:
> Hi Folks,
>
> I am learning the Alloy modelling language. It is so cool. One interesting
> aspect of Alloy is this rule:
>
>                 An expression is erroneous if it can be shown
>                to be redundant, using types alone.
>
> A common and simple case of redundancy is an expression that is equal to the
> empty relation (set). For example, if sets A and B are disjoint, then (A
> intersect B) is empty and therefore redundant (and therefore erroneous).
>
> I am trying to see if any of the XML technologies have an equivalent rule.
>
> It seems that XSD does not. Consider: the following schema says that an XML
> instance document can never have a <Foo> element:
>
> <xs:element name="Book">
>     <xs:complexType>
>         <xs:sequence>
>             <xs:element name="Title" type="xs:string"/>
>             <xs:element name="Author" type="xs:string"/>
>             <xs:element name="Date" type="xs:string"/>
>             <xs:element name="Foo" minOccurs="0" maxOccurs="0"
> type="xs:string"/>
>         </xs:sequence>
>     </xs:complexType>
> </xs:element>
>
>
>
> The Foo element declaration is redundant – it declares an element that can
> never manifest in XML instances. Redundancy is not an error in XSD.
>
>
>
> It also seems that redundancy is not an error in XSLT/XPath. Consider: the
> following XSLT has an XPath expression that can never be satisfied:
>
>
>
> <xsl:template match="/">
>     <xsl:choose>
>         <xsl:when test="name(/*[position() eq 0]) eq 'foo'">foo</xsl:when>
>         <xsl:when test="name(/*[position() eq 1]) eq 'bar'">bar</xsl:when>
>         <xsl:when test="name(/*[position() eq 1]) eq 'blah'">blah</xsl:when>
>     </xsl:choose>
> </xsl:template>
>
>
>
> In the vast universe of XML technologies, is there anywhere a rule that
> requires redundancy be treated as an error?
>
> /Roger
>
>



-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
To achieve the impossible dream, try going to sleep.
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they
write all patents, too? :)
-------------------------------------
Sanity is madness put to good use.
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.


[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