Class SSSOMTDuplicateFunction
- All Implemented Interfaces:
IMappingFilter
,ISSSOMTFunction<IMappingFilter>
That function may be be used to select mappings for which a mapping-derived value is the same as another mapping. It expects one argument, which is the mapping-derived value to check against.
For example, to select mappings that have the same subject ID as a previous mapping:
is_duplicate(%{subject_id}) -> ...;
This could be used in conjunction with the stop()
preprocessor
to drop mappings that are considered "duplicates". For example, to drop all
mappings that have the same subject/predicate/object triple except the first
one:
is_duplicate("%{subject_id}%{predicate_id}%{object_id}") -> stop();
Or to drop all mappings that are entirely identical, except the first one
(using the hash
special substitution):
is_duplicate(%{hash}) -> stop();
-
Constructor Summary
ConstructorsConstructorDescriptionSSSOMTDuplicateFunction
(SSSOMTransformApplication<T> application) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionExecutes the function.boolean
Check 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
-
SSSOMTDuplicateFunction
Creates a new instance.- Type Parameters:
T
- The type of objects produced by the application.- Parameters:
application
- The application this function is a part of.
-
-
Method Details
-
getName
Description copied from interface:ISSSOMTFunction
Gets the name of the function, by which it can be called in a SSSOM/T ruleset.- Specified by:
getName
in interfaceISSSOMTFunction<IMappingFilter>
- Returns:
- The function name.
-
getSignature
Description copied from interface:ISSSOMTFunction
Gets 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 singleS
character 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:
SSS
for 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:
getSignature
in interfaceISSSOMTFunction<IMappingFilter>
- Returns:
- The function signature.
-
call
public IMappingFilter call(List<String> arguments, Map<String, String> keyedArguments) throws SSSOMTransformErrorDescription copied from interface:ISSSOMTFunction
Executes 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
arguments
list will contains two items).- Specified by:
call
in interfaceISSSOMTFunction<IMappingFilter>
- 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:IMappingFilter
Check if a mapping satisfies a given condition.- Specified by:
filter
in interfaceIMappingFilter
- Parameters:
mapping
- The mapping to test.- Returns:
true
if the mapping satisfies the condition,false
otherwise.
-