-
Notifications
You must be signed in to change notification settings - Fork 11
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
Process ends unexpectedly on certain path queries #95
Comments
Could you follow the issue templates for future issues? Otherwise our auto-labeling and project pipeline doesn't catch it properly. |
Is there a public source over which this could be reproduced? |
Invalid/empty resources such as http://example.org/ actually reproduce the results - and will terminate you simplify the path (for instance by removing the last part of the sequence). I'll look into also putting up a minimal document to reproduce where there is at least one result. |
Here is an example against your WebID import { QueryEngine } from '@comunica/query-sparql-link-traversal';
const query = `
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX : <http://example.org/>
CONSTRUCT {
<https://www.rubensworks.net/#me> :knowsSomeoneWithName ?name .
} WHERE {
<https://www.rubensworks.net/#me> (foaf:knows|^foaf:knows)/foaf:name ?name .
}
`
async function main() {
const engine = new QueryEngine();
const quads = await engine.queryQuads(query, { lenient: true });
console.log(await quads.toArray())
}
main(); It will go about a minute (presumably traversing) before eventually stopping withoutputting the quads array. If you listen to the |
Thanks! |
Can't reproduce the problem on my end it seems. |
Ok, can reproduce the problem with just |
It's definitely related to the streaming source, as setting |
Just looked into this (a bit), and it looks like the problem is that the 'end' event is not emitted upwards to the top-level bindingsStream when lower-level streams are destroyed. |
The lack of an end event seems to be expected behavior (see https://github.com/RubenVerborgh/AsyncIterator/blob/3171521759194b3ce463f989d8253e35978ef690/asynciterator.ts#L74). I also ran a test against node streams and they also do not emit an import { Readable } from 'stream';
const iterator = new Readable();
iterator.on('data', () => { console.log('data') });
iterator.on('end', () => { console.log('end') });
iterator.on('error', () => { console.log('error') });
iterator.on('close', () => { console.log('close') });
iterator.push('a');
iterator.push(null); gives
wheras import { Readable } from 'stream';
const iterator = new Readable();
iterator.on('data', () => { console.log('data') });
iterator.on('end', () => { console.log('end') });
iterator.on('error', () => { console.log('error') });
iterator.on('close', () => { console.log('close') });
iterator.push('a');
iterator.destroy(); gives
|
I think the greater issue here is that there is an error event that does not get forwarded somewhere (probably one created by a destruction in comunica/comunica#1164); hence why I suggested here that an error be thrown in the next mver of asynciterator if an |
For this particular bug - I've narrowed the problem down to the fact that the stream returned by If you add the followng to the end of the match method in the stream.on('data', () => { console.log('data') })
stream.on('end', () => { console.log('end called in streaming store') })
stream.on('error', () => { console.log('error called in streaming store') });
const stream2 = new readable_stream_1.Readable({ objectMode: true });
stream2.push(null)
return stream2; In turn this seems to be because |
I don't think this is the cause of the bug. |
One possible solution would be to make AsyncIterator also emit |
Problem is fixed (not released yet). |
Running the following on the latest version of the link-traversal package causes the process to end without logging anything. Contrastingly the empty array is produced if using the latest version of
@comunica/query-sparql
The text was updated successfully, but these errors were encountered: