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

Recording substituted values #2799

Open
afs opened this issue Oct 26, 2024 · 0 comments
Open

Recording substituted values #2799

afs opened this issue Oct 26, 2024 · 0 comments
Assignees
Labels
bug enhancement Incrementally add new feature

Comments

@afs
Copy link
Member

afs commented Oct 26, 2024

Version

5.2.0

What happened?

From: https://lists.apache.org/thread/ox1hglkz3jcqp1onp2rqdk349fg2poqw

Substitution applied by QueryTransformOps does not put assignments into the projection if the query is SELECT *.

Relevant output and stacktrace

public class mainSelectStarSubstitution {
        public static void main() {
            Model model = ModelFactory.createDefaultModel();
            Binding initBinding = Binding.builder().add(Var.alloc("this"), OWL.Thing.asNode()).build();
            model.add(OWL.Thing, RDF.type, OWL.Class);
            model.add(OWL.Nothing, RDF.type, RDFS.Class);
            Query query = QueryFactory.create("SELECT * { ?this a ?type }");

            // **** Workaround.
            //query.setQueryResultStar(false);

            QueryExecution qExec = QueryExecutionDatasetBuilder.create().
                    query(query).
                    model(model).
                    // Old way
                    //initialBinding(initBinding).
                    substitution("this", OWL.Thing).
                    build();
            System.out.println("qExec.getQuery() - original query");
            System.out.println(qExec.getQuery());
            System.out.println("qExec.getQueryString() - modified query");
            System.out.println(qExec.getQueryString());
        }
    }

Are you interested in making a pull request?

Yes

@afs afs added bug enhancement Incrementally add new feature labels Oct 26, 2024
@afs afs self-assigned this Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug enhancement Incrementally add new feature
Projects
None yet
Development

No branches or pull requests

1 participant