ontoportal-lirmm / goo

Graph Oriented Objects (GOO) for Ruby. A RDF/SPARQL based ORM.
http://ncbo.github.io/goo/
Other
0 stars 4 forks source link

implement yml scheme integration for Goo models #29

Closed syphax-bouazzouni closed 1 year ago

syphax-bouazzouni commented 1 year ago

Context

Currently, when we want to add metadata to a model attribute (e.g description, helpText, label), we need to put them directly in the code.

Which overloads the code and makes it hard to read it and figure out the logic behind

For example, the attribute natrualLanguage of submissions, is currently so

    attribute :naturalLanguage, namespace: :omv, enforce: [:list], extractedMetadata: true,
                metadataMappings: ["dc:language", "dct:language", "doap:language", "schema:inLanguage"],
                helpText: "The language of the content of the ontology.<br>Consider using a <a target="_blank" href="http://www.lexvo.org/">Lexvo URI</a> with ISO639-3 code.<br>e.g.: http://lexvo.org/id/iso639-3/eng",
                enforcedValues: {
                  "http://lexvo.org/id/iso639-3/eng" => "English",
                  "http://lexvo.org/id/iso639-3/fra" => "French",
                  "http://lexvo.org/id/iso639-3/spa" => "Spanish",
                  "http://lexvo.org/id/iso639-3/por" => "Portuguese",
                  "http://lexvo.org/id/iso639-3/ita" => "Italian",
                  "http://lexvo.org/id/iso639-3/deu" => "German"
                }

Gaol

The goal is to extract the metadata fields in a YAML file, that will present the scheme of a model.

So that in the code we have


     model :ontology_submission,  scheme: 'path to yaml file'

    attribute :naturalLanguage, namespace: :omv, enforce: [:list],  extractedMetadata: true,

and in the YAML file, we will have the following

naturalLanguage:
     metadataMappings: ["dc:language", "dct:language", "dop:language", "schema:inLanguage"]
     helpText: "The language of the content of the ontology.<br>Consider using a <a target="_blank" href="http://www.lexvo.org/">Lexvo URI</a> with ISO639-3 code.<br>e.g.: http://lexvo.org/id/iso639-3/eng"
     enforcedValues: {
        "http://lexvo.org/id/iso639-3/eng": "English",
        "http://lexvo.org/id/iso639-3/fra": "French",
        "http://lexvo.org/id/iso639-3/spa": "Spanish",
        "http://lexvo.org/id/iso639-3/por": "Portuguese",
        "http://lexvo.org/id/iso639-3/ita": "Italian",
        "http://lexvo.org/id/iso639-3/deu": "German",
     }

Requirement

syphax-bouazzouni commented 1 year ago

Done with https://github.com/ontoportal-lirmm/goo/pull/30