Class SSSOMTUriExpressionContainsFunction<T>
- Type Parameters:
T- The type of object produced by the application this function belongs to.
- All Implemented Interfaces:
IMappingFilter,ISSSOMTFunction<IMappingFilter>
That function allows the filtering of mappings depending on the contents of a “URI Expression”. It takes (at least) three arguments:
- the Expression URI to look into (typically provided as
%subject_idor%object_id); - the name of a URI Expression slot;
- the expected value of that slot.
A mapping will be selected if (1) the first argument is a valid URI Expression, and (2) it contains a slot with a name matching the second argument, and (3) that slot has the expected value. Otherwise, the mapping will be rejected.
The first argument may contain standard SSSOM/T placeholders (and that is typically expected).
Matching the expected value with the actual value of the slot follows the same rule as all other ID comparisons in SSSOM/T, in that the expected value may end with a '*' character to test whether the actual value starts with the same prefix as the expected value.
The function may take additional pairs of arguments to check several slots in the same call.
Example:
uriexpr_contains(%{subject_id}, 'disease', MONDO:1234, 'phenotype', HP:*) -> ...;
This will select any mapping whose subject ID is a URI Expression containing
a disease slot with the value MONDO:1234 and a
phenotype slot with any value starting with the HP prefix.
-
Constructor Summary
ConstructorsConstructorDescriptionSSSOMTUriExpressionContainsFunction(SSSOMTransformApplication<T> application) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionExecutes the function.booleanCheck if a mapping satisfies a given condition.getName()Gets the name of the function, by which it can be called in a SSSOM/T ruleset.Gets the expected signature of the function.
-
Constructor Details
-
SSSOMTUriExpressionContainsFunction
Creates a new instance.- Parameters:
application- The application this function belongs to.
-
-
Method Details
-
getName
Description copied from interface:ISSSOMTFunctionGets the name of the function, by which it can be called in a SSSOM/T ruleset.- Specified by:
getNamein interfaceISSSOMTFunction<T>- Returns:
- The function name.
-
getSignature
Description copied from interface:ISSSOMTFunctionGets the expected signature of the function. It should be a string that represents how many arguments (excluding keyed arguments) the function is expecting, where a singleScharacter represents an argument.Regular expression syntax may be used to represent arguments that are optional or represent other kinds of constraints about the arguments list.
Examples:
SSSfor a function that expects exactly 3 arguments;S+for a function that expects at least one argument, possibly more;(SS)+for a function that one or more pairs of arguments (e.g. 2, 4, 6, but not 3 or 5).
- Specified by:
getSignaturein interfaceISSSOMTFunction<T>- Returns:
- The function signature.
-
call
public IMappingFilter call(List<String> arguments, Map<String, String> keyedArguments) throws SSSOMTransformErrorDescription copied from interface:ISSSOMTFunctionExecutes the function.Before this method is called, the arguments list will have been checked against the signature and will be guaranteed to be correct (e.g. if the function declared to expects two arguments, it is guaranteed the
argumentslist will contains two items).- Specified by:
callin interfaceISSSOMTFunction<T>- Parameters:
arguments- The arguments to the function. May be empty, but notnull.keyedArguments- The keyed arguments to the function. May be empty, butnull.- Returns:
- The result of executing the function.
- Throws:
SSSOMTransformError- If any error occurred when executing the function (which may include the case where the number of arguments was correct but their contents was not).
-
filter
Description copied from interface:IMappingFilterCheck if a mapping satisfies a given condition.- Specified by:
filterin interfaceIMappingFilter- Parameters:
mapping- The mapping to test.- Returns:
trueif the mapping satisfies the condition,falseotherwise.
-