Fix: Handle comparison operators < and <= correctly in OSLC Where clause#741
Open
berezovskyi wants to merge 16 commits intoeclipse-lyo:masterfrom
Open
Fix: Handle comparison operators < and <= correctly in OSLC Where clause#741berezovskyi wants to merge 16 commits intoeclipse-lyo:masterfrom
berezovskyi wants to merge 16 commits intoeclipse-lyo:masterfrom
Conversation
7fb10a7 to
320becb
Compare
Contributor
There was a problem hiding this comment.
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.
Contributor
Author
|
@oslc-bot /test-all |
Contributor
Author
|
We should ensure that URIs of form |
Contributor
Author
|
@oslc-bot /test-all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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!)