Class SSSOMTInvertFunction
- java.lang.Object
-
- org.incenp.obofoundry.sssom.transform.SSSOMTInvertFunction
-
- All Implemented Interfaces:
IMappingTransformer<Mapping>,ISSSOMTFunction<IMappingTransformer<Mapping>>
public class SSSOMTInvertFunction extends Object implements ISSSOMTFunction<IMappingTransformer<Mapping>>, IMappingTransformer<Mapping>
Represents the SSSOM/T standard preprocessor function "invert".This function simply returns an inverted copy of the original mapping. It takes one optional argument, which is the predicate to use in the inverted mapping. Placeholders are supported in this argument.
If called without any argument, the function will invert the mapping if it knows the correct inverse predicate; if it does not, the mapping will be dropped.
-
-
Constructor Summary
Constructors Constructor Description SSSOMTInvertFunction(SSSOMTransformApplication<T> application)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IMappingTransformer<Mapping>call(List<String> arguments, Map<String,String> keyedArguments)Executes the function.StringgetName()Gets the name of the function, by which it can be called in a SSSOM/T ruleset.StringgetSignature()Gets the expected signature of the function.Mappingtransform(Mapping mapping)Transform a mapping into something else.
-
-
-
Constructor Detail
-
SSSOMTInvertFunction
public SSSOMTInvertFunction(SSSOMTransformApplication<T> application)
-
-
Method Detail
-
getName
public String 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<IMappingTransformer<Mapping>>- Returns:
- The function name.
-
getSignature
public String 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<IMappingTransformer<Mapping>>- Returns:
- The function signature.
-
call
public IMappingTransformer<Mapping> call(List<String> arguments, Map<String,String> keyedArguments) throws SSSOMTransformError
Description 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<IMappingTransformer<Mapping>>- 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).
-
transform
public Mapping transform(Mapping mapping)
Description copied from interface:IMappingTransformerTransform a mapping into something else.- Specified by:
transformin interfaceIMappingTransformer<Mapping>- Parameters:
mapping- The mapping to transform.- Returns:
- The object generated from the mapping.
-
-