Class MappingProcessor<T>
java.lang.Object
org.incenp.obofoundry.sssom.transform.MappingProcessor<T>
- Type Parameters:
T- The type of object that should be generated when applying a rule to a mapping.
- Direct Known Subclasses:
OWLGenerator
An engine for applying
MappingProcessingRules to mappings. This
engine is programmed with a list of rules that, applies them to a list of
mappings, and collects the objects generated by the rules.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddGeneratedListener(IMappingProcessorListener<T> listener) Adds a listener to react to "generated" events, when an object is generated by the application of a rule to a mapping.voidaddRule(MappingProcessingRule<T> rule) Adds a rule to be applied to mappings.voidaddRules(List<MappingProcessingRule<T>> rules) Adds a list of rules to be applied.voidaddStopingRule(IMappingFilter filter) Adds a rule that stops any further processing for selected mappings.voidexcludeRules(Set<String> tags) Sets the processor to exclude the rules that have at least one tag in the specified tag set.booleanhasRules()Indicates whether this processor has some rules to work with.voidincludeRules(Set<String> tags) Sets the processor to run only the rules that have at least one tag in the specified tag set.protected voidonGeneratedProduct(MappingProcessingRule<T> rule, Mapping mapping, T product) Called when a rule generates an object from a mapping.Applies all the rules to the given mappings.
-
Constructor Details
-
MappingProcessor
public MappingProcessor()
-
-
Method Details
-
addRule
Adds a rule to be applied to mappings. The order in which rules are added is significant. Rules are applied in the order in which they are added, and an earlier rule may impact the behaviour of a later rule.- Parameters:
rule- The new rule to add.
-
addRules
Adds a list of rules to be applied. This has the same effect as callingaddRule(MappingProcessingRule)repeatedly.- Parameters:
rules- The new rules to add.
-
addStopingRule
Adds a rule that stops any further processing for selected mappings.- Parameters:
filter- The filter to determine whether the rule applies to a given mapping.
-
addGeneratedListener
Adds a listener to react to "generated" events, when an object is generated by the application of a rule to a mapping.- Parameters:
listener- The listener to add.
-
includeRules
Sets the processor to run only the rules that have at least one tag in the specified tag set.- Parameters:
tags- The tags to select the rules to run. Any rules with no matching tag will be excluded.
-
excludeRules
Sets the processor to exclude the rules that have at least one tag in the specified tag set.- Parameters:
tags- The tags to select the rules to exclude. Only the rules with no matching tag will be run.
-
hasRules
public boolean hasRules()Indicates whether this processor has some rules to work with.- Returns:
trueif the processor has a least one rule,falseotherwise.
-
process
Applies all the rules to the given mappings.- Parameters:
mappings- The mappings the rules should be applied to.- Returns:
- A list of all the objects that were produced by the application of the rules.
-
onGeneratedProduct
Called when a rule generates an object from a mapping.- Parameters:
rule- The rule producing the object.mapping- The mapping the rule has been applied to.product- The object produced by the rule.
-