Skip to content

Fix path-pattern mixing logic in registerRelationship#26

Merged
akollegger merged 3 commits into018-pattern-path-semanticsfrom
copilot/sub-pr-24
Nov 29, 2025
Merged

Fix path-pattern mixing logic in registerRelationship#26
akollegger merged 3 commits into018-pattern-path-semanticsfrom
copilot/sub-pr-24

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 29, 2025

The validation logic in registerRelationship treated all path relationship identifiers as definitions, reporting DuplicateDefinition even when a pattern definition like [r | a, b] was followed by consistent path usage (a)-[r]->(b). This made mixed notation impossible.

Changes

  • Gram/Validate.hs: Modified registerRelationship to check SymbolType when an identifier exists:

    • TypeRelationship (from another path) → DuplicateDefinition
    • TypePattern (from bracket notation) → verify arity consistency, allow if arity matches 2
  • SemanticsSpec.hs: Fixed arity mismatch test to define all referenced elements and check for InconsistentDefinition among errors

  • Test.hs: Added missing SemanticsSpec import

Example

-- Now validates correctly:
validateSource "[r | a, b], (a)-[r]->(b)"  -- Right () (consistent)
validateSource "(a)-[r]->(b), (c)-[r]->(d)"  -- Left [DuplicateDefinition r]
validateSource "[r | a, b, c], (a)-[r]->(b), (c)"  -- Left [InconsistentDefinition r ...]

💡 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.

Copilot AI and others added 2 commits November 29, 2025 13:56
… definitions from references

Co-authored-by: akollegger <53756+akollegger@users.noreply.github.com>
Co-authored-by: akollegger <53756+akollegger@users.noreply.github.com>
Copilot AI changed the title [WIP] Work in progress on addressing feedback for PR 24 Fix path-pattern mixing logic in registerRelationship Nov 29, 2025
Copilot AI requested a review from akollegger November 29, 2025 13:59
@akollegger akollegger marked this pull request as ready for review November 29, 2025 14:02
@akollegger akollegger merged commit 5bae254 into 018-pattern-path-semantics Nov 29, 2025
@akollegger akollegger deleted the copilot/sub-pr-24 branch November 29, 2025 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants