Add MATCH queries and layer clauses to DSL (DSL v3) #647
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
py3plex/dsl.py-[,]->)(alias:Label)and(alias)-[alias:Type]->and-[alias]->RETURN *orRETURN alias1, alias2IN LAYER 'name'clause support for SELECT queriesIN LAYERS ('a', 'b')clause support for SELECT queriesexecute_queryas first-class method onmulti_layer_networkclass (99 tests passing)network.execute_query(query)directlyOriginal prompt
This section details on the original issue you should resolve
<issue_title>dsl v3</issue_title>
<issue_description>You are helping extend the EXISTING py3plex DSL implementation (do NOT rewrite it from scratch).
Context:
Your tasks:
Locate the existing DSL code
Keep the current API and syntax working
NEW features to ADD to the DSL
3.1. MATCH pattern syntax (Cypher-like)
Add a new top-level statement form:
MATCH (g:Gene)-[r:REGULATES]->(t:Gene) IN LAYER 'reg' WHERE g.degree > 10 RETURN g, t;
Requirements:
3.2. Layer scoping clauses
Add support for:
IN LAYER 'layer_name'
IN LAYERS ('layer_a', 'layer_b', ...)
These clauses may appear in:
SELECT * FROM nodes IN LAYER 'ppi' WHERE degree > 10;
SELECT id, degree FROM nodes IN LAYERS ('ppi', 'coexpr') WHERE color = 'red';
MATCH (g:Gene)-[r:REGULATES]->(t:Gene) IN LAYER 'reg' WHERE g.degree > 10 RETURN g, t;
Behavior:
3.3. WHERE expression semantics (augmentation, not replacement)
Implementation guidelines
Tests and examples
MATCH (g:Gene)-[r:REGUL...
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.