Skip to content
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

Ogcapi records - better catalog objects #1

Open
wants to merge 19 commits into
base: origin_main
Choose a base branch
from

Conversation

davidblasby
Copy link
Owner

@davidblasby davidblasby commented Sep 17, 2024

This improves JSON output for the landing page (/), /collections, and /collections/<collectionid>.

In the output of these I inject the OGCAPI Records catalog.yaml object.

A GN Portal (full portal or sub-portal) is an OGCAPI Catalog.

  1. Getting info

This will retrieve the GN ServiceRecord that's linked to a GN Source DB row. This can be done in the GN GUI: Admin Console-Settings-sources for sub-portals.

There is no GUI to set this for the "main" portal - do this in GN GUI: Admin Console-Settings-Settings-Catalog Service for the Web (CSW)-Record to use for GetCapabilities (system/csw/capabilityRecordUuid).

Basically, this PR will retrieve this linked record via the Elastic Index (JSON). This is processed in GN via the index-utils.xsl.

If there isn't a linked service record, then the catalog details will not be added (i.e. unchanged from how GN ogcapi records used to work).

  1. New Model Objects

I have put in a bunch of new model objects - OgcApi*. These are 1:1 with the OGCAPI object model - defined in the spec as well as the .yaml files. I've copy-and-pasted in the documentation from the .yaml files for readability.

NOTE: I also moved the old Link object to OgcApiLink for consistency.

  1. Landing page (/)

The landing page JSON also includes a new property systemInfo which contains a catalog.yaml object in it.
I'm not sure if this is allowed in the spec, but it allows for more metadata about the entire GN system ("ogcapi-records" server). This is useful for making a nicer landing page (cf. pygeoapi's landing page).

  1. A few details

Most of the work is done in ElasticIndexJson2CollectionInfo - this converts the Elastic Index JSON object to the ogcapi catalog.yaml object. There's also a simple test case in ElasticIndexJson2CollectionInfoTest.

  1. Example

Underlying XML linked Service Record (xml)

9bac358b-11ec-4293-aeef-5a077b778412.txt

Elastic Index (JSON):

elastic-index-record.txt

OGCAPI catalog.yaml output (JSON):
ogcpai-catalog.json

@davidblasby davidblasby changed the title Ogcapi records Ogcapi records - better catalog objects Sep 17, 2024
.buildFromSource(source, language, requestBaseUrl,
configuration.getFormat(mediaType), configuration);
configuration.getFormat(mediaType), configuration,request);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
configuration.getFormat(mediaType), configuration,request);
configuration.getFormat(mediaType), configuration, request);

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank for the review, jose. I've run the code through an intellij reformat "cleanup". The first time I did this, it changed my javadocs and the checkstyle got very upset. However, I just re-ran it and it didn't make changes - all these types of problems should be fixed now.

@JsonProperty("systemInfo")
@JacksonXmlProperty(localName = "systemInfo")
@JsonInclude(Include.NON_EMPTY)
private CollectionInfo systemInfo;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't find this property in https://docs.ogc.org/is/17-069r3/17-069r3.html#_api_landing_page, is this a custom extension?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - I mentioned it, above, in the PR description. I've added java doc to make it more explicit in the code.

@JsonInclude(Include.NON_EMPTY)
@XmlElementWrapper(name = "href")
@XmlElement(name = "href")
private String href;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property is not defined in https://github.com/opengeospatial/ogcapi-records/blob/master/core/openapi/schemas/linkBase.yaml, but looks odd that is missing in the specification.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes - this looks like a mistake. I've put some comments in the code about this - and a link to another specification of link.

@@ -0,0 +1,42 @@
package org.fao.geonet.ogcapi.records.controller.model;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add file header

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done. NOTE: most of the files don't have the header.


public class JsonUtils {
/**
* todo - be language aware (send in desired language). Move to utility class.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a TODO. Is this required to be implemented?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its ok at the moment - I'll have to see if I can find some multi-lingual iso19193 files.

private List<String> crs = null;

/** A list of contacts qualified by their role(s) in association

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's missing recordLanguages, but not sure how relevant it is. See https://docs.ogc.org/DRAFTS/20-004.html#collection-properties-table

Copy link
Owner Author

@davidblasby davidblasby Sep 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add this. I also see that there are a few others in the written spec versus whats in the .yml. Thanks for noticing this. It was on my todo list of things to check.

Copy link
Owner Author

@davidblasby davidblasby Sep 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the extra objects - the "Schema" object is VERY VERY complex. I didn't fully include it (because of the pattern properties). I've left TODOs for when this is necessary (its not at the moment). I notice that pygeoapi seems to include this.

CollectionInfoBuilder collectionInfoBuilder;

@Autowired
RecordService recordService;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems not used.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@davidblasby
Copy link
Owner Author

Added some documentation - modelled off docs/ in GN core.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants