de.interactive_instruments.ShapeChange.Target.XmlSchema
Class SchematronConstraintNode

java.lang.Object
  extended by de.interactive_instruments.ShapeChange.Target.XmlSchema.SchematronConstraintNode
Direct Known Subclasses:
SchematronConstraintNode.AllInstances, SchematronConstraintNode.Arithmetic, SchematronConstraintNode.Attribute, SchematronConstraintNode.Cast, SchematronConstraintNode.ChangeCase, SchematronConstraintNode.Comparison, SchematronConstraintNode.Concatenate, SchematronConstraintNode.Empty, SchematronConstraintNode.Error, SchematronConstraintNode.Exists, SchematronConstraintNode.IfThenElse, SchematronConstraintNode.KindOf, SchematronConstraintNode.Let, SchematronConstraintNode.Literal, SchematronConstraintNode.Logic, SchematronConstraintNode.Matches, SchematronConstraintNode.MessageComment, SchematronConstraintNode.Select, SchematronConstraintNode.Size, SchematronConstraintNode.Substring, SchematronConstraintNode.Unique, SchematronConstraintNode.Variable

public abstract class SchematronConstraintNode
extends Object

SchematronConstraintNode and its concrete derivations stand for a representation of OCL contents, which are close to the capabilities of Schematron and the logic, which can be realized within Schematron Rules.

There are two basic patterns of use of these classes:


Nested Class Summary
static class SchematronConstraintNode.AllInstances
          This class represents the OCL operation allInstances().
static class SchematronConstraintNode.Arithmetic
          This class stands for OCL arithmetic.
static class SchematronConstraintNode.Attribute
          This class represents a chain of attribute selectors based on some value source such as a variable, a select() or allInstances.
static class SchematronConstraintNode.BindingContext
          The primary information stored in this class is whether there is currently a nodeset context at all - NONE if the expression is not a nodeset - and if the context is currently identical to current() - ATCURRENT.
static class SchematronConstraintNode.Cast
          This class represents oclAsType(), which is for casting a type to one of its subtypes.
static class SchematronConstraintNode.ChangeCase
          This class stands for an the changeCase operations on the CharacterString object.
static class SchematronConstraintNode.Comparison
          This class stands for comparisons.
static class SchematronConstraintNode.Concatenate
          This class stands for an OCL concat operation.
static class SchematronConstraintNode.Empty
          This one stands for the OCL isEmpty() and notEmpty() predicate operations.
static class SchematronConstraintNode.Error
          This is generated for unimplemented material.
static class SchematronConstraintNode.Exists
          This class represents the Exists iterator predicate.
static class SchematronConstraintNode.IfThenElse
          This class represents an if ... then ... else ... endif construct.
static class SchematronConstraintNode.KindOf
          This class represents oclIsKindOf and oclIsTypeOf nodes.
static class SchematronConstraintNode.Let
          This class represents the 'let' construct.
static class SchematronConstraintNode.Literal
          This wraps any form of Literal value from the OclNode.
static class SchematronConstraintNode.Logic
          This class stands for logical operations AND, OR, XOR and EQV.
static class SchematronConstraintNode.Matches
          This class stands for matches operation, which this implemention added to OCL's core functions.
static class SchematronConstraintNode.MessageComment
          This represents an error message comment.
static class SchematronConstraintNode.Select
          This class represents the Select iterator filter.
static class SchematronConstraintNode.Size
          This class represents an OCL invocation of the size operation.
static class SchematronConstraintNode.Substring
          This class stands for an OCL substring operation.
static class SchematronConstraintNode.Unique
          This class represents the isUnique iterator predicate.
static class SchematronConstraintNode.Variable
          This class represents an OCL variable.
protected static class SchematronConstraintNode.XpathFragment
          This auxiliary class encapsulates an Xpath expression, which can be formulated using variables defined using <let> expressions of a Schematron <rule>.
protected static class SchematronConstraintNode.XpathType
          Types of XPath
 
Field Summary
protected  ArrayList<SchematronConstraintNode> children
          The children of the SchematronConstraintNode
protected  boolean negated
          General negation flag for all nodes
protected  SchematronConstraintNode parent
          The parent reference
protected  SchematronSchema schemaObject
          Link back to SchematronSchema object
 
Constructor Summary
SchematronConstraintNode()
           
 
Method Summary
 void addChild(SchematronConstraintNode child)
          Method to add children to a node and at the same time establish the node as parent of the child to be added.
 boolean containsError()
          Find out whether this construct contains a node of type SchematronConstraintNode.Error.
 SchematronConstraintNode.Attribute generatingAttribute()
          By means of this function you can inquire which Attribute node is generating the objects represented by this node.
 boolean hasIdentity()
          This predicate finds out whether the given node is realized by means of a class, which conceptually has identity.
 boolean hasSimpleType()
          This predicate finds out whether the given node is realized by means of a simple XML schema type.
 boolean isAndOrLogic(boolean isAnd)
          Method to inquire whether the the node inquired is a Logic node AND this logic node has the same isAnd polarity as specified in the parameter.
 boolean isDependentOn(OclNode.Declaration vardecl)
          This method determines whether the given expression depends on the Variable passed as argument.
 boolean isMultiple()
          This predicate finds out whether the given node may produce a set.
 boolean isVarOrAttribBased(OclNode.Declaration vardecl)
          This method determines whether the given expression is a Variable or an Attribute based on a Variable, which is identical to the one passed as argument.
 SchematronConstraintNode nodeVariableIsBoundTo(OclNode.Declaration vardecl)
          This method determines whether the node binds the given variable declaration (this can only happen for iterators) and if it does, which is the expression the variable is bound to.
abstract  SchematronConstraintNode.XpathFragment translate(SchematronConstraintNode.BindingContext ctx)
          This abstract method compiles a node to an XPath expression fragment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

children

protected ArrayList<SchematronConstraintNode> children
The children of the SchematronConstraintNode


negated

protected boolean negated
General negation flag for all nodes


parent

protected SchematronConstraintNode parent
The parent reference


schemaObject

protected SchematronSchema schemaObject
Link back to SchematronSchema object

Constructor Detail

SchematronConstraintNode

public SchematronConstraintNode()
Method Detail

addChild

public void addChild(SchematronConstraintNode child)
Method to add children to a node and at the same time establish the node as parent of the child to be added.

Parameters:
child - The Child node to be added

isAndOrLogic

public boolean isAndOrLogic(boolean isAnd)

Method to inquire whether the the node inquired is a Logic node AND this logic node has the same isAnd polarity as specified in the parameter.

This implementation installs the default for all derivations except Logic.

Parameters:
isAnd - Flag: Are we an AND? (not an OR)?
Returns:
True if this is Logic with the same polarity

isDependentOn

public boolean isDependentOn(OclNode.Declaration vardecl)

This method determines whether the given expression depends on the Variable passed as argument.

This implementation defines the default behavior: Descend down and try to find the variable somewhere.

Parameters:
vardecl - The Declaration of the variable
Returns:
Flag indicating the inquired dependency

nodeVariableIsBoundTo

public SchematronConstraintNode nodeVariableIsBoundTo(OclNode.Declaration vardecl)
This method determines whether the node binds the given variable declaration (this can only happen for iterators) and if it does, which is the expression the variable is bound to.

Parameters:
vardecl - The variable Declaration object
Returns:
Node the variable is bound to or null

isVarOrAttribBased

public boolean isVarOrAttribBased(OclNode.Declaration vardecl)

This method determines whether the given expression is a Variable or an Attribute based on a Variable, which is identical to the one passed as argument.

This implementation defines the default behavior.

Parameters:
vardecl - The Declaration of the variable
Returns:
Flag indicating the inquired property

generatingAttribute

public SchematronConstraintNode.Attribute generatingAttribute()

By means of this function you can inquire which Attribute node is generating the objects represented by this node. Note that invocation is only sensible for iterators and attributes.

Returns:
The retrieved Attribute node if there is such a thing

isMultiple

public boolean isMultiple()

This predicate finds out whether the given node may produce a set.

This is the default implementation providing the value false.

Returns:
Flag indicating whether the node can return multiple values

hasSimpleType

public boolean hasSimpleType()

This predicate finds out whether the given node is realized by means of a simple XML schema type.

Returns:
Flag indicating whether the node has a simple type

hasIdentity

public boolean hasIdentity()

This predicate finds out whether the given node is realized by means of a class, which conceptually has identity.

Returns:
Flag indicating whether the node is an identity carrying type

containsError

public boolean containsError()

Find out whether this construct contains a node of type SchematronConstraintNode.Error. In this case the whole tree is in error.

Returns:
Error flag

translate

public abstract SchematronConstraintNode.XpathFragment translate(SchematronConstraintNode.BindingContext ctx)

This abstract method compiles a node to an XPath expression fragment.

Parameters:
ctx - BindingContext this node shall be compiled in
Returns:
Object containing the Xpath fragment


Copyright © 2015. All rights reserved.