Package com.saxonica.ee.schema
Class KeyRef
java.lang.Object
com.saxonica.ee.schema.SchemaStructure
com.saxonica.ee.schema.IdentityConstraint
com.saxonica.ee.schema.KeyRef
- All Implemented Interfaces:
ComponentReference,SerializableSchemaComponent,UserSchemaComponent,SourceLocator,Location,SchemaComponent,Locator
This class represents an xs:keyRef identity constraint in a schema
-
Constructor Summary
ConstructorsConstructorDescriptionKeyRef()Create a KeyRef object representing an xs:keyref constraintsKeyRef(EnterpriseConfiguration config, StructuredQName refer) Create a new KeyRef Identity-Constraint. -
Method Summary
Modifier and TypeMethodDescriptionbooleanfixup(SchemaCompiler compiler) Check references from this component to other componentsThe type of constraint: one of "key", "unique", or "keyref"intGet the symbol space of the target of this referenceGet the schema component identified by this reference.Get the name of the target of this referencebooleanAsk whether this is known to be a dangling referencebooleanDetermine whether this reference has been resolvedvoidSets the name of the key being referenced.voidSet the target key or unique constraintvoidtryToResolve(SchemaCompiler compiler, boolean fatal) Try to resolve the reference if possible, relative to components present in a given schema.booleanvalidate(SchemaCompiler compiler) Checks the validity of this Schema defintion.Methods inherited from class com.saxonica.ee.schema.IdentityConstraint
addField, elaborate, getComponentAsFunction, getConstraintName, getFields, getName, getSelector, getTargetNamespace, isOrdered, isSameDeclaration, serialize, setConstraintName, setOrdered, setSelector, typeCheckMethods inherited from class com.saxonica.ee.schema.SchemaStructure
getColumnNumber, getConfiguration, getFixupStatus, getGeneratedId, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, hasSameLocation, isValidationNeeded, lookForCycles, makeXPathExpressionPropertyRecord, saveLocation, setConfiguration, setFixupStatus, setGeneratedId, setLineNumber, setLocator, setRedefinitionLevel, setSchemaDocumentURI, setSystemId, setValidationStatusMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.saxonica.ee.schema.ComponentReference
getConfigurationMethods inherited from interface net.sf.saxon.s9api.Location
getColumnNumber, getLineNumber, getPublicId, getSystemId, saveLocationMethods inherited from interface net.sf.saxon.type.SchemaComponent
getRedefinitionLevel, getValidationStatusMethods inherited from interface com.saxonica.ee.schema.UserSchemaComponent
lookForCycles
-
Constructor Details
-
KeyRef
public KeyRef()Create a KeyRef object representing an xs:keyref constraints -
KeyRef
Create a new KeyRef Identity-Constraint.- Parameters:
config- the configurationrefer- the name of the referenced key.
-
-
Method Details
-
getConstraintCategory
Description copied from class:IdentityConstraintThe type of constraint: one of "key", "unique", or "keyref"- Specified by:
getConstraintCategoryin classIdentityConstraint- Returns:
- one of "key", "unique", or "keyref" (note the spelling)
-
getTargetComponentName
Get the name of the target of this reference- Specified by:
getTargetComponentNamein interfaceComponentReference- Returns:
- the component name
-
setTargetComponentName
Sets the name of the key being referenced.- Parameters:
target- the fingerprint of the name of the key to reference.
-
setTargetKey
Set the target key or unique constraint- Parameters:
key- the target key definition or unique constraint
-
tryToResolve
Try to resolve the reference if possible, relative to components present in a given schema. No error occurs if the reference cannot yet be resolved.- Specified by:
tryToResolvein interfaceComponentReference- Parameters:
compiler- The schema containing the candidate target components for the reference. If null, the schema containing the reference is used.fatal- true if a failure to resolve is to be treated as fatal
-
isResolved
public boolean isResolved()Determine whether this reference has been resolved- Specified by:
isResolvedin interfaceComponentReference- Returns:
- true if the reference has been resolved to a schema component
-
isDangling
public boolean isDangling()Ask whether this is known to be a dangling reference- Specified by:
isDanglingin interfaceComponentReference- Returns:
- true if the target of this component reference is known to be absent, and if a warning has been issued to this effect
-
getTarget
Get the schema component identified by this reference.- Specified by:
getTargetin interfaceComponentReference- Returns:
- the schema component if the reference has been resolved.
- Throws:
MissingComponentException- if the reference has not been resolved. Note that this is an unchecked exception.
-
getSymbolSpace
public int getSymbolSpace()Get the symbol space of the target of this reference- Specified by:
getSymbolSpacein interfaceComponentReference- Returns:
- an integer code identifying the symbol space
-
fixup
Check references from this component to other components- Specified by:
fixupin interfaceUserSchemaComponent- Overrides:
fixupin classIdentityConstraint- Parameters:
compiler- used for reporting error messages- Returns:
- true if all is well, false if errors found
- Throws:
SchemaException
-
validate
Checks the validity of this Schema defintion.- Specified by:
validatein interfaceUserSchemaComponent- Overrides:
validatein classIdentityConstraint- Parameters:
compiler- the schema compiler- Returns:
- true when this Schema definition is valid, otherwise false.
- Throws:
SchemaException- when this Schema definition is invalid.
-