public class SchematronSchema extends Object implements MessageSource
Modifier and Type | Class and Description |
---|---|
static class |
SchematronSchema.ExtensionFunctionTemplate |
static class |
SchematronSchema.RuleCreationStatus |
Constructor and Description |
---|
SchematronSchema(Model mdl,
Options o,
ShapeChangeResult r,
PackageInfo p)
Ctor
|
Modifier and Type | Method and Description |
---|---|
protected void |
addAssertion(ClassInfo ci,
OclConstraint c)
Add another OCL constraint and translate it into a Schematron <assert>,
which is subsequently appended to the Schematron document within the proper
<rule> context.
|
protected void |
addAssertion(ClassInfo ci,
SchematronConstraintNode.XpathFragment xpath,
String text)
Add an assertion statement embodied in an XpathFragment object and output
it as a Schematron <assert> element, which is contained in a proper
<rule> context.
|
String |
getAndRegisterXmlName(ClassInfo ci)
Auxiliary method to find out the full, namespace adorned name of a
class from the the mapping or the model.
|
String |
getAndRegisterXmlName(PropertyInfo pi)
Auxiliary method to find out the full, namespace adorned name of a
property from the model.
|
String |
message(int mnr)
This method returns messages belonging to the SchematronSchema object
which accompanies the XmlSchema target.
|
protected String |
messageText(int mnr)
This is the message text provision proper.
|
void |
registerNamespace(String xmlns)
This auxiliary method registers a namespace prefix with the
Schematron schema.
|
void |
registerNamespace(String xmlns,
ClassInfo ci)
This special variant of the method above considers the class object to
determine the full namespace uri.
|
void |
registerNamespace(String xmlns,
String ns)
This auxiliary method registers a namespace (prefix and namespace proper)
with the Schematron schema.
|
protected SchematronConstraintNode |
translateConstraintAttributeToSchematronNode(OclNode.AttributeCallExp attr,
SchematronConstraintNode enclosing,
boolean negate)
This method converts AttibuteCallExp objects into intermediary
SchematronConstraintsNodes in a first step to realize these in Xpath
code.
|
protected SchematronConstraintNode |
translateConstraintIfExpToSchematronNode(OclNode.IfExp ifex,
SchematronConstraintNode enclosing,
boolean negate)
This method will transform an OclNode.IfExp to an intermediary node
structure suited for Schematron code generation.
|
protected SchematronConstraintNode |
translateConstraintIterationToSchematronNode(OclNode.IterationCallExp iter,
SchematronConstraintNode enclosing,
boolean negate)
This function treats the implemented IterationCallExp objects in an
OCL expression.
|
protected SchematronConstraintNode |
translateConstraintLetExpToSchematronNode(OclNode.LetExp letex,
SchematronConstraintNode enclosing,
boolean negate)
This method will transform an OclNode.LetExp to an intermediary node
structure suited for Schematron code generation.
|
protected SchematronConstraintNode |
translateConstraintLiteralToSchematronNode(OclNode.LiteralExp lit,
SchematronConstraintNode enclosing,
boolean negate)
This method is supposed to transform the OclNode Literals to an
intermediary node structure which is suited for PL/SQL generation.
|
protected SchematronConstraintNode |
translateConstraintOperationToSchematronNode(OclNode.OperationCallExp oper,
SchematronConstraintNode enclosing,
boolean negate)
This function treats the implemented OperationCallExp objects in an
OCL expression.
|
protected SchematronConstraintNode |
translateConstraintToSchematronNode(OclNode ocl,
SchematronConstraintNode enclosing,
boolean negate)
This function recursively descends into an OclConstraint following
the OclNode structure.
|
void |
write(String outputDirectory)
This function serializes the generated Schematron schema to the given
directory.
|
public SchematronSchema(Model mdl, Options o, ShapeChangeResult r, PackageInfo p)
mdl
- Model objecto
- Options objectr
- Result objectp
- PackageInfo objectprotected void addAssertion(ClassInfo ci, OclConstraint c)
ci
- ClassInfo object, which is context to the constraint.c
- OCL constraint. Must be invariant.protected void addAssertion(ClassInfo ci, SchematronConstraintNode.XpathFragment xpath, String text)
ci
- ClassInfo object, which is context to the constraint.xpath
- Assertion embodied in an XpathFragment object.text
- Explanatory text concerning the assertionpublic String getAndRegisterXmlName(PropertyInfo pi)
pi
- PropertyInfo objectpublic String getAndRegisterXmlName(ClassInfo ci)
Auxiliary method to find out the full, namespace adorned name of a class from the the mapping or the model. As a side effect the method makes the namespace also known to the Schematron schema, appending another <ns> element if necessary.
The method considers the mapping in first priority. If the class turns out to map to a basic type, null is returned instead of a name.
pi
- ClassInfo objectpublic void registerNamespace(String xmlns, String ns)
xmlns
- Namespace prefixns
- Namespace properpublic void registerNamespace(String xmlns)
xmlns
- Namespace prefixpublic void registerNamespace(String xmlns, ClassInfo ci)
xmlns
- Namespace prefixci
- ClassInfo object to fetch the namespace uri fromprotected SchematronConstraintNode translateConstraintToSchematronNode(OclNode ocl, SchematronConstraintNode enclosing, boolean negate)
This function recursively descends into an OclConstraint following the OclNode structure. In doing so it generates an equivalent syntax tree which is more in line with Xpath syntax and its use in the Schematron schema.
ocl
- OclNode of some level, initially called with
OclNode.Expressionenclosing
- Enclosing target construct, may be nullnegate
- Flag to indicate that a logical negation is to be pushed
downwardsprotected SchematronConstraintNode translateConstraintIterationToSchematronNode(OclNode.IterationCallExp iter, SchematronConstraintNode enclosing, boolean negate)
This function treats the implemented IterationCallExp objects in an OCL expression. Doing so it generates intermediate code which is better suited for Schematron generation than the original OCL constructs.
iter
- The IterationCallExp node to be processedenclosing
- Enclosing target constructnegate
- Flag to indicate that a logical negation is to be pushed
downwardsprotected SchematronConstraintNode translateConstraintOperationToSchematronNode(OclNode.OperationCallExp oper, SchematronConstraintNode enclosing, boolean negate)
This function treats the implemented OperationCallExp objects in an OCL expression. Doing so it generates intermediate code which is better suited for Schematron generation than the original OCL constructs.
Particularly, all logical operations are collected in Logic objects of the three flavors AND, OR and XOR, where AND and OR have as many as possible children. NOT is pushed downwards by using De Morgan's rule.
oper
- The OperationCallExp node to be processedenclosing
- Enclosing target constructnegate
- Flag to indicate that a logical negation is to be pushed
downwardsprotected SchematronConstraintNode translateConstraintAttributeToSchematronNode(OclNode.AttributeCallExp attr, SchematronConstraintNode enclosing, boolean negate)
This method converts AttibuteCallExp objects into intermediary SchematronConstraintsNodes in a first step to realize these in Xpath code.
attr
- The AttibuteCallExp objectenclosing
- If an enclosing Logic object is passed, the attribute
must be of type Boolean. Otherwise an error is generated.negate
- A pushed down negation will only be considered if the
attribute is of type Boolean.protected SchematronConstraintNode translateConstraintLiteralToSchematronNode(OclNode.LiteralExp lit, SchematronConstraintNode enclosing, boolean negate)
This method is supposed to transform the OclNode Literals to an intermediary node structure which is suited for PL/SQL generation.
lit
- The OclNode.Literal objectenclosing
- If an enclosing Logic object is passed, the literal
must be of type Boolean.negate
- A pushed down negation will only be considered if the
literal is of type Boolean.protected SchematronConstraintNode translateConstraintIfExpToSchematronNode(OclNode.IfExp ifex, SchematronConstraintNode enclosing, boolean negate)
This method will transform an OclNode.IfExp to an intermediary node structure suited for Schematron code generation.
ifex
- The OclNode.IfExp objectenclosing
- If an enclosing Logic object is passed, the type of
the IfExp must be Boolean.negate
- A pushed down negation will switch the then and else
parts.protected SchematronConstraintNode translateConstraintLetExpToSchematronNode(OclNode.LetExp letex, SchematronConstraintNode enclosing, boolean negate)
This method will transform an OclNode.LetExp to an intermediary node structure suited for Schematron code generation.
letex
- The OclNode.LetExp objectenclosing
- If an enclosing Logic object is passed, the type of
the LetExp must be Boolean.negate
- A pushed down negation will be passed to the body.public void write(String outputDirectory)
outputDirectory
- public String message(int mnr)
This method returns messages belonging to the SchematronSchema object which accompanies the XmlSchema target. The messages are retrieved by their message number. The organization corresponds to the logic in module ShapeChangeResult.
message
in interface MessageSource
mnr
- Message numberprotected String messageText(int mnr)
mnr
- Message numberCopyright © 2017. All rights reserved.