domparser
Class ProfileComparison

java.lang.Object
  |
  +--domparser.ProfileComparison

public class ProfileComparison
extends java.lang.Object

Main XML profile comparison class.

The comparison of two XML Profiles occurs here. The corresponding DocumentObject trees are traversed, and each node is compared according to the node type's pre-defined set of rules.

Version:
1.0
Author:
David Kong, Queen's University, August 2002.

Constructor Summary
ProfileComparison(DocumentObject profileA, DocumentObject profileB)
          Constructor
 
Method Summary
 boolean canBeOptional(DocumentObject profile)
          Returns a boolean indicating whether the DocumentObject provided possesses the Optionality attribute.
 boolean canCheckElement(DocumentObject profile)
          Returns a boolean indicating whether we can do the conformance check on the provided element.
 boolean compareProfiles(DocumentObject profileA, DocumentObject profileB)
          Applies the rules to the two DocumentObject objects, returning the boolean result of the rules.
 java.lang.Class[] getComponentRules()
          Returns the active rules from the Component Ruleset as an array of Class objects.
 java.lang.Class[] getConformanceRules()
          Returns the active rules from the Conformance Ruleset as an array of Class objects.
 java.lang.Class[] getDataValuesRules()
          Returns the active rules from the DataValues Ruleset as an array of Class objects.
 java.lang.Class[] getDerivativeRules()
          Returns the active rules from the Derivative Ruleset as an array of Class objects.
 java.lang.Class[] getDescriptionRules()
          Returns the active rules from the Description Ruleset as an array of Class objects.
 java.lang.Class[] getEncodingRules()
          Returns the active rules from the Encoding Ruleset as an array of Class objects.
 java.lang.Class[] getEncodingsRules()
          Returns the active rules from the Encodings Ruleset as an array of Class objects.
 java.lang.Class[] getEventFlowRules()
          Returns the active rules from the EventFlow Ruleset as an array of Class objects.
 java.lang.Class[] getFieldRules()
          Returns the active rules from the Field Ruleset as an array of Class objects.
 java.lang.Class[] getGenericRules()
          Returns the active rules from the Generic Ruleset as an array of Class objects.
 java.lang.Class[] getImpNoteRules()
          Returns the active rules from the ImpNote Ruleset as an array of Class objects.
 java.lang.Class[] getMessageRules()
          Returns the active rules from the Message Ruleset as an array of Class objects.
 java.lang.Class[] getParagraphRules()
          Returns the active rules from the Paragraph Ruleset as an array of Class objects.
 java.lang.Class[] getPostConditionRules()
          Returns the active rules from the PostCondition Ruleset as an array of Class objects.
 java.lang.Class[] getPreConditionRules()
          Returns the active rules from the PreCondition Ruleset as an array of Class objects.
 java.lang.Class[] getPredicateRules()
          Returns the active rules from the Predicate Ruleset as an array of Class objects.
 java.lang.Class[] getReferenceRules()
          Returns the active rules from the Reference Ruleset as an array of Class objects.
 java.lang.Class[] getSegmentGroupRules()
          Returns the active rules from the SegmentGroup Ruleset as an array of Class objects.
 java.lang.Class[] getSegmentRules()
          Returns the active rules from the Segment Ruleset as an array of Class objects.
 java.lang.Class[] getSpecificationRules()
          Returns the active rules from the Specification Ruleset as an array of Class objects.
 java.lang.Class[] getSTRules()
          Returns the active rules from the ST Ruleset as an array of Class objects.
 java.lang.Class[] getSubcomponentRules()
          Returns the active rules from the SubComponent Ruleset as an array of Class objects.
 java.lang.Class[] getUseCaseRules()
          Returns the active rules from the UseCase Ruleset as an array of Class objects.
 void traverse()
          Calls the traverseTrees method, and simply indicates whether Profile A and Profile B conform according to the rules that were applied.
 boolean traverseTrees(DocumentObject profileA, DocumentObject profileB)
          Traverses the two DocumentObject trees recursively, while applying conformance rules.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProfileComparison

public ProfileComparison(DocumentObject profileA,
                         DocumentObject profileB)
                  throws HL7Exception

Constructor

Initializes all the Ruleset objects and stores the two DocumentObject trees.

Parameters:
profileA - Message profile tree to compare against.
profileB - Message profile tree that constrains profileA
Throws:
HL7Exception -  
Method Detail

getDescriptionRules

public java.lang.Class[] getDescriptionRules()
                                      throws HL7Exception

Returns the active rules from the Description Ruleset as an array of Class objects.

Throws:
HL7Exception -  

getGenericRules

public java.lang.Class[] getGenericRules()
                                  throws HL7Exception

Returns the active rules from the Generic Ruleset as an array of Class objects.

Throws:
HL7Exception -  

getSpecificationRules

public java.lang.Class[] getSpecificationRules()
                                        throws HL7Exception

Returns the active rules from the Specification Ruleset as an array of Class objects.

Throws:
HL7Exception -  

getConformanceRules

public java.lang.Class[] getConformanceRules()
                                      throws HL7Exception

Returns the active rules from the Conformance Ruleset as an array of Class objects.

Throws:
HL7Exception -  

getSegmentRules

public java.lang.Class[] getSegmentRules()
                                  throws HL7Exception

Returns the active rules from the Segment Ruleset as an array of Class objects.

Throws:
HL7Exception -  

getSegmentGroupRules

public java.lang.Class[] getSegmentGroupRules()
                                       throws HL7Exception

Returns the active rules from the SegmentGroup Ruleset as an array of Class objects.

Throws:
HL7Exception -  

getFieldRules

public java.lang.Class[] getFieldRules()
                                throws HL7Exception

Returns the active rules from the Field Ruleset as an array of Class objects.

Throws:
HL7Exception -  

getComponentRules

public java.lang.Class[] getComponentRules()
                                    throws HL7Exception

Returns the active rules from the Component Ruleset as an array of Class objects.

Throws:
HL7Exception -  

getSubcomponentRules

public java.lang.Class[] getSubcomponentRules()
                                       throws HL7Exception

Returns the active rules from the SubComponent Ruleset as an array of Class objects.

Throws:
HL7Exception -  

getSTRules

public java.lang.Class[] getSTRules()
                             throws HL7Exception

Returns the active rules from the ST Ruleset as an array of Class objects.

Throws:
HL7Exception -  

getImpNoteRules

public java.lang.Class[] getImpNoteRules()
                                  throws HL7Exception

Returns the active rules from the ImpNote Ruleset as an array of Class objects.

Throws:
HL7Exception -  

getParagraphRules

public java.lang.Class[] getParagraphRules()
                                    throws HL7Exception

Returns the active rules from the Paragraph Ruleset as an array of Class objects.

Throws:
HL7Exception -  

getPredicateRules

public java.lang.Class[] getPredicateRules()
                                    throws HL7Exception

Returns the active rules from the Predicate Ruleset as an array of Class objects.

Throws:
HL7Exception -  

getReferenceRules

public java.lang.Class[] getReferenceRules()
                                    throws HL7Exception

Returns the active rules from the Reference Ruleset as an array of Class objects.

Throws:
HL7Exception -  

getDataValuesRules

public java.lang.Class[] getDataValuesRules()
                                     throws HL7Exception

Returns the active rules from the DataValues Ruleset as an array of Class objects.

Throws:
HL7Exception -  

getMessageRules

public java.lang.Class[] getMessageRules()
                                  throws HL7Exception

Returns the active rules from the Message Ruleset as an array of Class objects.

Throws:
HL7Exception -  

getPreConditionRules

public java.lang.Class[] getPreConditionRules()
                                       throws HL7Exception

Returns the active rules from the PreCondition Ruleset as an array of Class objects.

Throws:
HL7Exception -  

getPostConditionRules

public java.lang.Class[] getPostConditionRules()
                                        throws HL7Exception

Returns the active rules from the PostCondition Ruleset as an array of Class objects.

Throws:
HL7Exception -  

getUseCaseRules

public java.lang.Class[] getUseCaseRules()
                                  throws HL7Exception

Returns the active rules from the UseCase Ruleset as an array of Class objects.

Throws:
HL7Exception -  

getEventFlowRules

public java.lang.Class[] getEventFlowRules()
                                    throws HL7Exception

Returns the active rules from the EventFlow Ruleset as an array of Class objects.

Throws:
HL7Exception -  

getDerivativeRules

public java.lang.Class[] getDerivativeRules()
                                     throws HL7Exception

Returns the active rules from the Derivative Ruleset as an array of Class objects.

Throws:
HL7Exception -  

getEncodingsRules

public java.lang.Class[] getEncodingsRules()
                                    throws HL7Exception

Returns the active rules from the Encodings Ruleset as an array of Class objects.

Throws:
HL7Exception -  

getEncodingRules

public java.lang.Class[] getEncodingRules()
                                   throws HL7Exception

Returns the active rules from the Encoding Ruleset as an array of Class objects.

Throws:
HL7Exception -  

canBeOptional

public boolean canBeOptional(DocumentObject profile)
                      throws HL7Exception

Returns a boolean indicating whether the DocumentObject provided possesses the Optionality attribute.

This is a custom method, which could ultimately be generated automatically (e.g., whenever a node has the Optionality attribute, the logic to include that node could be appended.).

Parameters:
profile - The DocumentObject that is tested to see if it's an "optional" element.
Throws:
HL7Exception -  

canCheckElement

public boolean canCheckElement(DocumentObject profile)
                        throws HL7Exception

Returns a boolean indicating whether we can do the conformance check on the provided element.

This is just to limit the demo application to "important" nodes.

Parameters:
profile - The DocumentObject that is tested to see if it should be checked for conformance.
Throws:
HL7Exception -  

compareProfiles

public boolean compareProfiles(DocumentObject profileA,
                               DocumentObject profileB)
                        throws HL7Exception

Applies the rules to the two DocumentObject objects, returning the boolean result of the rules.

A value of "true" indicates that Profile A and Profile B conform, according to the rules that were applied.

Parameters:
profileA - Node from message profile A
profileB - Node from message profile B
Throws:
HL7Exception -  

traverse

public void traverse()
              throws HL7Exception

Calls the traverseTrees method, and simply indicates whether Profile A and Profile B conform according to the rules that were applied.

Throws:
HL7Exception -  

traverseTrees

public boolean traverseTrees(DocumentObject profileA,
                             DocumentObject profileB)
                      throws HL7Exception

Traverses the two DocumentObject trees recursively, while applying conformance rules.

Returns a boolean "true" if the profiles successfully validate against the rules. Returns a boolean "false" if the profiles do not, or an error occurs during traversal.

Parameters:
profileA - Node from message profile A
profileB - Node from message profile B
Throws:
HL7Exception -