Package com.saxonica.ee.update
Class CopyModifyExpression
java.lang.Object
net.sf.saxon.expr.Expression
com.saxonica.ee.update.CopyModifyExpression
- All Implemented Interfaces:
- ExportAgent,- Locatable,- IdentityComparable,- Traceable
A copy-modify expression (called a "transform" expression in the XQuery Update specification)
 
Note that this expression doesn't actually perform the copy. It gets wrapped in a let expression that does let $var := $input.copy-of().
- 
Field SummaryFields inherited from class net.sf.saxon.expr.ExpressionEFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, MAX_COST, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, UPDATE_METHOD, WATCH_METHOD
- 
Constructor SummaryConstructorsConstructorDescriptionCopyModifyExpression(Expression updateExp, Expression returnExp, int validationMode) Create a copy-modify expression (also known as a transform expresion)
- 
Method SummaryModifier and TypeMethodDescriptionvoidCheck to ensure that this expression does not contain any inappropriate updating subexpressions.protected intDetermine the static cardinality of the expression.copy(RebindingMap rebindings) Copy an expression.evaluateItem(XPathContext context) Evaluate an expression as a single item.voidDiagnostic print of expression structure.Make an elaborator for this expressionGet a name identifying the kind of expression, in terms meaningful to a user.intAn implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().Determine the data type of the expression, if possible.booleanDetermine whether this is an updating expression as defined in the XQuery update specificationiterate(XPathContext context) Return an Iterator to iterate over the values of a sequence.operands()Get the immediate sub-expressions of this expression, with information about the relationship of each expression to its parent expression.voidprocess(Outputter output, XPathContext context) Process the instruction, without returning any tail callsvoidsetCopyBindings(Expression copyBindings) Set the copy bindings.voidsetReturnExp(Expression returnExp) voidsetUpdateExp(Expression updateExp) Methods inherited from class net.sf.saxon.expr.ExpressionaddToPathMap, adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkPermittedContents, computeDependencies, computeHashCode, computeSpecialProperties, computeStaticProperties, dispatchTailCall, dynamicError, effectiveBooleanValue, equals, evaluateAsString, explain, getCardinality, getConfiguration, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getIntegerBounds, getIntrinsicDependencies, getLocalRetainedStaticContext, getLocation, getNetCost, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getStaticUType, getStreamerName, getTracingTag, hasCompatibleStaticContext, hashCode, hasSpecialProperty, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isEqual, isIdentical, isInstruction, isLiftable, isMultiThreaded, isStaticPropertiesKnown, isSubtreeExpression, isVacuousExpression, makeElaborator, markTailFunctionCalls, operandList, operandSparseList, optimize, optimizeChildren, prepareForStreaming, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, supportsLazyEvaluation, suppressValidation, toPattern, toShortString, toString, typeCheck, typeCheckChildren, typeError, unordered, verifyParentPointers, withLocationMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.sf.saxon.trace.TraceablegatherProperties
- 
Constructor Details- 
CopyModifyExpressionCreate a copy-modify expression (also known as a transform expresion)- Parameters:
- updateExp- the expression appearing in the modify clause
- returnExp- the expression appearing in the return clause
- validationMode- the mode for validating the updated nodes (strict, lax, or skip)
 
 
- 
- 
Method Details- 
operandsDescription copied from class:ExpressionGet the immediate sub-expressions of this expression, with information about the relationship of each expression to its parent expression.If the expression is a Callable, then it is required that the order of the operands returned by this function is the same as the order of arguments supplied to the corresponding call() method. - Overrides:
- operandsin class- Expression
- Returns:
- an iterator containing the sub-expressions of this expression
 
- 
getUpdateExp
- 
setUpdateExp
- 
getReturnExp
- 
setReturnExp
- 
getCopyBindings
- 
setCopyBindingsSet the copy bindings. This is an expression whose value is the set of nodes that are allowed to be updated. Normally it will consist of a variable reference or a sequence of variable references.- Parameters:
- copyBindings- the set of Let expressions that bind variables that were copied during the copy phase and that therefore may be updated during the modify phase
 
- 
computeCardinalityprotected int computeCardinality()Determine the static cardinality of the expression. This establishes how many items there will be in the result of the expression, at compile time (i.e., without actually evaluating the result.- Specified by:
- computeCardinalityin class- Expression
- Returns:
- one of the values Cardinality.ONE_OR_MORE, Cardinality.ZERO_OR_MORE, Cardinality.EXACTLY_ONE, Cardinality.ZERO_OR_ONE, Cardinality.EMPTY. This default implementation returns ZERO_OR_MORE (which effectively gives no information).
 
- 
getItemTypeDetermine the data type of the expression, if possible. All expression return sequences, in general; this method determines the type of the items within the sequence, assuming that (a) this is known in advance, and (b) it is the same for all items in the sequence.This method should always return a result, though it may be the best approximation that is available at the time. - Specified by:
- getItemTypein class- Expression
- Returns:
- a value such as Type.STRING, Type.BOOLEAN, Type.NUMBER, Type.NODE, or Type.ITEM (meaning not known at compile time)
 
- 
isUpdatingExpressionpublic boolean isUpdatingExpression()Determine whether this is an updating expression as defined in the XQuery update specification- Overrides:
- isUpdatingExpressionin class- Expression
- Returns:
- false: although this expression performs updates, it is not classified as an updating expression
 
- 
getExpressionNameGet a name identifying the kind of expression, in terms meaningful to a user.- Overrides:
- getExpressionNamein class- Expression
- Returns:
- a name identifying the kind of expression, in terms meaningful to a user. The name will always be in the form of a lexical XML QName, and should match the name used in export() output displaying the expression.
 
- 
checkForUpdatingSubexpressionsCheck to ensure that this expression does not contain any inappropriate updating subexpressions. This check is overridden for those expressions that permit updating subexpressions.- Overrides:
- checkForUpdatingSubexpressionsin class- Expression
- Throws:
- XPathException- if the expression has a non-permitted updating subexpression
 
- 
copyCopy an expression. This makes a deep copy.- Specified by:
- copyin class- Expression
- Parameters:
- rebindings- variables to be rebound
- Returns:
- the copy of the original expression
 
- 
getImplementationMethodpublic int getImplementationMethod()An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). This method indicates which of these methods is provided directly. The other methods will always be available indirectly, using an implementation that relies on one of the other methods.- Specified by:
- getImplementationMethodin class- Expression
- Returns:
- the implementation method, for example Expression.ITERATE_METHODorExpression.EVALUATE_METHODorExpression.PROCESS_METHOD
 
- 
exportDiagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.- Specified by:
- exportin interface- ExportAgent
- Specified by:
- exportin class- Expression
- Parameters:
- out- the expression presenter used to display the structure
- Throws:
- XPathException- if the export fails, for example if an expression is found that won't work in the target environment.
 
- 
iterateReturn an Iterator to iterate over the values of a sequence. The value of every expression can be regarded as a sequence, so this method is supported for all expressions. This default implementation handles iteration for expressions that return singleton values: for non-singleton expressions, the subclass must provide its own implementation.- Overrides:
- iteratein class- Expression
- Parameters:
- context- supplies the context for evaluation
- Returns:
- a SequenceIterator that can be used to iterate over the result of the expression
- Throws:
- XPathException- if any dynamic error occurs evaluating the expression
 
- 
evaluateItemEvaluate an expression as a single item. This always returns either a single Item or null (denoting the empty sequence). No conversion is done. This method should not be used unless the static type of the expression is a subtype of "item" or "item?": that is, it should not be called if the expression may return a sequence. There is no guarantee that this condition will be detected.- Overrides:
- evaluateItemin class- Expression
- Parameters:
- context- The context in which the expression is to be evaluated
- Returns:
- the node or atomic value that results from evaluating the expression; or null to indicate that the result is an empty sequence
- Throws:
- XPathException- if any dynamic error occurs evaluating the expression
 
- 
processProcess the instruction, without returning any tail calls- Overrides:
- processin class- Expression
- Parameters:
- output- the destination for the result
- context- The dynamic context, giving access to the current node,
- Throws:
- XPathException- if a dynamic error occurs
 
- 
getElaboratorMake an elaborator for this expression- Overrides:
- getElaboratorin class- Expression
- Returns:
- an appropriate Elaborator
 
 
-