-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return actual definition in negotiated media type #109
Comments
@rob-metalinkage This is potentially another use case for Content Negotiation. |
There is a good deal of flexibility, the def server already supports Content-negotiation. however the DefServer can't so its up to the SWG to define exactly what it wants and then the NA to decide how the DefServer should behave, then then I can implement the desired behaviour. In order to achieve this: many SWGs deal with b) for things like XML schemas, but its less than clear for all cases where this stands, so its helpful to record it. The behaviour of having a heterogeneous resource delivered if Accept: is not specified (or is / like browsers tend to do) means either:
the other piece of information available is the client. But really the correct mechanism is for clients to set the Accept: header if they care what form the resource is accessed in - is there really a strong enough reason not to do this? If there are common code libraries that are poorly behaved, can they be fixed before we hack behaviours on the server side? If the issue is simple display of the canonical form - then I see no reason we can't add a special property to link to canonical representation and show that if present in a box in the HTML view. I've added a new label "UseCaseNeeded" for these types of questions that need wider discussion before action. |
@rob-metalinkage Speaking for our OGC API - Tiles use case for the TileMatrixSets registry:
|
I think, we should not force the definition server (or any server) into supporting a "default representation" for resources. As RFC 7231 says: "A request without any Accept header field implies that the user agent will accept any media type in response." In Features we had a discussion about this and decided to stick to the HTTP rules. I think the definition server is no different. |
Agree with @cportele - adding local rules is a downward spiral |
@cportele OK, so this means that clients expecting a JSON representation must ensure to include an |
@jerstlouis - No OGC API standard (that I know) suggests that JSON should be a default encoding. And we should not create an expectation that servers will provide a certain default encoding. This is even more the case in the definition server where some SWG may prefer JSON as the "default" for their resources and others will prefer Turtle, etc. |
Suggestion - a few things we can try without creating too much special case logic in the server.. |
@rob-metalinkage The "default encoding" is not so important, as @cportele points out. My suggestion was just to select such a default encoding based on the SWG's preferred encoding for their resources, without creating an expectation. But the essence of this issue is that right now even with a request for the canonical URL, a 303 is being returned with no content instead of a 200 with the actual definition in whichever media type is negotiated. Any representations supporting links could include links to alternate representations in the response body, as well as in the response header. For the TileMatrixSets use case at least we would very much like the actual definition to be returned as a 200 in the body of the response. |
All, please remember that the Definitions Server is intended to enable discovery of definitions, management of the definitions and access to those definitions. We use SKOS because it facilitates all three of these functions. Once discovered, client applications can then request their domain-specific encodings. |
@ghobona @rob-metalinkage Does that invalidate the use of the canonical URI as the request URL for getting back the actual definition of a TileMatrixSet response as I thought we had agreed that this would be possible as part of discussion relating to those URIs (e.g. opengeospatial/ogcapi-tiles#47 ). If it is not possible then we should certainly always require a However I would find that extremely impractical that the definition server cannot directly return the actual definition (personal opinion). But it already does return an actual definition e.g. for CRS: http://www.opengis.net/def/crs/OGC/0/UnixTime So I don't believe this is the case? This returns a 200 with an XML definition, as expected! |
Actual definitions can be returned through Content Negotiation. @rob-metalinkage explained this earlier in this thread. See #109 (comment) The approach of retrieving GML-encoded CRS definitions from the canonical URIs is legacy and will be changed eventually when resources permit. There is actually a request from another OGC member to return the CRS definitions in WKT CRS, which is also an OGC standard. This highlights the need for a default encodings to facilitate discovery, and Content Negotiation to enable access to other encodings. |
@ghobona yes I fully agree Content Negotiation to enable access to other encodings, and a preferred encoding is all great. However I am confused by: So maybe the issue is just that returning the definition is not yet implemented for TileMatrixSets, and Content Negotiation to support multiple types is a feature to be implemented. |
so the task is to work out how to get from: http://www.opengis.net/def/tilematrixset/OGC/1.0/WebMercatorQuad to http://schemas.opengis.net/tms/1.0/xml/examples/WebMercatorQuad.xml when XML is asked for I think I can write a special view that can be used for all cases - that inspects the data and generates a response as a proxy (200 response - after the 303 to the script) - thats why 200 is not an option - it breaks HTTP protocol architecture to deny using redirects appropriately |
@rob-metalinkage In my opinion, the real resource for the TileMatrixSet definition is its canonical URI, and it may support multiple representations (using content negotiation). Therefore returning a 303 for Just like http://www.opengis.net/def/crs/EPSG/0/4326 is the real resource for the EPSG:4326 definition. In my opinion an If the definition server uses a script / proxy internally to populate the response from a directory containing definitions in multiple encodings somewhere that is great, but that should not be visible to the client. It should also be possible to add new definitions without updating the (TileMatrixSet 1.0/2.0) standard itself. |
AFAIK the issue here is that http://www.opengis.net/def/ is a redirection service. |
@dr-shorthair Is it a redirection service or a definition service? For the TileMatrixSets register, it is a definition service that we need, just like I believe is also the case for CRSes. |
you are correct that http://www.opengis.net/def/crs/EPSG/0/4326 does not redirect. That's a bug in the legacy system before the definitions server gets involved - it should be redirecting not proxying remote content. Thats a bug because it means we can never offer anything but the particular representation, and there is already a plan to improve the CRS definitions offering with more flexible representation options. "definition" does not imply "only canonical form of definition" - the design is to use the standard HTTP protocol to support delivering definitions in the multiple forms potentially needed. We do need to do a lot more work to flesh out availability of canonical forms in particular. for example, for the definition of a conceptual data model element there are many possible valid forms see the "best form" is likely to change over time for many things - so explicit options with redirects is the one pattern that will keep on working. |
I don't understand this. Content negotiation with the e.g. the following cURL commands both return a 200 definition of the WebMercatorQuad TMS, in JSON or HTML representations: curl -i -H "Accept: application/json" https://maps.ecere.com/ogcapi/tileMatrixSets/WebMercatorQuad curl -i -H "Accept: text/html" https://maps.ecere.com/ogcapi/tileMatrixSets/WebMercatorQuad and we could add support for XML as well. Re-direction is not required to return multiple representation of a definition, and in my opinion re-direction severely hampers the definitions server's usefulness.
If an explicit media type is requested, that should keep on working as well. @joanma747 please share your opinion on this topic. |
Forcing 200 as the only possible response has the following drawbacks, any of which is sufficient to rethink that:
I'd start with 6 if you want to develop a change proposal. |
About 2, I am hoping negotiation by profile (opengeospatial/ogcapi-common#8) would support multiple information models per encoding. About 3, in the many contexts where the resource provider is the OGC Naming Authority itself, does that still apply? About 6, I will try to better re-phrase my concerns as actual problem statements:
Thank you for considering these suggestions. |
Thanks Jerome. 2 - yes - content negotiation by profile does apply there to provide a canonical mechanism for discovery and reporting what forms are available 3 - We already have externally hosted content and plans to interlink across other definition domains (ISO) etc., so its important not to assume proxying is safe. This may be relaxed in future but at the moment that landscape is still emerging and its hard to say. the other points come down to the actual requirements:
Apropos the latter (this is getting to be a long logic chain I realise) the data currently available at does have a set of rdfs:seeAlso links to XML If the SWG wants to ask for an update to this, then happy to help. Do you want me to generate a straw man for an improved representation of that linkage and a for how we can redirect to the XML automatically if XML is requested? I would be willing to bring that suggestion to the NamingAuthority for sign-off and implement if everyone is happy. |
Thank you @rob-metalinkage
The JSON definition that is really needed is an actual TileMatrixSet definition, corresponding to the XML one, like e.g. http://schemas.opengis.net/tms/1.0/json/examples/WebMercatorQuad.json . The TTL does not contain an actual TMS definition, and I don't know if you meant a JSON equivalent of that TTL there which just provides links.
It is correct that the bigger problem is that it redirects to Turtle rather than the actual JSON or XML definition. I assumed those URIs to be the actual authoritative resources for those TileMatrixSets. Maybe the SWG needs to set up another online directory not attached to a particular version of the standard (and not identified as examples), which would be the authoritative home of the TileMatrixSets register. But then couldn't we just bypass the redirecting definition server and use that directly as the URIs for TileMatrixSets (assuming it also supported content negotiation)?
With OGC API - Tiles, the JSON representation is becoming a lot more important than the XML, but we still have both XML & JSON encodings. The latest versions of both encodings for the defined TileMatrixSets are at: But the UTM one (UTM31WGS84Quad.xml) is an example from the UTM family for Zone 31, and should be expanded to one for each of the 60 UTM zones (that might require some considerable effort from the SWG). So there are currently 69 registered TileMatrixSets. (I am arguing that WGS1984Quad.json and WorldCRS84Quad.json are equivalent and only the latter should be registered). The encodings for 2DTMS 2.0 standard are not yet completely finalized, so it might be best to wait a few more weeks before doing any updates. If the definition server is going to simply redirect somewhere as opposed to host the content directly, we probably need a better place than the versioned standard schema examples as the authoritative location of registered tile matrix sets. Something that does not depend on releasing a new version of the standard to register new tile matrix sets. Where should that be and how should that be managed? A directory on the GitHub repo? Somewhere on opengis.net (e.g. https://schemas.opengis.net/tms/registry ?) Where will CRS be redirected to if the plan is to make them redirect as well? Thank you! |
What is fundamental for us is that we are able to get the description of a TileMatrixSet form the NA directly in a single URL. So we do not want to get a RDF representation of the concept. We would like to get the actual definition of the TileMatrixSet directly: exactly what we get from http://schemas.opengis.net/tms/1.0/xml/examples/WebMercatorQuad.xml Is that possible now? If we have to add a parameter to the URL that should not a problem. Example: |
OK - I will experiment with setting up an example redirection rule. Looking at the ttl file, i see some only have JSON, some only have XML. It would be simpler if they all had both JSON and XML. I see they both seem to be present at http://schemas.opengis.net/tms/1.0/json/examples/ - so is it ok to offer both? I think it would be ok to override a default JSON view of the RDF content (SKOS) with the specific JSON as the JSON encoding of the SKOS profile is always available. This is the first case for this so probably needs a policy decision to do this. http://www.opengis.net/spec/tilematrixset/1.0/conf/xml-tilematrixset2d (and I would generate a formal RDF profile definition for this - we are currently looking at specs to do this systematically but didnt expect this Use Case to be so immediately needed - lets prioritise TMS :-) ) if there is a great deal of variance and its something that will need updating I'll need to explore either: |
Actually I'll need a little bit more input on how the various conformance classes map to the various examples please.. i see there are a few different options.. |
OK folks - I've implemented a little experiment On defs-dev I've set up custom rules.. http://defs-dev.opengis.net/def/tilematrixset/OGC/1.0/WebMercatorQuad?_profile=alt that explicitly list options but I've also set up a default option if no profile is specified and json or xml is requested. curl -i -H "Accept:application/json" http://defs-dev.opengis.net/def/tilematrixset/OGC/1.0/WebMercatorQuad I think I should probably make the alts view provide some more detail about availability of default profiles for different encodings - thats a bit of trickier back-end coding - if it this is to be a supported policy I'll add it to the development backlog. |
Of course - I havent yet worked out how to handle for different versions too - but should be possible with some regex cleverness and another set of rules. |
Finally - if you are happy with this option would you be prepared to bring it to the NamingAuthority as a proposal (and provide some feedback about the ability and willingness to support emerging needs :-) ) |
This is a "accident". All will be available in JSON and XML so it will be symetrical.
Works for me!. Thanks! |
@joanma747 If it is decided that the definition server can only do 303 redirection, where should it redirect to? An |
For the (not yet published) latest version: There are two conceptual conformance classes: http://www.opengis.net/spec/tms/2.0/req/tilematrixset2d -- which is the basic TileMatrixSet In the examples, only two Tile Matrix Sets use the variable width capability: Then there are corresponding per-encoding conformance classes:
There are currently 11 examples on the GitHub repo, but as I mentioned the UTM one should eventually be expanded into 60 separate TileMatrixSets, and the WorldCRS84Quad and WGS1984Quad should probably both share the WorldCRS84Quad URI. All should have both JSON and XML encodings. These are the schemas for the XML and JSON encodings (including support for variable widths) Also if possible, we would prefer the JSON representation to be selected by default. XML is dead, long live JSON ;) |
I've also doing some work to make sure that ConceptSchemes offer the full entailed SKOS versions as TTL and RDF now (they were minimal metadata for the ConceptScheme root object before - now it is the full contents. ) list at https://www.opengis.net/def/status?_profile=alt (still yet to work out how to distinguish longer paths from terms without having to access the data at runtime to do the redirect) |
The PR #127 adds a section describing the role of Content Negotiation. |
This is our suggestion for offering the TMS "files" to the NA to harvest: |
The Tiles SWG has set up a TileMatrixSet registry holding all definitions of registered TileMatrixSet at https://github.com/opengeospatial/2D-Tile-Matrix-Set/tree/master/registry/, including both JSON and XML encodings, with the intent that the OGC definition server could return the content of those definitions directly based on content negotiation. Note that these follow the logical model and encodings defined in 2DTMS 2.0. |
Re-iterating the use case: Re-direction for the TileMatrixSet registry is problematic for several reasons:
|
the citation behaviour is something to consider. the UI does provide a too-subtle link to the canonical URI - we will be building a citation support widget to replace this. the other reasons dont seem to add up however: if there is nowhere to redirect to, there is no content to proxy either |
Content disposition requirements addressed in #203. Leave this issue for any further discussion about redirection behaviours - but closing it for now as the content access needs to be addressed instead. |
Not necessarily, if the idea is that the OGC definition server hosts the content directly in its database, while groups such as the Tiles SWG can provide that content to load (through the GitHub repository TileMatrixSet registry). Is that what #203 will be about?
I beg to differ :) The
Yes, but I am trying to highlight the fact that re-direction introduces extra pain (e.g., figuring out that
It is not only about the subtlety / visibility of the canonical URI, but about a very strong expectation from users of the definition server that the only valid reason for the URI pasted in the browser address bar to change is to correct it to the canonical one. |
When text/html or a specific format is not requested in the
Accept:
header, the common definition of the resource (e.g. JSON, GML) should be returned.In particular this is desired for registered TileMatrixSets, there the JSON object would be returned.
This would make it practical for clients, rather being hidden behind a "See also" link.
The text was updated successfully, but these errors were encountered: