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

Support optional match #112

Open
Dtenwolde opened this issue Mar 25, 2024 · 3 comments
Open

Support optional match #112

Dtenwolde opened this issue Mar 25, 2024 · 3 comments
Labels
enhancement New feature or request high priority

Comments

@Dtenwolde
Copy link
Contributor

Many SNB queries such as IC1, IC4, IC5 (see https://github.com/cwida/duckpgq-experiments/issues/26 for all) require optional matches. The PGQ syntax would be ()-[]->?().

Snippet from the SQL/PGQ specification section 10.6:

<questioned path primary> ::=
  <path primary> <question mark>

"NOTE 130 — Unlike most regular expression languages, is not equivalent to the quantifier {0,1}: the quantifier {0,1} exposes variables as group, whereas does not change the singleton variables that it exposes to group. However, does expose any singleton variables as conditional singletons."

The way to translate this would be with a LEFT OUTER JOIN

(b:Student)<-[k:Know]-(a:Student)-[sa:studyAt]->?(u:University)
select * from student s
join know k on s.id = k.src
join student s2 on s2.id = k.dst
left join studyat sa on sa.studentid = s.id
join university u on sa.universityid = u.id;
@Dtenwolde Dtenwolde added the enhancement New feature or request label Mar 25, 2024
Copy link

github-actions bot commented Sep 3, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Sep 3, 2024
@Dtenwolde Dtenwolde removed the stale label Sep 3, 2024
@dberardo-com
Copy link

the issue mentioned above returns a 404 not found

@Dtenwolde
Copy link
Contributor Author

Sorry, it links to a private repo :) The issue lists all the queries from the LDBC SNB specification which you can find here: https://ldbcouncil.org/ldbc_snb_docs/ldbc-snb-specification.pdf
It's what I use to test the correctness of new queries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request high priority
Projects
None yet
Development

No branches or pull requests

2 participants