Possible to specify per-endpoint, per-formatter default viewer?

12 views
Skip to first unread message

Richard Walker

unread,
Apr 22, 2015, 10:50:56 PM4/22/15
to linked-data...@googlegroups.com
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.

(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.

So, do I have to make this two separate endpoints?

I guess adding some rewriting to add a _view parameter to certain URL patterns
may be possible ...

Richard.

--
Richard Walker
Web Applications Project Officer
Australian National Data Service
The Australian National University
101 Liversidge Street
Acton ACT 2601, Australia
E: Richard...@ands.org.au
T: +61 2 6125 0584
W: www.ands.org.au

Richard Walker

unread,
Apr 23, 2015, 3:42:13 AM4/23/15
to linked-data...@googlegroups.com
On Thursday, April 23, 2015 at 12:50:56 PM UTC+10, Richard Walker wrote:
So, do I have to make this two separate endpoints?

I guess adding some rewriting to add a _view parameter to certain URL patterns
may be possible ...

Not a direct solution to the "problem", but another workaround would be to rely on
the default viewer as used by all the different formatters, but to include
in the generated HTML an "Advanced view" link to get the same page
but with the _view parameter added to use the different viewer that gets
the extra properties.

Stuart Williams

unread,
Apr 23, 2015, 7:09:24 AM4/23/15
to linked-data...@googlegroups.com
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
--
>
> --
> Richard Walker
> Web Applications Project Officer
> Australian National Data Service
> The Australian National University
> 101 Liversidge Street
> Acton ACT 2601, Australia
> E: Richard...@ands.org.au
> T: +61 2 6125 0584
> W: www.ands.org.au
>
> --
> 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

Rob Atkinson

unread,
Apr 23, 2015, 7:22:20 AM4/23/15
to Linked Data API Discuss
why not handle this in non-information resource/information resource URL redirection layer, as recommended by W3C @  http://www.w3.org/2001/tag/doc/httpRange-14/2007-05-31/HttpRange-14

(The API delivers a document resource, so it should be hidden behind a "non-information resource" - as per the discussion on identifiers for vocabulary terms. )



To unsubscribe from this group and stop receiving emails from it, send an email to linked-data-api-d...@googlegroups.com.

Stuart Williams

unread,
Apr 23, 2015, 7:56:43 AM4/23/15
to linked-data...@googlegroups.com
On 23/04/2015 12:22, Rob Atkinson wrote:
why not handle this in non-information resource/information resource URL redirection layer, as recommended by W3C @  http://www.w3.org/2001/tag/doc/httpRange-14/2007-05-31/HttpRange-14

(The API delivers a document resource, so it should be hidden behind a "non-information resource" - as per the discussion on identifiers for vocabulary terms. )

I think that's all orthogonal to the question that Richard asked below - which was about whether/how to configure (endpoint x formatter) specific views in LDA.

Stuart

Rob Atkinson

unread,
Apr 23, 2015, 8:05:58 AM4/23/15
to Linked Data API Discuss
not really orthogonal if you separate the concerns  - using url rewriting you can ask for a specific view depending on the content-type requested - or even bind to a different endpoint.  If you think of the endpoints and all the configured views as just a bunch of related document resources you can connect them to object identifiers any way you please.

Reply all
Reply to author
Forward
0 new messages