oeg-upm / yatter

Translate YARRRML into easy-to-read [R2]RML mappings

Home Page:https://doi.org/10.5281/zenodo.7024500

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for labels and comments

costezki opened this issue · comments

It would be very useful to support RDFS lexicalisation or SKOs lexicalisation.

We need to leave editorial comments and label mappings with references to "fields in a conceptual model".
In RML/RDF is done like this:

tedm:AdditionalOrganisation a rr:TripleMap ;
    rr:subjectMap
        [
            rr:template "http://data.europa.eu/a4g/resource/AdditionalOrganisation/{replace(replace(/TED_EXPORT/CODED_DATA_SECTION/NOTICE_DATA/NO_DOC_OJS, ' ', '-' ), '/' , '-')}/{unparsed-text('https://digest-api.ted-data.eu/api/v1/hashing/fn/uuid/' || encode-for-uri(path()) || '?response_type=raw')}" ;
            rr:class org:Organization

        ] ;
    rml:logicalSource
    [
        rml:source "data/source.xml" ;
        rml:iterator "/TED_EXPORT/FORM_SECTION/F06_2014/CONTRACTING_BODY/ADDRESS_CONTRACTING_BODY_ADDITIONAL" ;
        rml:referenceFormulation ql:XPath
    ] ;
    rr:predicateObjectMap
        [
            rr:predicate epo:hasLegalName ;
            rr:objectMap
                [
                    rdfs:label "I.1.1	Official name	(BT-500	Organisation Name)" ;
                    rdfs:comment "This is a language dependent mapping. The way to access it is specific to each Form as it depends on the Root element." ;
                    rml:reference "OFFICIALNAME";
                    rml:languageMap [
                         rml:reference "lower-case(ancestor::F06_2014/@LG)"
                    ]
                ] ;
        ] .

So, my suggestion for this would be something like (cc @anaigmo @andimou):

prefixes:
  foaf: http://xmlns.com/foaf/0.1/

mappings:
  AdditionalOrganisation:
    sources:
      - ['data.xml~XPath', '/Iterator']
    s: http://data.europa.eu/a4g/resource/AdditionalOrganisation/$(PATH_EXPRESION)
    po:
      - [epo:hasLegalName, $(OFFICIALNAME), $(lower-case(ancestor::F06_2014/@LG))~lang] # TITLE: I.1.1 [..] | COMMENT: This is a language [...]

Supporting this feature would require a refractor of the whole code to support the parsing of the YAML file with the structure prosed by Ruamel.yaml instead of primitive Python structures.

Before implementing it, pros&cons must be analyzed to avoid dependence on a specific lib.

Considering this is not "a must" right now, I would suggest not including it in the v1.0

Are there any updates on whether this feature will be implemented and if yes, when can we expect the update?

Hi @Schabalabab,
It will be incorporated in the v2.0 of the engine, hopefully at the end of this month :-)

@costezki what is the main difference between the use of Label and Comment in the mapping? We would like to know what is the reason for using Label here, as it seems that it's not describing the mapping but describing the data which is coming from the reference value.

Indeed, it describes the business field corresponding to the mapping source.
The comment may extend that or may be anything else (such an editorial note).
However used, documenting technical constructs have never been a bad practice and is worth supporting.