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

CVOC 9276 Initializing integration of ontoportal #10145

Conversation

luddaniel
Copy link
Contributor

@luddaniel luddaniel commented Nov 27, 2023

What this PR does / why we need it:

The PR is set as draft as it's a first part of a long development and discussion with Dataverse members.

This PR is the result of tests, work on a Proof of Concept to support Agroportal (one instance of Ontoportal).
The goal was to try to implement Ontoportal using Ontoportal API + apikey (required by Ontoportal API Endpoints) starting from skosmos.js and cvoc-conf.json.
We decided to try to hide as possible the apikey and share not API but rather UI Urls for keywordTermURL and keywordVocabularyURI.

This PR adds some external controlled vocabulary configuration options in order to support ontoportal service.
Options are :

  • cvoc-ui-url a url of human interface where cvoc-url is the api url
  • headers that allows to add some headers required by the cvoc-url, in Ontoportal case the apikey.

headers option may not be enough on security matter, an idea is to have a proxy application that is used just to hide the apikey (as a java http request with apikey in header cannot be seen).
For example : cvoc-url=https://demo.dataverse.org/ontoportal_proxy that will request API enpoints of https://data.agroportal.lirmm.fr. Such a proxy must handle good CORS parameters.

Which issue(s) this PR closes:

Starts developments for #9276

Suggestions on how to test this:

Here are the files that have been used to make it work under develop branch :

Demo:

agroportal_demo.mp4

Other informations:

@DS-INRA will reach out soon to ask for a meeting
PR description will be improved every time possible.

…cabulary configuration options in order to support ontoportal service
@coveralls
Copy link

coveralls commented Nov 27, 2023

Coverage Status

coverage: 20.138% (+0.1%) from 20.007%
when pulling 2fc3fd2 on Recherche-Data-Gouv:9276-init-ontoportal-integration
into 410eb45 on IQSS:develop.

@luddaniel luddaniel changed the title WIP: CVOC 9276 Initializing integration of ontoportal CVOC 9276 Initializing integration of ontoportal Nov 28, 2023
}

if(cvocUiUrl != null) {
term = term.replace(cvocUiUrl, cvocUrl);
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason the script couldn't use the correct term? It could still get the Ui form for display/front-end query purposes.

…es function to work with double parameters of ontoportal retrievalUri
@@ -466,6 +496,11 @@ public void registerExternalTerm(JsonObject cvocEntry, String term) {
}
}
}

if(isOntoportal) {
isExternal = true;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's POC do not keep it. won't work with free text

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A workaround would be to use https:// as uriSpace

if (headers == null) {
headers = Json.createObjectBuilder().build();
}

boolean isExternal = false;
JsonObject vocabs = cvocEntry.getJsonObject("vocabs");
for (String key: vocabs.keySet()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fix it with && allow-free-text == false

logger.fine("protocol:"+ cvocEntry.getString("protocol"));
String[] values = new String[2];
values[0] = dfv.getValue();
if("ontoportal".equals(cvocEntry.getString("protocol"))) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here, we want for all protocol to just share managed-fields and have a way to do it better using java

Copy link
Contributor Author

Choose a reason for hiding this comment

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

condition could be if retrievalUri has more than {0} search for the the fields that are named ex: {vocabularyName}/classes/{term-uri-field}

Copy link
Member

Choose a reason for hiding this comment

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

FWIW: This appears to work for me to get the values for the other child fields with the same parent:

            if(dft.getParentDatasetFieldType()!=null) {
                logger.info("Parent is " + dft.getParentDatasetFieldType().getName());
                for(DatasetField dfc: df.getParentDatasetFieldCompoundValue().getChildDatasetFields()) {
                    logger.info("Found value: " + dfc.getValue());
                }
            }

Does that do what you need (along with checking the fdc.getDatasetFieldType to be able to match against the type name)?

@luddaniel
Copy link
Contributor Author

Following the call on Google group discussion "Controlled Vocabularies : Integrate Ontoportal as a new supported third-party vocabulary service"; All the work around Ontoportal integration will be handled with small PRs of generic code (closing this POC).
Two PR has been made for now :

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Size: 10 A percentage of a sprint. 7 hours.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants