Reification inside CONSTRUCT is not accepting breakline before partial statements
- Dominant language
- Go
- Stars
- 984
- Forks
- 65
- PR merge metrics
- No merged PRs in 30d
Description
When doing reification inside a CONSTRUCT clause with partial statements, as documented [here](https://github.com/rogerlucena/badwolf/blob/master/docs/bql.md#building-new-facts-out-of-existing-facts-in-graphs), BQL yields a parsing error if a breakline is used before the partial statements.
To illustrate, the following code for reification with CONSTRUCT works:
```
CONSTRUCT {
?ancestor "grandparent"@[] ?grandchildren ; "both_live_in"@[] /city
}
INTO ?grandparents
FROM ?family
WHERE {
?ancestor "parent_of"@[] ?c .
?c "parent_of"@[] ?grandchildren
};
```
But the following code does not:
```
CONSTRUCT {
?ancestor "grandparent"@[] ?grandchildren ;
"both_live_in"@[] /city
}
INTO ?grandparents
FROM ?family
WHERE {
?ancestor "parent_of"@[] ?c .
?c "parent_of"@[] ?grandchildren
};
```
Yielding the following error message:
```
Processing statement (3/6):
CONSTRUCT { ?ancestor "grandparent"@[] ?grandchildren ;
[FAIL] [ERROR] Failed to parse BQL statement with error Parser.parse: Failed to consume symbol CONSTRUCT_FACTS, with error Parser.parse: Failed to consume symbol CONSTRUCT_TRIPLES, with error Parser.parse: Failed to consume symbol MORE_CONSTRUCT_PREDICATE_OBJECT_PAIRS, with error Parser.parse: Failed to consume symbol CONSTRUCT_PREDICATE, with error Parser.consume: could not consume token (EOF, , ) in production CONSTRUCT_PREDICATE
Processing statement (4/6):
"both_live_in"@[] /city } INTO ?grandparents FROM ?family WHERE { ?ancestor "parent_of"@[] ?c . ?c "parent_of"@[] ?grandchildren };
[FAIL] [ERROR] Failed to parse BQL statement with error Parser.consume: could not consume token (PREDICATE, "both_live_in"@[], ) in production START
```
It may be related with [this part](https://github.com/google/badwolf/blob/9f8036d688df6ccc0bd8158cda3a97389509198c/bql/grammar/grammar.go#L939) of the grammar.
You can use the code in the file below to reproduce the aforementioned error.
[reification_breakline_error.pdf](https://github.com/google/badwolf/files/4849429/reification_breakline_error.pdf)
Contributor guide
Assessment
This issue has not been assessed yet.