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

Create a new dynamic route for ontologies content derefrencement #545

Closed
4 tasks
Tracked by #476
syphax-bouazzouni opened this issue Mar 19, 2024 · 4 comments · Fixed by #568
Closed
4 tasks
Tracked by #476

Create a new dynamic route for ontologies content derefrencement #545

syphax-bouazzouni opened this issue Mar 19, 2024 · 4 comments · Fixed by #568
Assignees
Labels
enhancement New feature or request

Comments

@syphax-bouazzouni
Copy link
Collaborator

syphax-bouazzouni commented Mar 19, 2024

Context

See agroportal/project-management#476

Goal

Have a human-readable URL/URI for users to access ontologies content in Agroportal, e.g https://agroportal.lirmm.fr/ontologies/INRAETHES/d_1 that will redirect to https://agroportal.lirmm.fr/ontologies/INRAETHES?p=classes&conceptid=http://opendata.inrae.fr/thesaurusINRAE/d_1

Requirements

  • Add a dynamic route in the routes.rb file to match get "ontologies/:acronym/:id" and redirect to a new ontologies controller action called for example show_redirection
  • In this new controller action if the :acronym does not exist return not found
  • If the :id is not a URL, create a function that will find the full URL, using one of these methods:
    - use the indexed data, to URI that matches the given :id.
    - use the ontology metadata (URI, Identifier pattern, Preferred namespace URI) to deduce the full ID.
  • Once the full ID is found, get the id type from the index or triple store, and by the type redirect to the correct page, follow the bellow cases:
  def ontology_link_by_type(id, acronym, type)
    case type
    when 'Concept', 'Class'
      ontology_path(id: acronym, p: 'classes', conceptid: id)
    when 'Ontology'
      ontology_path(id: acronym, p: 'summary')
    when 'ConceptScheme'
      ontology_path(id: acronym, p: 'schemes', schemeid: id)
    when 'Collection'
      ontology_path(id: acronym, p: 'collections', collectionid: id)
    when 'NamedIndividual'
      ontology_path(id: acronym, p: 'instances', instanceid: id)
    when 'AnnotationProperty', 'ObjectProperty', 'DatatypeProperty'
      ontology_path(id: acronym, p: 'properties', propertyid: id)
    else
      # link to content find a tool, something like this  "/content_finder?acronym=#{acronym}&uri=#{id)}&output_format=xml"
    end
  end 

Below is a diagram summarizing the process
image

@syphax-bouazzouni
Copy link
Collaborator Author

@imadbourouche , Important to note that the redirection needs to be content negotiable also, so if we as XML don't show the Agroportal UI and directly redirect the XML content returned by the back.

@imadbourouche
Copy link
Member

imadbourouche commented Apr 9, 2024

@imadbourouche , Important to note that the redirection needs to be content negotiable also, so if we as XML don't show the Agroportal UI and directly redirect the XML content returned by the back.

@syphax-bouazzouni , if we specify the accept format (json, ntriples, turtle, xml), the result will be the content of the resource in the format specified (it means that it will be no redirection to html page)
if the accept header is "text/html" we will redirect the user to Agrportal UI page for the resource

Am I correct in this ?

@syphax-bouazzouni
Copy link
Collaborator Author

@imadbourouche , Important to note that the redirection needs to be content negotiable also, so if we as XML don't show the Agroportal UI and directly redirect the XML content returned by the back.

@syphax-bouazzouni , if we specify the accept format (json, ntriples, turtle, xml), the result will be the content of the resource in the format specified (it means that it will be no redirection to html page) if the accept header is "text/html" we will redirect the user to Agrportal UI page for the resource

Am I correct in this ?

@imadbourouche yes, you are correct.

@syphax-bouazzouni
Copy link
Collaborator Author

Done in #568

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

Successfully merging a pull request may close this issue.

2 participants