Giter Site home page Giter Site logo

Comments (9)

afs avatar afs commented on June 12, 2024 2

Blank nodes in the template are unique across the solution mappings used while instantiating the template.

The query CONSTRUCT WHERE { ?S ?P ?O } has a template of { ?S ?P ?O } which has no blank nodes.

Blank nodes from the WHERE clause are not affected - they are just data.

from comunica.

rubensworks avatar rubensworks commented on June 12, 2024 1

Ok, then our implementation in Comunica is incorrect.
(and I'm actually happy about this, as it will allow us to significantly simplify things)

Thanks for the input @afs!

from comunica.

afs avatar afs commented on June 12, 2024 1

And anyone can make a PR to w3c/sparql-query for improvements of the spec text 😄

from comunica.

github-actions avatar github-actions commented on June 12, 2024

Thanks for reporting!

from comunica.

jeswr avatar jeswr commented on June 12, 2024

This is a dupe of #1160

from comunica.

rubensworks avatar rubensworks commented on June 12, 2024

The query is equivalent to the following:

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

The WHERE clause will be executed first, and will produce one query solution for each triple inside the dataset.
For each query solution, the query template will be instantiated.
According to what the SPARQL spec says, blank nodes will be scoped per query solution:

The blank node labels are scoped to the template for each solution.

So based on my understanding of the spec, this behaviour is correct.

The example in https://www.w3.org/TR/sparql11-query/#templatesWithBNodes aligns with this.

from comunica.

namedgraph avatar namedgraph commented on June 12, 2024

I'm sorry but I'll trust Jena on this.

Note that there are no bnodes in my query (which is what that section is about), only in my data.

from comunica.

rubensworks avatar rubensworks commented on June 12, 2024

Note that there are no bnodes in my query (which is what that section is about), only in my data.

This part of the spec seems to confirm your interpretation:

Blank node labels are scoped to a result set (see "SPARQL Query Results XML Format" and "SPARQL 1.1 Query Results JSON Format") or, for the CONSTRUCT query form, the result graph. Use of the same label within a result set indicates the same blank node.

Tbh, I would love to avoid this blank node weirdness, as it has given us plenty of headaches already.

@afs, what is your interpretation of https://www.w3.org/TR/sparql11-query/#templatesWithBNodes ? Did we implement it incorrectly in Comunica?

from comunica.

rubensworks avatar rubensworks commented on June 12, 2024

Steps that are needed to resolve this issue:

  • Modify BindingsToQuadsIterator, so that the template is localized before the bindings are applied.
  • Remove the localizeBlankNodes context, CLI option, and all usages, as it won't be needed anymore.

from comunica.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.