The ORM Foundation

Get the facts!

Exclusion constraint in XML representation

Last post Mon, Feb 28 2011 14:07 by Matthew Curland. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • Mon, Feb 28 2011 7:43

    • ralberts
    • Top 150 Contributor
    • Joined on Thu, Oct 14 2010
    • Posts 3

    Exclusion constraint in XML representation


    I am looking for the representation of the exclusion constraint (between different roles) in the XML representation of my NORMA schema.

    Could you please point me in the right direction?

    I found the supertype and associated subtype roles in the orm:EntityType/orm:PlayedRoles tag, but I cannot figure out how the exclusion constraint defined on the subtypes is represented in the XML.

     Any help with this will be highly appreciated.



  • Mon, Feb 28 2011 14:07 In reply to

    Re: Exclusion constraint in XML representation

    Hi Ronell,

    A subtype in NORMA is a special kind of FactType with two roles shown in the XML as orm:SupertypeMetaRole and SubtypeMetaRole. All constraints shown as being attached to a subtype link are actually attached to the supertyp meta roles. For example, from the root element context, the following xpath will give you all orm:SubtypeFact elements that are referenced in some ExclusionConstraint:


    Of course, this gets more interesting if your context is an EntityType and you want to know the exclusive subtypes for that entity type. This would be a multi-part query most easily done in XSLT with the following steps:

    1. From an orm:EntityType, look at all of the orm:PlayedRoles/orm:SubtypeMetaRole elements
    2. Find the orm:SubtypeFact/orm:FactRoles/orm:SupertypeMetaRole corresponding to this orm:SubtypeMetaRole
    3. Find all exclusion constraints that restrict this orm:SupertypeMetaRole
    4. Translate the supertype roles back to the subtype roles

    This gives you direct excluded subtypes, but not indirect, which would be more XML work.

    If you have some of this in an XSLT already I'd be happy to give you some pointers. Personally, I try to avoid doing xpath work directly in .NET. I write transform files, compile them in as resources, then load/compile and execute the transforms from code.


Page 1 of 1 (2 items)
© 2008-2019 The ORM Foundation: A UK not-for-profit organisation -------------- Terms of Service