public class FOL2Schematron extends Object implements Target, MessageSource
Modifier and Type | Class and Description |
---|---|
static class |
FOL2Schematron.ExtensionFunctionTemplate |
static class |
FOL2Schematron.RuleCreationStatus |
Modifier and Type | Field and Description |
---|---|
protected String |
alpha |
protected String |
beta |
protected ClassInfo |
currentConstraintClass |
protected String |
currentConstraintName |
protected boolean |
diagnosticsOnly |
protected Model |
model |
protected Options |
options |
protected ShapeChangeResult |
result |
protected PackageInfo |
schema |
protected Map<String,FolSchematronNode.VariableNode> |
varNodesByVarName |
protected String |
xmlns
The XML namespace prefix to use for elements of the schema that is being
processed.
|
Constructor and Description |
---|
FOL2Schematron() |
Modifier and Type | Method and Description |
---|---|
protected void |
addAssertion(ClassInfo ci,
FolConstraint c)
Add another 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,
FolSchematronNode.XpathFragment xpath,
String text,
String id)
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 |
getAndRegisterXmlns(ClassInfo ci) |
int |
getNextVarIndex() |
String |
getTargetName() |
void |
initialise(PackageInfo schemaPi,
Model m,
Options o,
ShapeChangeResult r,
boolean diagOnly)
Allows a target to perform the necessary initialization routines before
processing.
|
String |
message(int mnr)
Return a message for a message number.
|
void |
process(ClassInfo ci)
The converter will call this method for each class belonging to the
package given during initialization (see
Target.initialise(de.interactive_instruments.ShapeChange.Model.PackageInfo, de.interactive_instruments.ShapeChange.Model.Model, de.interactive_instruments.ShapeChange.Options, de.interactive_instruments.ShapeChange.ShapeChangeResult, boolean) ). |
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.
|
void |
reset() |
String |
schemaQname(String elementName) |
protected FolSchematronNode |
translateConstraint(FolExpression folExpr,
FolSchematronNode enclosing)
This function recursively descends into an FolConstraint following the
FOL expression structure.
|
void |
write() |
protected ShapeChangeResult result
protected PackageInfo schema
protected Options options
protected Model model
protected boolean diagnosticsOnly
protected String currentConstraintName
protected ClassInfo currentConstraintClass
protected String alpha
protected String beta
protected Map<String,FolSchematronNode.VariableNode> varNodesByVarName
protected String xmlns
public void initialise(PackageInfo schemaPi, Model m, Options o, ShapeChangeResult r, boolean diagOnly) throws ShapeChangeAbortException
Target
Will be called by the Converter
for each selected schema (see
Model.selectedSchemas()
and PackageInfo.isSchema()
).
initialise
in interface Target
schemaPi
- a schema from the model selected via the configuration (see
Model.selectedSchemas()
) - not necessarily always an
application schemaShapeChangeAbortException
Model.selectedSchemas()
,
PackageInfo.isSchema()
public void process(ClassInfo ci)
Target
Target.initialise(de.interactive_instruments.ShapeChange.Model.PackageInfo, de.interactive_instruments.ShapeChange.Model.Model, de.interactive_instruments.ShapeChange.Options, de.interactive_instruments.ShapeChange.ShapeChangeResult, boolean)
).
NOTE: will be called not only for the classes directly contained in the package, but also all sub-packages belonging to the same targetNamespace!
protected void addAssertion(ClassInfo ci, FolConstraint c)
ci
- ClassInfo object, which is context to the constraint.c
- FOL constraint.protected void addAssertion(ClassInfo ci, FolSchematronNode.XpathFragment xpath, String text, String id)
ci
- ClassInfo object, which is context to the constraint.xpath
- Assertion embodied in an XpathFragment object.text
- Explanatory text concerning the assertionid
- public 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 FolSchematronNode translateConstraint(FolExpression folExpr, FolSchematronNode enclosing)
This function recursively descends into an FolConstraint following the FOL expression 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.
folExpr
- FolExpression of some levelenclosing
- Enclosing target construct, may be nullpublic String getTargetName()
getTargetName
in interface Target
public String message(int mnr)
MessageSource
message
in interface MessageSource
MessageSource.message(int)
public int getNextVarIndex()
public void reset()
Copyright © 2017. All rights reserved.