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

Nested functions in condition don't use referencingObjectMaps #68

Closed
bjdmeest opened this issue Apr 16, 2020 · 3 comments
Closed

Nested functions in condition don't use referencingObjectMaps #68

bjdmeest opened this issue Apr 16, 2020 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@bjdmeest
Copy link
Collaborator

bjdmeest commented Apr 16, 2020

Issue type: 🐛 Bug

Description

The following YARRRML code doesn't use referencingObjectMaps in the nested functions

prefixes:
  ex: http://example.com#
  grel: http://users.ugent.be/~bjdmeest/function/grel.ttl#
  idlab-fn: "http://example.com/idlab/function/"

mappings:
  myMapping:
    sources:
      - ["data.csv~csv"]
    s: ex:$(ID)
    po:
      - [a, ex:Person]
      - [ex:label, $(name)]
      - p: ex:isFriendsWith
        o:
          - mapping: myOtherMapping
            condition:
              function: grel:boolean_and
              parameters:
                - parameter: grel:param_rep_b
                  value:
                    function: idlab-fn:equal
                    parameters:
                      - [grel:valueParameter, "$(otherID)", s]
                      - [grel:valueParameter2, "$(friendID)", o]
                - parameter: grel:param_rep_b
                  value:
                    mapping: myOtherMapping
                    function: idlab-fn:equal
                    parameters:
                      - [grel:valueParameter, "$(name)", s]
                      - [grel:valueParameter2, "$(friendName)", o]
  myOtherMapping:
    sources:
      - ["data2.csv~csv"]
    s: http://example.com#heroes_$(ID)
    po:
      - [a, ex:Hero]
      - [ex:label, $(name)]

Steps

Trying to execute the parsed RML makes the RMLMapper error Cannot find friendID in data.csv

Environment

Matey

@pheyvaer
Copy link
Collaborator

pheyvaer commented Apr 17, 2020

What exactly is the issue? Could you provide the expected RML?

I get this with the parser

:om_5 a rr:ObjectMap;
    rml:parentTermMap :ptm_0.
:ptm_0 rml:reference "friendID".

which seems correct. So could this a bug in the RMLMapper?

@bjdmeest
Copy link
Collaborator Author

I guess if it means that rr:parentTriplesMap is inherited in nested functions, then yes, it's a bug in the RMLMapper :). In any case, I guess the mapper shouldn't try its own logicalsource if it cannot find the parenttriplesmap's source.. Made an RMLMapper-java issue! RMLio/rmlmapper-java#53

@bjdmeest
Copy link
Collaborator Author

For completeness: this very specific use case is in fact a non issue. Conforming to R2RML, if you specify multiple conditions on one join condition, they are de facto assumed to be conjunctive (i.e., an AND operator), see https://www.w3.org/TR/r2rml/#dfn-joint-sql-query : you can have multiple join conditions.

So this very specific use case could be rephrased into the following, excluding the need for boolean_and, and thus you have no issue. but beware because this would not work for other kinds of compositions (eg boolean_or):

prefixes:
  ex: http://example.com#
  grel: http://users.ugent.be/~bjdmeest/function/grel.ttl#
  idlab-fn: "http://example.com/idlab/function/"

mappings:
  myMapping:
    sources:
      - ["data.csv~csv"]
    s: ex:$(ID)
    po:
      - [a, ex:Person]
      - [ex:label, $(name)]
      - p: ex:isFriendsWith
        o:
          - mapping: myOtherMapping
            condition:
              - function: idlab-fn:equal
                parameters:
                  - [grel:valueParameter, "$(otherID)", s]
                  - [grel:valueParameter2, "$(friendID)", o]
              - function: idlab-fn:equal
                parameters:
                  - [grel:valueParameter, "$(name)", s]
                  - [grel:valueParameter2, "$(friendName)", o]
  myOtherMapping:
    sources:
      - ["data2.csv~csv"]
    s: http://example.com#heroes_$(ID)
    po:
      - [a, ex:Hero]
      - [ex:label, $(name)]

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

2 participants