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:
*/orm:ORMModel/orm:Facts/orm:SubtypeFact[orm:FactRoles/orm:SupertypeMetaRole[@id=../../../../orm:Constraints/orm:ExclusionConstraint/orm:RoleSequences/orm:RoleSequence/orm:Role/@ref]]
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:
-
From an orm:EntityType, look at all of the orm:PlayedRoles/orm:SubtypeMetaRole elements
-
Find the orm:SubtypeFact/orm:FactRoles/orm:SupertypeMetaRole corresponding to this orm:SubtypeMetaRole
-
Find all exclusion constraints that restrict this orm:SupertypeMetaRole
-
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.
-Matt