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

SPARQL Scoping issue for filters inside EXISTS #4256

Closed
hmottestad opened this issue Oct 30, 2022 · 1 comment · Fixed by #4257
Closed

SPARQL Scoping issue for filters inside EXISTS #4256

hmottestad opened this issue Oct 30, 2022 · 1 comment · Fixed by #4257
Assignees
Labels
🐞 bug issue is a bug
Milestone

Comments

@hmottestad
Copy link
Contributor

Current Behavior

See: #4169

PREFIX : <http://example/>
SELECT * WHERE {
	?a :p ?n
	FILTER NOT EXISTS {
		?a :q ?m .
		FILTER(?n = ?m)
	}
}

?n inside the FILTER clause is considered a new scope.

Expected Behavior

?n inside the FILTER clause should be in scope with the ?n in ?a :p ?n.

Steps To Reproduce

No response

Version

4.x

Are you interested in contributing a solution yourself?

Yes

Anything else?

No response

@hmottestad hmottestad added the 🐞 bug issue is a bug label Oct 30, 2022
@hmottestad
Copy link
Contributor Author

We use the following code to decide if a variable is in scope for a FILTER operation:

	public static boolean isPartOfSubQuery(QueryModelNode node) {
		if (node instanceof SubQueryValueOperator) {
			return true;
		}

		QueryModelNode parent = node.getParentNode();
		if (parent == null) {
			return false;
		} else {
			return isPartOfSubQuery(parent);
		}
	}

And EXISTS is among the effective sub classes of SubQueryValueOperator:

Screenshot 2022-10-30 at 07 35 02

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug issue is a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant