-
Notifications
You must be signed in to change notification settings - Fork 10
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
Util.mapOperation does not always apply recurse:true #63
Comments
I would also have expected that :D . Not really sure what the problem is since the code for handling this is not that complex. If Do you have an example of where it fails so I can check more in detail? |
It looks like that once one callback has been invoked, that the resulting operation is then always handled by the following switch-case.
Here's an example: https://github.com/comunica/comunica/blob/master/packages/bus-query-operation/lib/Bindings.ts#L101-L104 |
The |
Using this input and the following code: const op = ...;
console.log(AlgebraUtil.mapOperation(op, {
extend: (op: Algebra.Extend) => {
return {
recurse: true,
result: op.input,
};
},
bgp: (op: Algebra.Bgp) => {
console.log('recursion!!!');
return {
recurse: true,
result: op,
};
},
}));
|
Yes, it's slightly different. Try adding a map entry for |
Ah yea, I see the issue now. The callback for group will not be called but it will be called for its parameters. Not sure yet I actually want to fix this now :D . The solution might be uglier than just forcing users to do the call themselves if they change the root object. |
IMO, a fix is definitely need (and shouldn't be too hard). |
It's just that I wouldn't classify it as a bug at this point but an enhancement request. Recursion currently specifically means that it will recurse over the parameters of the result object, but not the result object itself. But I will have a look if there is a clean way to change that. Just don't want to make it uglier for most cases because of a specific edge case. |
In this piece of code, the result is a different operation than the input operation.
I would have expected that by setting
recurse
totrue
, that the returned operation would also be handled.Instead, I have to manually call the mapping logic on this operation myself.
I assume this is not supposed to be needed?
There are probably some infinite loop concerns to be taken into account here.
The text was updated successfully, but these errors were encountered: