-
Notifications
You must be signed in to change notification settings - Fork 2
Velocity environment
Stuart Williams edited this page Jan 25, 2018
·
4 revisions
Endpoints can be annotated with the name of a velocity template to use to render the result/result-stream as HTML.
The velocity environment will contain the following bindings:
Variable | Type | Meaning |
---|---|---|
uri | String |
The full requested URI |
root | String |
The root path for the application |
url | URLBuilder |
Requested URI in a form for convenient scripting |
{query-param} |
String or List<String>
|
Query/path parameters from call |
context | ServletContext | Context of the call |
lib | Lib |
Utility library |
app | App |
The application itself, through configuration information can be reached |
{component} | Object |
Components configured within the app |
result | WResult |
The result of an item query |
results | List<WResult> |
The results of a list query |
In the event of a clash of names the query-parameters take lower precedence that the other bindings.
The WResult
wrapper provides access to a result row as either RDF, JSON or raw Result objects.
Operation | Type |
---|---|
asRDF() |
RDFNodeWrapper |
asJson() |
WJSONObject |
asResult() |
Result - may be a TreeResult or RDFResult
|
The WJSONObject
wrapper is a Map<String, Object>
convenient for scripting with some additional convenience methods:
Method | Meaning |
---|---|
isObject() |
Test if this is a JSON object |
isArray() |
Test if this is a JSON array |
isResource() |
Test if this is a JSON object corresponding to an RDF URI resource |
getURI() |
Get the URI of an object corresponding to an RDF Resource |
isLangString() |
Test if this object is a lang-tagged string |
isTypedLiteral() |
Test if this object is a typed literal |
getLabel() |
Get the label field of object (depends on query) |
getName() |
Alias for getLabel()
|