Class SSSOMTIsAFunction

java.lang.Object
org.incenp.obofoundry.sssom.owl.SSSOMTIsAFunction
All Implemented Interfaces:
IMappingFilter, ISSSOMTFunction<IMappingFilter>

public class SSSOMTIsAFunction extends Object implements ISSSOMTFunction<IMappingFilter>, IMappingFilter
Represents the SSSOM/T-OWL filter function "is_a".

That function may be used to select mappings depending on whether a given entity is a descendant of another entity, according to the class hierarchy available in the helper ontology of the SSSOM/T-OWL application. It expects two arguments:

  • the entity whose ascendency should be checked;
  • the root of the hierarchy to check.

For example, to select mappings whose subject is a descendant of UBERON:0000105:

 is_a(%{subject_id}, UBERON:0000105) -> ...;
 

The function works both with classes and with object and data properties. If the second argument is declared in the ontology as an object or data property, the function will test whether the first argument is a subproperty; otherwise, it will assume the second argument is a class, and will test whether the first argument is a subclass. Use the /type="class" or /type="property" optional argument to force treating the second argument as a class or as a property, respectively.

The function can also be used to check whether an entity is a class, an object property, a data property, or an annotation property, by setting the second argument, respectively, to owl:Thing (or owl:Class), owl:topObjectProperty (or owl:ObjectProperty), owl:topDataProperty (or owl:DataProperty), or owl:AnnotationProperty.

  • Constructor Details

    • SSSOMTIsAFunction

      public SSSOMTIsAFunction(SSSOMTOwlApplication application)
      Creates a new instance.
      Parameters:
      application - The SSSOM-T/OWL application object.
  • Method Details

    • getName

      public String 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 interface ISSSOMTFunction<IMappingFilter>
      Returns:
      The function name.
    • getSignature

      public String 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 single S 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 interface ISSSOMTFunction<IMappingFilter>
      Returns:
      The function signature.
    • call

      public IMappingFilter call(List<String> arguments, Map<String,String> keyedArguments) throws SSSOMTransformError
      Description 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 interface ISSSOMTFunction<IMappingFilter>
      Parameters:
      arguments - The arguments to the function. May be empty, but not null.
      keyedArguments - The keyed arguments to the function. May be empty, but null.
      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

      public boolean filter(Mapping mapping)
      Description copied from interface: IMappingFilter
      Check if a mapping satisfies a given condition.
      Specified by:
      filter in interface IMappingFilter
      Parameters:
      mapping - The mapping to test.
      Returns:
      true if the mapping satisfies the condition, false otherwise.