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

Error translating functions in RML that contain join string #77

Closed
jatoledo opened this issue Feb 1, 2024 · 7 comments
Closed

Error translating functions in RML that contain join string #77

jatoledo opened this issue Feb 1, 2024 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@jatoledo
Copy link

jatoledo commented Feb 1, 2024

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)"]
@dachafra dachafra added the bug Something isn't working label Feb 1, 2024
@neobernad
Copy link

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

@dachafra
Copy link
Member

dachafra commented Feb 14, 2024

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

@neobernad
Copy link

Hi @dachafra,

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

Best,
José Antonio

dachafra added a commit that referenced this issue Feb 15, 2024
@dachafra
Copy link
Member

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.

@dachafra dachafra changed the title Error translating YARRRML to RML Error translating functions in RML that contain join string Feb 15, 2024
@dachafra
Copy link
Member

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)

@neobernad
Copy link

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

@dachafra
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants