cs.arizona.tau.xml.temporalconstraint
Class TemporalConstraintValidator

java.lang.Object
  extended by cs.arizona.tau.xml.temporalconstraint.TemporalConstraintValidator

public class TemporalConstraintValidator
extends java.lang.Object

Validating the temporal constraints of a temporal document

Author:
ruizhang

Field Summary
static java.lang.String NONSEQCARDINALITY
           
static java.lang.String NONSEQKEY
           
static java.lang.String NONSEQKEYREF
           
static java.lang.String NONSEQUNIQUE
           
static java.lang.String SEQCARDINALITY
           
static java.lang.String TRANSITION
           
static java.lang.String UNIQUENULLRESTRICTED
           
 
Constructor Summary
TemporalConstraintValidator(org.w3c.dom.Document temporal_doc, java.lang.String temporal_schema_name)
          Constructing the validator instance.
 
Method Summary
static java.util.Vector<java.lang.String> ConvertConventionalIdentifier(java.lang.String conv_id_name, org.w3c.dom.Document schema_doc)
          Use the conventional indetifier/constraint to look for the defined identifer/constraint in the snapshot schema
 void ExtractConstraint(org.w3c.dom.Document annotation_doc)
          Parsing the annotation document and extracting the defined constraints for validation.
 void ExtractConstraints(org.w3c.dom.Element root, java.lang.String target, java.util.Vector<Constraint> results)
          Parsing annotation document and extracting the defined constraints.
 org.w3c.dom.Document GetAnnotationDocument()
           
static java.util.Vector<org.w3c.dom.Node> GetCandidateNodes(org.w3c.dom.Document temporal_doc, java.lang.String xpath_query, Applicability applicability)
          Using XPath query to retrieve the candidate nodes to be examined for the temporal constraints from the temporal document.
 org.w3c.dom.Document GetSchemaDocument()
           
 org.w3c.dom.Document GetTemporalDocument()
           
 boolean PerformValidation()
          Perform the validation
static java.lang.String PrepareXPathString(java.lang.String selector, java.lang.String field)
          Converting the orignal selector and field into an internally used format.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONSEQKEY

public static java.lang.String NONSEQKEY

NONSEQUNIQUE

public static java.lang.String NONSEQUNIQUE

UNIQUENULLRESTRICTED

public static java.lang.String UNIQUENULLRESTRICTED

SEQCARDINALITY

public static java.lang.String SEQCARDINALITY

NONSEQCARDINALITY

public static java.lang.String NONSEQCARDINALITY

TRANSITION

public static java.lang.String TRANSITION

NONSEQKEYREF

public static java.lang.String NONSEQKEYREF
Constructor Detail

TemporalConstraintValidator

public TemporalConstraintValidator(org.w3c.dom.Document temporal_doc,
                                   java.lang.String temporal_schema_name)
Constructing the validator instance.

Parameters:
temporal_doc - the temporal document to be validated
temporal_schema_name - the name of the temporal schema
Method Detail

GetTemporalDocument

public org.w3c.dom.Document GetTemporalDocument()

GetAnnotationDocument

public org.w3c.dom.Document GetAnnotationDocument()

GetSchemaDocument

public org.w3c.dom.Document GetSchemaDocument()

ExtractConstraint

public void ExtractConstraint(org.w3c.dom.Document annotation_doc)
Parsing the annotation document and extracting the defined constraints for validation.

Parameters:
annotation_doc - the annotation document where the constraints are defined

ConvertConventionalIdentifier

public static java.util.Vector<java.lang.String> ConvertConventionalIdentifier(java.lang.String conv_id_name,
                                                                               org.w3c.dom.Document schema_doc)
Use the conventional indetifier/constraint to look for the defined identifer/constraint in the snapshot schema

Parameters:
conv_id_name - the conventional identifier
schema_doc - the snapshot schema
Returns:
a string vector with the elements being selector, field and refer, in case of parsing "keyref"

ExtractConstraints

public void ExtractConstraints(org.w3c.dom.Element root,
                               java.lang.String target,
                               java.util.Vector<Constraint> results)
Parsing annotation document and extracting the defined constraints.

Parameters:
root - the root element of the annotation document
target - the type name of the constraint
results - the result vector holding all the found constraint

PrepareXPathString

public static java.lang.String PrepareXPathString(java.lang.String selector,
                                                  java.lang.String field)
Converting the orignal selector and field into an internally used format.


GetCandidateNodes

public static java.util.Vector<org.w3c.dom.Node> GetCandidateNodes(org.w3c.dom.Document temporal_doc,
                                                                   java.lang.String xpath_query,
                                                                   Applicability applicability)
Using XPath query to retrieve the candidate nodes to be examined for the temporal constraints from the temporal document. The applicability may apply if defined

Parameters:
temporal_doc - the temporal document where the candidate nodes are requested from
xpath_query - the XPath query used to identify the candidate nodes
applicability - the time period where the candidate nodes should be retrieved from
Returns:
the vector of candidate nodes

PerformValidation

public boolean PerformValidation()
Perform the validation

Returns:
TRUE if validated; FALSE otherwise