Class UriExpressionRegistry
java.lang.Object
org.incenp.obofoundry.sssom.uriexpr.UriExpressionRegistry
A basic registry of URI Expression schemas.
For now, the sole purpose of this registry is to associate a “schema” (the first half of a URI Expression, before the JSON-URL part) and a format with an expansion template. More features may be added in the future.
This is only used by the SSSOM/T-OWL (ROBOT) application, so the only format we need in the OWL Manchester Syntax format, but again, this may change in the future.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapplyTemplate
(UriExpression expression, String format) Applies a template to a URI Expression.getTemplate
(UriExpression expression, String format) Gets a template in a given format for a URI Expression.void
registerTemplate
(String schema, String format, String template) Registers a new template.
-
Constructor Details
-
UriExpressionRegistry
public UriExpressionRegistry()
-
-
Method Details
-
registerTemplate
Registers a new template.The template should be a string containing placeholders of the form
{placeholder}
, where placeholder is the name of a slot in the URI Expression.- Parameters:
schema
- The name of the URI Expression schema.format
- An identifier for the format of the template.template
- The template string.
-
getTemplate
Gets a template in a given format for a URI Expression.- Parameters:
expression
- The URI Expression we want a template for. This method will lookup the template associated with the expression’s schema.format
- The requested format of the template.- Returns:
- The template, or
null
if there is no template for the expression’s schema in the requested format.
-
applyTemplate
Applies a template to a URI Expression.- Parameters:
expression
- The expression whose values should be inserted into the template. The template to apply will be automatically lookup from the expression’s schema.format
- The requested format of the template.- Returns:
- A formatted string with the expression-derived values.
-