Skip to content

calling a function in p results in: po.predicates.forEach is not a function #216

@ssulyok

Description

@ssulyok

Issue type: 🐛 Bug

Description

when using a function for a predicate, parsing fails with error: TypeError: po.predicates.forEach is not a function

funnily enough, using this approach in subject or object works

Steps

using dummy data:

input data:

{
    "persons": [
        {
            "firstname": "John",
            "lastname": "Doe",
            "male": true
        },
        {
            "firstname": "Jane",
            "lastname": "Smith",
            "male": false
        },
        {
            "firstname": "Sarah",
            "lastname": "Bladinck",
            "male": false
        }
    ]
}
prefixes:
 ex: "http://example.com/"
 grel: "http://users.ugent.be/~bjdmeest/function/grel.ttl#"

mappings:
  person:
    sources:
      - ['data.json~jsonpath', '$.persons[*]']
    s: http://example.com/$(firstname)
    po:
      - [a, foaf:Person]
      - [ex:name, $(firstname)]
      - p:
          function: grel:controls_if
          parameters:
            - [ grel:bool_b, $(male) ]
            - [ grel:any_true, ex:notApplicable~iri ]
            - [ grel:any_false, ex:myTest~iri ]
        o:
          function: grel:controls_if
          parameters:
            - [ grel:bool_b, $(male) ]
            - [ grel:any_true, ex:myTest~iri ]
            - [ grel:any_false, "SHE IS FEMALE" ]

expected behaviour should be:

if male = true, the po pair should be mapped as ex:notApplicable ex:myTest
if male = false, the po pair should be mapped as ex:myTest "SHE IS FEMALE"

could be related to #206

Environment

Add the version of Java and OS that is used.
=====> Java17 - Windows - yarrrml-parser v.1.11.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions