On 23/04/2015 03:50, Richard Walker wrote:
> Hi, I was wondering if it is possible to specify:
>
> * for just one particular endpoint:
> 1. a default viewer, as well as:
> 2. an additional "default" viewer that is to be applied for requests made to one
> particular formatter.
As things stand I think that the short answer is "no".
It is possible to specify per-endpoint viewers, but they apply to all formatters.
The think to remember is that that viewers are really about setting the 'locus'
of the graph around each selected ?item that is 'pulled' into the response by
the LDA view query. It is independent of how the resulting graph is rendered.
The 'traditional' renderers in ELDA (RDF/XML, TTL, NT, XML, XML->XSLT->HTML|CSV,
JSON) have no knowledge of what viewer is/was specific or more specifically what
property chains that implies. They simply render the RDF result.
The recent velocity renderer does provide the template writer with more access
to the internal structures within Elda and can use the Viewer specification (ie.
the detail of the view, not just its name) to inflence the rendering. But that
is all called *after* the result of the LDA view query (SPARQL) has been
obtained - the choice of renderer has no influence on the view query.
> (Here I mean "default" in the LDA sense of "what you get unless you specify
> something in the query
> parameters of the URL".)
>
> For example:
>
> * I have an endpoint (say, /path/.../endpoint).
> ** For just that endpoint, I want the "plain" (i.e., no viewer specified in the URL)
> JSON and XML output (/path/.../endpoint.json, /path/.../endpoint.xml) to
> include certain properties
> (i.e., properties specified with "the" default viewer for that endpoint).
> ** For just that same endpoint, I want the "plain" (i.e., no viewer specified in
> the URL)
> HTML output (which is via the default (XSLT) formatter, i.e.,
> /path/.../endpoint) to include _additional_ properties
> (i.e., properties specified with a "formatter-specific" "default" viewer that
> overrides "the" default viewer for the endpoint).
>
> My reading of the "Viewing Resources" section of the LDA doc suggests this
> is not possible.
I think that is a correct reading.
> So, do I have to make this two separate endpoints?
Maybe... but they won't be able to share the same 'api:uriTemplate'.
If you are willing to use the &_view parameter, you can overload view names on a
per endpoint basis... so you could consistently create a per endpoint "json",
"xml", "machine"/"human" or "brief"/"full" or whatever views. It kind of depends
on whether your view preferences are really format specific -
machine-centric/human-centric.
> I guess adding some rewriting to add a _view parameter to certain URL patterns
> may be possible ...
That could work. Be aware that conneg can also influence formatter selection in
the absence of &_format= or .{format} elements in the request URI.
> Richard.
HTH
Stuart
--
> --
> You received this message because you are subscribed to the Google Groups
> "linked-data-api-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to
linked-data-api-d...@googlegroups.com
> <mailto:
linked-data-api-d...@googlegroups.com>.
> For more options, visit
https://groups.google.com/d/optout.
--
Epimorphics Ltd
www.epimorphics.com
Court Lodge, 105 High Street, Portishead, Bristol BS20 6PT
Tel: 01275 399069
Epimorphics Ltd. is a limited company registered in England (number 7016688)
Registered address: Court Lodge, 105 High Street, Portishead, Bristol BS20 6PT, UK