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 MultiFunctions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static MultiFunctionget(String uri)Gets a MultiFunction with a given URI.static MultiFunctiongetOrCreate(org.apache.jena.rdf.model.Resource multiFunction)static org.topbraid.shacl.multifunctions.MultiFunctionPropertyFunctionregister(MultiFunction multiFunction)Registers a MultiFunction and installs a corresponding Jena property function.static voidregisterAll(org.apache.jena.rdf.model.Model model)Registers all declarative MultiFunctions (instances of dash:MultiFunction) from a given Model.static Iterable<String>registerAllTemp(org.apache.jena.rdf.model.Model model)Temporarily registers any multi-function that is not registered yet, e.g.static voidunregister(String uri)Removes a MultiFunction and the corresponding property function.static Stream<String>uris()Gets a stream of the known URIs, which can then be used by the get function.
-
-
-
Method Detail
-
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
-
-