semantifyit / RocketRML

https://semantify.it
Creative Commons Attribution Share Alike 4.0 International
25 stars 12 forks source link

termType rr:IRI in subjectMap #18

Open simeonackermann opened 3 years ago

simeonackermann commented 3 years ago

I'm trying to apply a YARRRML Condition in the subject. It should only create a subject on a specific condition, but the parser throws an ??? error from input-parser/parser.js. It seems the termType rr:IRI in subjectMaps are not (yet) supported?!

An example mapping to reproduce this error is:

prefixes:
  schema: "http://schema.org/"
  fn: "http://example.com/"
mappings:
  person:
    sources:
      - ['input~jsonpath', '$.persons[*]']
    s: http://example.com/$(firstname)
    condition:
      function: fn:isSet
      parameters:
        - [fn:input, $(public)]
    po:
      - [a, schema:Person]

Is there another way to apply conditions on subject generation?

ThibaultGerrier commented 3 years ago

Hello Unfortunately yarrrml conditions are currently not supported. In RML they transform to nested functions, which aren't supported. Only yarrrml join-conditions are supported (since they are a special condition case)

If the only condition you need is to check if a field is set you can use the json-path filter feature (see https://www.npmjs.com/package/jsonpath-plus for json-path examples)

With your current mapping:

prefixes:
  schema: "http://schema.org/"
  fn: "http://example.com/"
mappings:
  person:
    sources:
      - ['input~jsonpath', '$.persons[?(@.public)]']
    s: http://example.com/$(firstname)
    po:
      - [a, schema:Person]

will only process the persons where the public field is truthy. (so skip any persons with "public": false or without any public field)

simeonackermann commented 3 years ago

Ok thanks, its not that clear like YARRRML subject conditions, but it will solve may problem. Thanks again for your time and solution!!

Are their plans to implement nested functions? Does it make sense to leave this issue open?