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

Incorrect transformation of IRIs with a document fragment #5

Open
markwilkinson opened this issue Nov 7, 2023 · 2 comments
Open

Incorrect transformation of IRIs with a document fragment #5

markwilkinson opened this issue Nov 7, 2023 · 2 comments

Comments

@markwilkinson
Copy link

markwilkinson commented Nov 7, 2023

Hi Guys!

I'm seeing a transformation problem, and I've dropped the problem down as simple as I can.

csv:

org_id
http://www.bancodegermoplasma.upm.es

yarrrml1:

    - objects:
        type: iri
        value: $(org_id)
      predicate: prov:wasAssociatedWith

yarrrml2:

    - objects:
        type: iri
        value: $(org_id)#Organization
      predicate: prov:wasAssociatedWith

yarrrml1 results in: <http://www.bancodegermoplasma.upm.es> (correct!)

yarrrml2 results in: <nullhttp%3A%2F%2Fwww.bancodegermoplasma.upm.es#Organization> (OH NO!)

This happens also when the entity is in the subject position.

Not sure where in the process things go wrong, but... it's definitely wrong ;-)

Cheers!

@ghsnd
Copy link
Contributor

ghsnd commented Nov 8, 2023

Hi Mark,

You're right, this is not what one would expect. It is a known issue in the RML language, to which YARRRML is parsed before actually executing the rules.

What happens is this: when you use just $(org_id) as value, it is seen as a reference to the org_id field in your CSV input and it just literally takes the values in that field. However, if you add #Organization, it is considered a template, because there is no field org_id#Organization in the CSV. And in the current version of RML, templates are IRI-encoded when the type is iri.

There is a dirty workaround using a function to assemble the IRI you want:

prefixes:
 idlab-fn: "http://example.com/idlab/function/"
...
        objects:
          - function : idlab-fn:concat
            parameters: 
              - [idlab-fn:str, $(org_id)]
              - [idlab-fn:otherStr, 'Organization']
              - [idlab-fn:delimiter, '#']
            type: iri

Hope this helps...

Best regards,
Gerald

@markwilkinson
Copy link
Author

that is very helpful, thank you!

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

No branches or pull requests

2 participants