-
Notifications
You must be signed in to change notification settings - Fork 18
Fix: Handle comparison operators < and <= correctly in OSLC Where clause #741
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
base: master
Are you sure you want to change the base?
Fix: Handle comparison operators < and <= correctly in OSLC Where clause #741
Conversation
7fb10a7 to
320becb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug in the OSLC Where clause parser where comparison operators < and <= followed by numeric values were incorrectly being parsed as URI references instead of comparison operations. The fix ensures that URI references must start with an alphabetic character after the opening < to avoid conflicts with comparison operators.
- Modified the ANTLR grammar to require alphabetic characters after
<for URI references - Added comprehensive unit tests to verify correct parsing of
<and<=operators with various operand types - Applied code formatting improvements to align with project style guidelines
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| OslcWhere.g | Updated ANTLR grammar rule to require alphabetic characters in URI references, preventing conflicts with comparison operators |
| BasicWhereTest.java | Added extensive unit tests for < and <= operators with integers, strings, URIs, and edge cases, plus code formatting improvements |
core/oslc-query/src/test/java/org/eclipse/lyo/core/query/test/BasicWhereTest.java
Outdated
Show resolved
Hide resolved
core/oslc-query/src/test/java/org/eclipse/lyo/core/query/test/BasicWhereTest.java
Outdated
Show resolved
Hide resolved
core/oslc-query/src/test/java/org/eclipse/lyo/core/query/test/BasicWhereTest.java
Outdated
Show resolved
Hide resolved
core/oslc-query/src/test/java/org/eclipse/lyo/core/query/test/BasicWhereTest.java
Outdated
Show resolved
Hide resolved
core/oslc-query/src/test/java/org/eclipse/lyo/core/query/test/BasicWhereTest.java
Outdated
Show resolved
Hide resolved
core/oslc-query/src/test/java/org/eclipse/lyo/core/query/test/BasicWhereTest.java
Outdated
Show resolved
Hide resolved
fa3bf48 to
fe8c243
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
@oslc-bot /test-all |
Description
If a query has
<=, e.g.<=42, it is incorrectly treated as a URI, which will never succeed.OSLC Query support is not very well tested, would be hard to verify this for regressions. Unit tests were added to cover the change.
Checklist
Issues
Closes #43
(use exactly this syntax to link to issues, one issue per statement only!)