
Package org.hl7.fhir.r4.fhirpath
Class FHIRPathEngine
java.lang.Object
org.hl7.fhir.r4.fhirpath.FHIRPathEngine
- Author:
- Grahame Grieve
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classclassclass -
Constructor Summary
ConstructorsConstructorDescriptionFHIRPathEngine(IWorkerContext worker) FHIRPathEngine(IWorkerContext worker, ProfileUtilities utilities) -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbytesToHex(byte[] bytes) check(Object appContext, String rootResourceType, String resourceType, String context, ExpressionNode expr) check that paths referred to in the ExpressionNode are valid xPathStartsWithValueRef is a hack work around for the fact that FHIR Path sometimes needs a different starting point than the xpath returns a list of the possible types that might be returned by executing the ExpressionNode against a particular contextcheck(Object appContext, String rootResourceType, String resourceType, String context, ExpressionNode expr, Set<ElementDefinition> elementDependencies) check that paths referred to in the ExpressionNode are valid xPathStartsWithValueRef is a hack work around for the fact that FHIR Path sometimes needs a different starting point than the xpath returns a list of the possible types that might be returned by executing the ExpressionNode against a particular contextcheck(Object appContext, String rootResourceType, String resourceType, List<String> resourceTypes, ExpressionNode expr, Set<ElementDefinition> elementDependencies) check that paths referred to in the ExpressionNode are valid xPathStartsWithValueRef is a hack work around for the fact that FHIR Path sometimes needs a different starting point than the xpath returns a list of the possible types that might be returned by executing the ExpressionNode against a particular contextcheck(Object appContext, String rootResourceType, StructureDefinition sd, String context, ExpressionNode expr) check(Object appContext, String rootResourceType, StructureDefinition sd, ExpressionNode expr) checkOnTypes(Object appContext, String rootResourceType, String resourceType, List<String> typeList, ExpressionNode expr, List<FHIRPathEngine.IssueMessage> warnings) check that paths referred to in the ExpressionNode are valid xPathStartsWithValueRef is a hack work around for the fact that FHIR Path sometimes needs a different starting point than the xpath returns a list of the possible types that might be returned by executing the ExpressionNode against a particular contextcheckOnTypes(Object appContext, String rootResourceType, String resourceType, TypeDetails types, ExpressionNode expr, List<FHIRPathEngine.IssueMessage> warnings) checkOnTypes(Object appContext, String rootResourceType, String resourceType, TypeDetails types, ExpressionNode expr, List<FHIRPathEngine.IssueMessage> warnings, boolean canBeNone) booleanconvertToBoolean(List<Base> items) worker routine for converting a set of objects to a boolean representation (for invariants)convertToString(List<Base> items) worker routine for converting a set of objects to a string representationconvertToString(Base item) evaluate(Object appContext, Base base, ExpressionNode ExpressionNode) evaluate a path and return the matching elementsevaluate(Object appContext, Base focusResource, Base rootResource, Base base, ExpressionNode expressionNode) evaluate a path and return the matching elementsevaluate a path and return the matching elementsevaluate(Object appContext, Resource focusResource, Resource rootResource, Base base, ExpressionNode ExpressionNode) evaluate a path and return the matching elementsevaluate a path and return the matching elementsevaluate(Base base, ExpressionNode ExpressionNode) evaluate a path and return the matching elementsevaluateDefinition(ExpressionNode expr, StructureDefinition profile, FHIRPathUtilityClasses.TypedElementDefinition element, StructureDefinition source, boolean dontWalkIntoReferences) given an element definition in a profile, what element contains the differentiating fixed for the element, given the differentiating expresssion.booleanevaluateToBoolean(Object appInfo, Base focusResource, Base rootResource, Base base, ExpressionNode node) evaluate a path and return true or false (e.g. for an invariant)booleanevaluateToBoolean(Object appInfo, Resource focusResource, Resource rootResource, Base base, ExpressionNode node) evaluate a path and return true or false (e.g. for an invariant)booleanevaluateToBoolean(Resource focusResource, Resource rootResource, Base base, String path) evaluate a path and return true or false (e.g. for an invariant)booleanevaluateToBoolean(Resource focusResource, Resource rootResource, Base base, ExpressionNode node) evaluate a path and return true or false (e.g. for an invariant)evaluateToString(Object appInfo, Base focusResource, Base rootResource, Base base, ExpressionNode node) evaluateToString(Base base, String path) evaluate a path and a string containing the outcome (for display)forLog()protected voidgetChildrenByName(Base item, String name, List<Base> result) Given an item, return all the children that conform to the pattern described in name Possible patterns: - a simple name (which may be the base of a name with [] e.g. value[x]) - a name with a type replacement e.g. valueCodeableConcept - * which means all children - ** which means all descendantsList<org.hl7.fhir.r4.fhirpath.FHIRPathEngine.ElementDefinitionMatch> getElementDefinition(StructureDefinition sd, String path, boolean allowTypedName, ExpressionNode expr) org.hl7.fhir.utilities.validation.ValidationOptionsbooleanhasLog()static byte[]booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanParse a path for later use using executeParse a path that is part of some other syntaxparsePartial(String path, int i) Parse a path for later use using executevoidsetAllowDoubleQuotes(boolean allowDoubleQuotes) voidsetAllowPolymorphicNames(boolean allowPolymorphicNames) voidsetDoImplicitStringConversion(boolean doImplicitStringConversion) voidsetDoNotEnforceAsCaseSensitive(boolean doNotEnforceAsCaseSensitive) voidsetDoNotEnforceAsSingletonRule(boolean doNotEnforceAsSingletonRule) voidsetEmitSQLonFHIRWarning(boolean emitSQLonFHIRWarning) voidsetHostServices(IHostApplicationServices constantResolver) voidsetLegacyMode(boolean legacyMode) voidsetLiquidMode(boolean liquidMode) voidsetLocation(String location) takeLog()
-
Constructor Details
-
FHIRPathEngine
- Parameters:
worker- - used when validating paths (@check), and used doing value set membership when executing tests (once that's defined)
-
FHIRPathEngine
-
-
Method Details
-
getHostServices
-
setHostServices
-
getLocation
-
setLocation
-
getChildrenByName
protected void getChildrenByName(Base item, String name, List<Base> result) throws org.hl7.fhir.exceptions.FHIRException Given an item, return all the children that conform to the pattern described in name Possible patterns: - a simple name (which may be the base of a name with [] e.g. value[x]) - a name with a type replacement e.g. valueCodeableConcept - * which means all children - ** which means all descendants- Parameters:
item-name-result-- Throws:
org.hl7.fhir.exceptions.FHIRException
-
isLegacyMode
-
setLegacyMode
-
isDoImplicitStringConversion
-
setDoImplicitStringConversion
-
isDoNotEnforceAsSingletonRule
-
setDoNotEnforceAsSingletonRule
-
isDoNotEnforceAsCaseSensitive
-
setDoNotEnforceAsCaseSensitive
-
parse
Parse a path for later use using execute- Parameters:
path-- Returns:
- Throws:
org.hl7.fhir.exceptions.PathEngineExceptionExceptionFHIRLexer.FHIRLexerException
-
parse
- Throws:
FHIRLexer.FHIRLexerException
-
parsePartial
public FHIRPathEngine.ExpressionNodeWithOffset parsePartial(String path, int i) throws FHIRLexer.FHIRLexerException Parse a path for later use using execute- Parameters:
path-- Returns:
- Throws:
org.hl7.fhir.exceptions.PathEngineExceptionExceptionFHIRLexer.FHIRLexerException
-
parse
Parse a path that is part of some other syntax- Returns:
- Throws:
org.hl7.fhir.exceptions.PathEngineExceptionExceptionFHIRLexer.FHIRLexerException
-
check
public TypeDetails check(Object appContext, String rootResourceType, String resourceType, String context, ExpressionNode expr) throws FHIRLexer.FHIRLexerException, org.hl7.fhir.exceptions.PathEngineException, org.hl7.fhir.exceptions.DefinitionException check that paths referred to in the ExpressionNode are valid xPathStartsWithValueRef is a hack work around for the fact that FHIR Path sometimes needs a different starting point than the xpath returns a list of the possible types that might be returned by executing the ExpressionNode against a particular context- Parameters:
context- - the logical type against which this path is applied- Throws:
org.hl7.fhir.exceptions.DefinitionExceptionorg.hl7.fhir.exceptions.PathEngineExceptionFHIRLexer.FHIRLexerException
-
check
public TypeDetails check(Object appContext, String rootResourceType, String resourceType, String context, ExpressionNode expr, Set<ElementDefinition> elementDependencies) throws FHIRLexer.FHIRLexerException, org.hl7.fhir.exceptions.PathEngineException, org.hl7.fhir.exceptions.DefinitionException check that paths referred to in the ExpressionNode are valid xPathStartsWithValueRef is a hack work around for the fact that FHIR Path sometimes needs a different starting point than the xpath returns a list of the possible types that might be returned by executing the ExpressionNode against a particular context- Parameters:
context- - the logical type against which this path is applied- Throws:
org.hl7.fhir.exceptions.DefinitionExceptionorg.hl7.fhir.exceptions.PathEngineExceptionFHIRLexer.FHIRLexerException
-
checkOnTypes
public TypeDetails checkOnTypes(Object appContext, String rootResourceType, String resourceType, List<String> typeList, ExpressionNode expr, List<FHIRPathEngine.IssueMessage> warnings) throws FHIRLexer.FHIRLexerException, org.hl7.fhir.exceptions.PathEngineException, org.hl7.fhir.exceptions.DefinitionException check that paths referred to in the ExpressionNode are valid xPathStartsWithValueRef is a hack work around for the fact that FHIR Path sometimes needs a different starting point than the xpath returns a list of the possible types that might be returned by executing the ExpressionNode against a particular context- Parameters:
context- - the logical type against which this path is applied- Throws:
org.hl7.fhir.exceptions.DefinitionExceptionorg.hl7.fhir.exceptions.PathEngineExceptionFHIRLexer.FHIRLexerException
-
checkOnTypes
public TypeDetails checkOnTypes(Object appContext, String rootResourceType, String resourceType, TypeDetails types, ExpressionNode expr, List<FHIRPathEngine.IssueMessage> warnings) throws FHIRLexer.FHIRLexerException, org.hl7.fhir.exceptions.PathEngineException, org.hl7.fhir.exceptions.DefinitionException - Throws:
FHIRLexer.FHIRLexerExceptionorg.hl7.fhir.exceptions.PathEngineExceptionorg.hl7.fhir.exceptions.DefinitionException
-
checkOnTypes
public TypeDetails checkOnTypes(Object appContext, String rootResourceType, String resourceType, TypeDetails types, ExpressionNode expr, List<FHIRPathEngine.IssueMessage> warnings, boolean canBeNone) throws FHIRLexer.FHIRLexerException, org.hl7.fhir.exceptions.PathEngineException, org.hl7.fhir.exceptions.DefinitionException - Throws:
FHIRLexer.FHIRLexerExceptionorg.hl7.fhir.exceptions.PathEngineExceptionorg.hl7.fhir.exceptions.DefinitionException
-
check
public TypeDetails check(Object appContext, String rootResourceType, String resourceType, List<String> resourceTypes, ExpressionNode expr, Set<ElementDefinition> elementDependencies) throws FHIRLexer.FHIRLexerException, org.hl7.fhir.exceptions.PathEngineException, org.hl7.fhir.exceptions.DefinitionException check that paths referred to in the ExpressionNode are valid xPathStartsWithValueRef is a hack work around for the fact that FHIR Path sometimes needs a different starting point than the xpath returns a list of the possible types that might be returned by executing the ExpressionNode against a particular context- Throws:
org.hl7.fhir.exceptions.DefinitionExceptionorg.hl7.fhir.exceptions.PathEngineExceptionFHIRLexer.FHIRLexerException
-
check
public TypeDetails check(Object appContext, String rootResourceType, StructureDefinition sd, String context, ExpressionNode expr) throws FHIRLexer.FHIRLexerException, org.hl7.fhir.exceptions.PathEngineException, org.hl7.fhir.exceptions.DefinitionException - Throws:
FHIRLexer.FHIRLexerExceptionorg.hl7.fhir.exceptions.PathEngineExceptionorg.hl7.fhir.exceptions.DefinitionException
-
check
public TypeDetails check(Object appContext, String rootResourceType, StructureDefinition sd, ExpressionNode expr) throws FHIRLexer.FHIRLexerException, org.hl7.fhir.exceptions.PathEngineException, org.hl7.fhir.exceptions.DefinitionException - Throws:
FHIRLexer.FHIRLexerExceptionorg.hl7.fhir.exceptions.PathEngineExceptionorg.hl7.fhir.exceptions.DefinitionException
-
check
public TypeDetails check(Object appContext, String rootResourceType, String resourceType, String context, String expr) throws FHIRLexer.FHIRLexerException, org.hl7.fhir.exceptions.PathEngineException, org.hl7.fhir.exceptions.DefinitionException - Throws:
FHIRLexer.FHIRLexerExceptionorg.hl7.fhir.exceptions.PathEngineExceptionorg.hl7.fhir.exceptions.DefinitionException
-
evaluate
public List<Base> evaluate(Base base, ExpressionNode ExpressionNode) throws org.hl7.fhir.exceptions.FHIRException evaluate a path and return the matching elements- Parameters:
base- - the object against which the path is being evaluatedExpressionNode- - the parsed ExpressionNode statement to use- Returns:
- Throws:
org.hl7.fhir.exceptions.FHIRException
-
evaluate
public List<Base> evaluate(Object appContext, Base base, ExpressionNode ExpressionNode) throws org.hl7.fhir.exceptions.FHIRException evaluate a path and return the matching elements- Parameters:
base- - the object against which the path is being evaluatedExpressionNode- - the parsed ExpressionNode statement to use- Returns:
- Throws:
org.hl7.fhir.exceptions.FHIRException
-
evaluate
evaluate a path and return the matching elements- Parameters:
base- - the object against which the path is being evaluatedpath- - the FHIR Path statement to use- Returns:
- Throws:
org.hl7.fhir.exceptions.FHIRException
-
evaluate
public List<Base> evaluate(Object appContext, Resource focusResource, Resource rootResource, Base base, ExpressionNode ExpressionNode) throws org.hl7.fhir.exceptions.FHIRException evaluate a path and return the matching elements- Parameters:
base- - the object against which the path is being evaluatedExpressionNode- - the parsed ExpressionNode statement to use- Returns:
- Throws:
org.hl7.fhir.exceptions.FHIRException
-
evaluate
public List<Base> evaluate(Object appContext, Base focusResource, Base rootResource, Base base, ExpressionNode expressionNode) throws org.hl7.fhir.exceptions.FHIRException evaluate a path and return the matching elements- Parameters:
base- - the object against which the path is being evaluatedexpressionNode- - the parsed ExpressionNode statement to use- Returns:
- Throws:
org.hl7.fhir.exceptions.FHIRException
-
evaluate
public List<Base> evaluate(Object appContext, Resource focusResource, Resource rootResource, Base base, String path) throws org.hl7.fhir.exceptions.FHIRException evaluate a path and return the matching elements- Parameters:
base- - the object against which the path is being evaluatedpath- - the FHIR Path statement to use- Returns:
- Throws:
org.hl7.fhir.exceptions.FHIRException
-
evaluateToBoolean
public boolean evaluateToBoolean(Resource focusResource, Resource rootResource, Base base, String path) throws org.hl7.fhir.exceptions.FHIRException evaluate a path and return true or false (e.g. for an invariant)- Parameters:
base- - the object against which the path is being evaluatedpath- - the FHIR Path statement to use- Returns:
- Throws:
org.hl7.fhir.exceptions.FHIRException
-
evaluateToBoolean
public boolean evaluateToBoolean(Resource focusResource, Resource rootResource, Base base, ExpressionNode node) throws org.hl7.fhir.exceptions.FHIRException evaluate a path and return true or false (e.g. for an invariant)- Parameters:
base- - the object against which the path is being evaluated- Returns:
- Throws:
org.hl7.fhir.exceptions.FHIRException
-
evaluateToBoolean
public boolean evaluateToBoolean(Object appInfo, Resource focusResource, Resource rootResource, Base base, ExpressionNode node) throws org.hl7.fhir.exceptions.FHIRException evaluate a path and return true or false (e.g. for an invariant)- Parameters:
appInfo- - application contextbase- - the object against which the path is being evaluated- Returns:
- Throws:
org.hl7.fhir.exceptions.FHIRException
-
evaluateToBoolean
public boolean evaluateToBoolean(Object appInfo, Base focusResource, Base rootResource, Base base, ExpressionNode node) throws org.hl7.fhir.exceptions.FHIRException evaluate a path and return true or false (e.g. for an invariant)- Parameters:
base- - the object against which the path is being evaluated- Returns:
- Throws:
org.hl7.fhir.exceptions.FHIRException
-
evaluateToString
evaluate a path and a string containing the outcome (for display)- Parameters:
base- - the object against which the path is being evaluatedpath- - the FHIR Path statement to use- Returns:
- Throws:
org.hl7.fhir.exceptions.FHIRException
-
evaluateToString
public String evaluateToString(Object appInfo, Base focusResource, Base rootResource, Base base, ExpressionNode node) throws org.hl7.fhir.exceptions.FHIRException - Throws:
org.hl7.fhir.exceptions.FHIRException
-
convertToString
worker routine for converting a set of objects to a string representation- Parameters:
items- - result from @evaluate- Returns:
-
convertToString
-
convertToBoolean
worker routine for converting a set of objects to a boolean representation (for invariants)- Parameters:
items- - result from @evaluate- Returns:
-
forLog
-
bytesToHex
-
hexStringToByteArray
-
parseQuantityString
-
getElementDefinition
public List<org.hl7.fhir.r4.fhirpath.FHIRPathEngine.ElementDefinitionMatch> getElementDefinition(StructureDefinition sd, String path, boolean allowTypedName, ExpressionNode expr) throws org.hl7.fhir.exceptions.PathEngineException - Throws:
org.hl7.fhir.exceptions.PathEngineException
-
hasLog
-
takeLog
-
evaluateDefinition
public FHIRPathUtilityClasses.TypedElementDefinition evaluateDefinition(ExpressionNode expr, StructureDefinition profile, FHIRPathUtilityClasses.TypedElementDefinition element, StructureDefinition source, boolean dontWalkIntoReferences) throws org.hl7.fhir.exceptions.DefinitionException given an element definition in a profile, what element contains the differentiating fixed for the element, given the differentiating expresssion. The expression is only allowed to use a subset of FHIRPath- Parameters:
profile-element-- Returns:
- Throws:
org.hl7.fhir.exceptions.PathEngineExceptionorg.hl7.fhir.exceptions.DefinitionException
-
getTerminologyServiceOptions
-
getWorker
-
isAllowPolymorphicNames
-
setAllowPolymorphicNames
-
isLiquidMode
-
setLiquidMode
-
getProfileUtilities
-
isAllowDoubleQuotes
-
setAllowDoubleQuotes
-
isEmitSQLonFHIRWarning
-
setEmitSQLonFHIRWarning
-