Private
Readonly
templateChecks if the input can be handled by this class. If it cannot handle the input, rejects with an error explaining why.
A promise resolving if the input can be handled, rejecting with an Error if not.
Input that could potentially be handled.
Private
constructUses the metadata of the Representation to create a map where each key is a content-type and each value is the path of the corresponding template.
Private
findFinds the best content-type to convert to based on the provided templates and preferences.
Handles the given input. This may only be called if canHandle did not reject. When unconditionally calling both in sequence, consider handleSafe instead.
A promise resolving when handling is finished.
Input that needs to be handled.
Helper function that first runs canHandle followed by handle. Throws the error of canHandle if the data cannot be handled, or returns the result of handle otherwise.
A promise resolving if the input can be handled, rejecting with an Error if not.
Input data that will be handled if it can be handled.
Converts JSON data by using it as input parameters for rendering a template. The
extension
field can be used to only support a specific type of templates, such as ".ejs" for EJS templates.To find the templates it expects the Representation metadata to contain
SOLID_META.template
triples, with the objects being the template paths. For each of those templates there also needs to be a CONTENT_TYPE triple describing the content-type of that template.The output of the result depends on the content-type matched with the template. In case JSON is the most preferred output type, the input representation will be returned unless a JSON template is defined.