Class MultiFunctions

java.lang.Object
org.topbraid.shacl.multifunctions.MultiFunctions

public class MultiFunctions extends Object
A singleton managing the (known) MultiFunctions, for example to drive code generators. Any MultiFunction that gets registered will also be installed as a SPARQL property function for Jena.
Author:
Holger Knublauch
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    get(String uri)
    Gets a MultiFunction with a given URI.
    getOrCreate(org.apache.jena.rdf.model.Resource multiFunction)
     
    static org.topbraid.shacl.multifunctions.MultiFunctionPropertyFunction
    register(MultiFunction multiFunction)
    Registers a MultiFunction and installs a corresponding Jena property function.
    static void
    registerAll(org.apache.jena.rdf.model.Model model)
    Registers all declarative MultiFunctions (instances of dash:MultiFunction) from a given Model.
    registerAllTemp(org.apache.jena.rdf.model.Model model)
    Temporarily registers any multi-function that is not registered yet, e.g.
    static void
    Removes a MultiFunction and the corresponding property function.
    static Stream<String>
    Gets a stream of the known URIs, which can then be used by the get function.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MultiFunctions

      public MultiFunctions()
  • Method Details

    • get

      public static MultiFunction get(String uri)
      Gets a MultiFunction with a given URI.
      Parameters:
      uri - the URI of the MultiFunction to get
      Returns:
      the MultiFunction or null
    • getOrCreate

      public static MultiFunction getOrCreate(org.apache.jena.rdf.model.Resource multiFunction)
    • register

      public static org.topbraid.shacl.multifunctions.MultiFunctionPropertyFunction register(MultiFunction multiFunction)
      Registers a MultiFunction and installs a corresponding Jena property function.
      Parameters:
      multiFunction - the MultiFunction
    • registerAll

      public static void registerAll(org.apache.jena.rdf.model.Model model)
      Registers all declarative MultiFunctions (instances of dash:MultiFunction) from a given Model. This will overwrite any previously known functions and property functions with overlapping URIs.
      Parameters:
      model - the Model to look up the definitions
    • registerAllTemp

      public static Iterable<String> registerAllTemp(org.apache.jena.rdf.model.Model model)
      Temporarily registers any multi-function that is not registered yet, e.g. for the duration of a test case. Needs to be followed by unregister calls in a finally block.
      Parameters:
      model - the Model to add the MultiFunctions of
      Returns:
      the actually added URIs, needed for the unregister call
    • unregister

      public static void unregister(String uri)
      Removes a MultiFunction and the corresponding property function.
      Parameters:
      uri - the URI of the multi-function to remove
    • uris

      public static Stream<String> uris()
      Gets a stream of the known URIs, which can then be used by the get function.
      Returns:
      the URIs