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 TypeMethodDescriptionboolean
fixup
(SchemaCompiler compiler) Check references from this component to other componentsThe type of constraint: one of "key", "unique", or "keyref"int
Get the symbol space of the target of this referenceGet the schema component identified by this reference.Get the name of the target of this referenceboolean
Ask whether this is known to be a dangling referenceboolean
Determine whether this reference has been resolvedvoid
Sets the name of the key being referenced.void
Set the target key or unique constraintvoid
tryToResolve
(SchemaCompiler compiler, boolean fatal) Try to resolve the reference if possible, relative to components present in a given schema.boolean
validate
(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, typeCheck
Methods 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, setValidationStatus
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.saxonica.ee.schema.ComponentReference
getConfiguration
Methods inherited from interface net.sf.saxon.s9api.Location
getColumnNumber, getLineNumber, getPublicId, getSystemId, saveLocation
Methods inherited from interface net.sf.saxon.type.SchemaComponent
getRedefinitionLevel, getValidationStatus
Methods 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:IdentityConstraint
The type of constraint: one of "key", "unique", or "keyref"- Specified by:
getConstraintCategory
in classIdentityConstraint
- Returns:
- one of "key", "unique", or "keyref" (note the spelling)
-
getTargetComponentName
Get the name of the target of this reference- Specified by:
getTargetComponentName
in 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:
tryToResolve
in 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:
isResolved
in 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:
isDangling
in 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:
getTarget
in 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:
getSymbolSpace
in interfaceComponentReference
- Returns:
- an integer code identifying the symbol space
-
fixup
Check references from this component to other components- Specified by:
fixup
in interfaceUserSchemaComponent
- Overrides:
fixup
in 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:
validate
in interfaceUserSchemaComponent
- Overrides:
validate
in classIdentityConstraint
- Parameters:
compiler
- the schema compiler- Returns:
- true when this Schema definition is valid, otherwise false.
- Throws:
SchemaException
- when this Schema definition is invalid.
-