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

Allow negations and disjunctions without an exterior binding #292

Open
james-whiteside opened this issue Jun 27, 2023 · 0 comments
Open

Comments

@james-whiteside
Copy link

Problem to Solve

Currently, the following queries are illegal:

Example 1:

match
$j isa journal, has name "Acta Materialia";
not { $p isa publication, has paper-id "1234"; };
insert
$p isa publication, has paper-id "1234";
(journal: $j, publication: $p) isa publishing;

Example 2:

match
{ $j isa journal, has name "Acta Materialia"; } or { $j isa journal, has name "Acta Mater."; };
insert
$p isa publication, has paper-id "1234";
(journal: $j, publication: $p) isa publishing;

This is because the negation and disjunction blocks are currently illegal in match clauses without at least one binding from within the block also bound outside of the block.

Current Workaround

In some cases, the query can be modified without much impact to readability and still produce identical results, for instance:

Example 2:

match
$j isa journal;
{ $j has name "Acta Materialia"; } or { $j has name "Acta Mater."; };
insert
$p isa publication, has paper-id "1234";
(journal: $j, publication: $p) isa publishing;

But in others, the simplest approaches that produces identical results under all circumstances is far less readable, and very unintuitive to construct for non-expert users:

Example 1:

match
$j isa journal, has name "Acta Materialia";
$p-type type publication;
not { $p isa $p-type, has paper-id "1234"; };
insert
$p isa publication, has paper-id "1234";
(journal: $j, publication: $p) isa publishing;

It should be possible to find a workaround in any case, so this does not affect language expressivity.

Proposed Solution

Allow negation and disjunction blocks without any bindings within the block also bound outside. Some cases of this are not logically sound queries, but they should be possible to distinguish when the query is parsed and throw an exception, as opposed to the current behaviour which is to reject all such queries indiscriminately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants