OK, I think I have a position I'm not completely unhappy
with; it turns out to be pretty much Brian's original
"put RDF Node in Value" with ancillary background and
detail.
Givens:
* we wish to be able to transmit configuration information
from the API config to renderers (specifically we wish to
be able to configure lists of pairs of (partial) URIs for
renaming purposes, but we do not wish this to have a one-off
ad-hoc solution)
* we don't know what the type and structure of this
information is in advance other than "expressible in RDF"
* we currently do this by exploiting api:variables whose values
represent [typed/languages] literals and URI resources;
an api:value can be created from an RDF literal or resource
or a string, but NOT a bnode. Structured values such as lists
and anonymous resources with properties cannot be specified
using this mechanism.
* api:variables value strings may contain substitution markers
{name}; when the value of the variable is demanded the string
is (recursively) expanded.
* the value of an api:variable named X may be injected into a
query using the SPARQL syntax ?X, where it is replaced by
the SPARQL rendering of the variable's value; currently either
a literal or a URI resource.
* if we add a feature now we would very much prefer to not
remove it later.
* it is not required that all of a feature be added at once.
Proposal:
* to use api:variables to transmit this new configuration
information (as opposed to specialised new features of
an API[Endpoint]Spec, etc).
* to transmit this information as an RDFNode embedded in
the API config model, allowing for list and record structures
in the usual way, rather than attempting to build some
parallel data structure (eg Java lists), and leaving it to the
user of the config information to walk the RDF graph as
they require.
* to specify this RDFNode as the object of the api:value
statement, and further allowing blank nodes as these objects eg
api:variable [api:name "Adam"; api:value [my:from 1; my:to 2]]
* to embed this RDF node as a new field of the Value object
which represents the api:value in a Bindings structure (which
is already available to the code of the velocity renderer) via
an accessor eg getSpecNode().
* to define that
(A) no {} text substitution applies to any strings forming part
of the api:value; they are what they are. If the code that exploits
the RDFNode cares it can request that strings are expanded
according to its own whim.
(B) if the variable is injected into a SPARQL query then
the query fails with status 500. (Sometimes it might be a bad
request but it's not obvious how to tell and we have to pick
one.) Rejecting any injection of the variable means that we
don't have to decide what it might mean right now and can supply
a definition later if we wish.
Note that this proposal is independant of the existing code
that allows arbitrary Java values (such as servlet requests)
to be bound as the value of an api:variable.
Chris
--
Chris "allusive" Dollin