graphs only work on array notation (cfr. tutorial example)
wouterbeek opened this issue ยท 4 comments
Issue type: ๐ Bug
The example on https://rml.io/yarrrml/tutorial/getting-started/#complete-yarrrml-document does not work.
Description
When I run this tool using the example documented on the above shared link, the following error message is emitted:
TypeError: mapping.graphs.forEach is not a function
at expandTargetsInMapping (/usr/lib/node_modules/@rmlio/yarrrml-parser/lib/expander.js:235:20)
at expandMappings (/usr/lib/node_modules/@rmlio/yarrrml-parser/lib/expander.js:55:9)
at expand (/usr/lib/node_modules/@rmlio/yarrrml-parser/lib/expander.js:36:3)
at RMLGenerator.convert (/usr/lib/node_modules/@rmlio/yarrrml-parser/lib/abstract-generator.js:60:30)
at Object.<anonymous> (/usr/lib/node_modules/@rmlio/yarrrml-parser/bin/parser.js:106:23)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12) {
code: 'INVALID_YARRRML'
}
Steps
- Copy/paste the Yaml snippet below in a file called
rules.yml
. - Run the command
yarrrml-parser -i rules.yml -o rules.rml.ttl
- Observe the above shared error message.
prefixes:
ex: http://www.example.com/
mappings:
people:
sources:
- ['people.csv~csv']
s: ex:$(id)
graphs: ex:Characters
po:
- [a, ex:Person]
Environment
Ubuntu LTS + Java 11
Woops, that's a bug in the parser alright! it should support both single values as arrays for (amongst others) graphs
, but it seems only single values are currently supported. The snippet below does work (note the array notation for graphs
). We'll follow-up with a bugfix! (Feel free to create a PR yourself ;) but already a huge thanks for the detailed bug report! )
prefixes:
ex: http://www.example.com/
mappings:
people:
sources:
- ['people.csv~csv']
s: ex:$(id)
graphs:
- ex:Characters
po:
- [a, ex:Person]
Thanks @bjdmeest !
Feel free to create a PR yourself
I'm not a programmer, so it is better for all parties involved if I leave this to others ;-) I can of course help in testing.
Related to #188