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

initialBindings in combination with named graph #1154

Closed
ddeboer opened this issue Feb 9, 2023 · 5 comments
Closed

initialBindings in combination with named graph #1154

ddeboer opened this issue Feb 9, 2023 · 5 comments

Comments

@ddeboer
Copy link

ddeboer commented Feb 9, 2023

Issue type:

  • 🐛 Bug

Description:

This query works fine:

CONSTRUCT FROM <http://www.ontotext.com/retain-bind-position> WHERE { ?s ?p ?o }  LIMIT 100

With code:

const quadStream = await this.engine.queryQuads(query, {
  sources: [
        {
          type: 'sparql',
          value: 'https://www.goudatijdmachine.nl/sparql/repositories/gtm',
        },
      ],
});

But when adding initial bindings, we get an error:

const quadStream = await this.engine.queryQuads(query, {
  sources: [
        {
          type: 'sparql',
          value: 'https://www.goudatijdmachine.nl/sparql/repositories/gtm',
        },
      ],
  initialBindings: bindingsFactory.fromRecord({}) as unknown as Bindings,
});

Conversely, when we’re not querying named graphs, the initial bindings work fine:

CONSTRUCT WHERE { ?s ?p ?o } LIMIT 100

Environment:

@comunica/query-sparql@2.6.6

Crash log:

Cannot read properties of undefined (reading '0')","stack":"TypeError: Cannot read properties of undefined (reading '0')\n    at translateFrom (/Users/david/src/netwerk-digitaal-erfgoed/network-of-terms/node_modules/sparqlalgebrajs/lib/sparql.js:228:32)\n    at translateOperation (/Users/david/src/netwerk-digitaal-erfgoed/network-of-terms/node_modules/sparqlalgebrajs/lib/sparql.js:71:33)\n    at translateProject (/Users/david/src/netwerk-digitaal-erfgoed/network-of-terms/node_modules/sparqlalgebrajs/lib/sparql.js:369:41)\n    at translateOperation (/Users/david/src/netwerk-digitaal-erfgoed/network-of-terms/node_modules/sparqlalgebrajs/lib/sparql.js:82:36)\n    at toSparqlJs (/Users/david/src/netwerk-digitaal-erfgoed/network-of-terms/node_modules/sparqlalgebrajs/lib/sparql.js:48:18)\n    at toSparql (/Users/david/src/netwerk-digitaal-erfgoed/network-of-terms/node_modules/sparqlalgebrajs/lib/sparql.js:42:32)\n    at ActorQueryOperationSparqlEndpoint.run (/Users/david/src/netwerk-digitaal-erfgoed/network-of-terms/node_modules/@comunica/actor-query-operation-sparql-endpoint/lib/ActorQueryOperationSparqlEndpoint.js:75:52)\n    at ActorQueryOperationSparqlEndpoint.runObservable (/Users/david/src/netwerk-digitaal-erfgoed/network-of-terms/node_modules/@comunica/core/lib/Actor.js:57:29)\n    at MediatorNumber.mediate (/Users/david/src/netwerk-digitaal-erfgoed/network-of-terms/node_modules/@comunica/core/lib/Mediator.js:79:22)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","path":["terms"],"locations":[{"line":2,"column":3}],"extensions":{}},"message":"Cannot read properties of undefined (reading '0')"}

Bounty

A bounty has been placed on this issue by:

Comunica Association
€136

Click here to learn more if you're interested in claiming this bounty by resolving this issue.

@github-actions
Copy link

github-actions bot commented Feb 9, 2023

Thanks for reporting!

@rubensworks
Copy link
Member

A bounty has been placed on this issue via the Comunica Association (see original post).

I suspect this is just a small issue in https://github.com/joachimvh/SPARQLAlgebra.js related to this call: https://github.com/comunica/comunica/blob/master/packages/bus-query-operation/lib/Bindings.ts#L41

coret referenced this issue in netwerk-digitaal-erfgoed/network-of-terms Apr 5, 2023
- use of lucene index
- lucene score for ranking
- scopeNote better reflecting type of street
@simonvbrae
Copy link
Contributor

This issue has been fixed in the following commit:
joachimvh/SPARQLAlgebra.js@edfbb30

@rubensworks
Copy link
Member

🎉

Maintenance automation moved this from To Do (prio:high) to Done Nov 10, 2023
@rubensworks
Copy link
Member

We'll bump the sparqlalgebra version in a next version of comunica.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Maintenance
  
Done
Development

No branches or pull requests

3 participants