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

Error translating functions in RML that contain join string

jatoledo opened this issue · comments

Error translating YARRRML to RML:
IndexError: list index out of range

Yarrrml mapping:

prefixes:
  idlab-fn: "http://example.com/idlab/function/"
  grel: "http://users.ugent.be/~bjdmeest/function/grel.ttl#"
  rdfs: "http://www.w3.org/2000/01/rdf-schema#"
  xsd: "http://www.w3.org/2001/XMLSchema#"
  ex: "http://example.org/"
sources:
  reminder-source: ['dataset/data.xml~xpath','/note']
mappings:
  reminder:
    sources:
      - reminder-source
    s:
      function: grel:array_join
      parameters:
        - [grel:p_array_a, "http://example/"]
        - parameter: grel:p_array_a
          value:
            function: grel:string_sha1
            parameters:
              - [ grel:valueParameter, "$(from)_$(to)" ]
    po:
      - [a, ex:Reminder]
      - [ex:hashText,"$(from)_$(to)"]

Hi,

I am also expriencing this issue. Additionally, does yatter parse YARRRML with functions into RML-FNML?
From the README.md I see RML-FNML is supported, but I do not know if it is also supported in the conversion of YARRRML (with FNML) into RML-FNML.

Thanks,
José Antonio

Hi @neobernad,
The issue will be solved in the next release! In principle we support YARRRML with functions to RML-FNML, but if you have any problem please open an issue! You can see test cases here: https://github.com/oeg-upm/yatter/tree/main/test/rml-fnml

Hi @dachafra,

Thank you for your quick response. Happy to hear that out! :-)

Best,
José Antonio

Hi @neobernad @jatoledo
The issue is solved in the source code, if you want to use it, please install the engine from src! I'll make a release soon with more updates.

btw, remember that in yatter you can specify the join conditions in a shortcut way:

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

mappings:
  student2:
    sources:
      - [ 'student.csv~csv' ]
    s: http://example.com/$(Name)
    po:
      - p: foaf:name
        o:
          - function: join (mapping1, equal($(val1),$(val2)), equal($(val1),$(val2)))
          - function: join (mapping1, equal($(val1),$(val2)))
      - p: foaf:surname
        o:
          - function: join(mapping2, equal($(val1),$(val2)))

  mapping1:
    sources:
      - [ 'student.csv~csv' ]
    s: http://example.com/$(Name)

  mapping2:
    sources:
      - [ 'student.csv~csv' ]
    s: http://example.com/$(surname)

Hi @dachafra,

Sorry for commenting in a closed issue, I do not know if I should open a new one as it is still an issue regarding the YARRRML translation.

I have the following YARRRML file (actually it is longer and I have anonymized it):

prefixes:
  ds_data: https://example.com/data/MyData/
  ds_property: https://example.com/MyProperty/
  rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
  rdfs: http://www.w3.org/2000/01/rdf-schema#
  grel: http://users.ugent.be/~bjdmeest/function/grel.ttl#
  morph-kgc: https://github.com/morph-kgc/morph-kgc/function/built-in.ttl#

sources:
  MyDataSource:
    - data.xlsx

mappings:
  PersonMappings:
    sources: MyDataSource

    s: ds_data:$(person_name)
    po:
      - [rdf:type, ds_property:Person]
      - [rdfs:label, $(person_name), xsd:string]

The execution of the translation of the file above raises an exception ERROR: The YARRRML mapping has not been translated:

yaml = YAML(typ='safe', pure=True)
rml_content = yatter.translate(yaml.load(open("mappings.yml")))

Here, rml_content is None.

What could be wrong? After having a quick look debugging yatter, it seems that the YARRRML file is being properly opened and parsed, but something in the translate or get_non_asserted_mappings methods is not liking the structure of the mappings perhaps?

Thanks,
José Antonio

Please, can you open a new issue so I can maintain a proper tracing of everything? Thanks! I'll take a look right now, in any case