eclipse-rdf4j / rdf4j

Eclipse RDF4J: scalable RDF for Java
https://rdf4j.org/
BSD 3-Clause "New" or "Revised" License
365 stars 163 forks source link

AssertionError in ArrayBindingSet on intermediate_join after upgrade from 3.7.7 to 4.2.3 #4646

Closed vallerap closed 1 year ago

vallerap commented 1 year ago

Current Behavior

I'm experiencing an issue when executing a specific query with RDF4J version 4.2.3. The query involves a complex SPARQL query and a specific dataset. Here are the details:

PREFIX owl:<http://www.w3.org/2002/07/owl#> 
                PREFIX xsd:<http://www.w3.org/2001/XMLSchema#> 
                PREFIX freebase:<http://rdf.freebase.com/ns/> 
                PREFIX skos:<http://www.w3.org/2004/02/skos/core#> 
                PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> 
                PREFIX dbpedia:<http://dbpedia.org/resource/> 
                PREFIX users:<http://schema.semantic-web.at/users/> 
                PREFIX tags:<http://www.holygoat.co.uk/owl/redwood/0.1/tags/> 
                PREFIX skos-xl:<http://www.w3.org/2008/05/skos-xl#> 
                PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
                PREFIX dcterms:<http://purl.org/dc/terms/> 
                PREFIX ctag:<http://commontag.org/ns#> 
                PREFIX foaf:<http://xmlns.com/foaf/0.1/> 
                PREFIX dc:<http://purl.org/dc/elements/1.1/> 
                SELECT (?p as ?resource) (?violates as ?property) (?c as ?value) WHERE {{ SELECT DISTINCT ?c ?violates ?p where {graph <http://test.com/inportdata> {?c ?p ?x .FILTER (?p IN ( <http://www.w3.org/2004/02/skos/core#hasTopConcept>,<http://www.w3.org/2004/02/skos/core#narrower>,<http://www.w3.org/2004/02/skos/core#broader>,<http://www.w3.org/2004/02/skos/core#related>,<http://www.w3.org/2004/02/skos/core#member>,<http://www.w3.org/2004/02/skos/core#broaderTransitive>,<http://www.w3.org/2004/02/skos/core#narrowerTransitive>)) OPTIONAL { ?c a ?cType }}{select ?p ?domainType where { graph <tmp:validationengine/uni-schema> { {?p <http://www.w3.org/2000/01/rdf-schema#domain>/(<http://www.w3.org/2002/07/owl#unionOf>/rdf:rest*/rdf:first)*/^rdfs:subClassOf* ?domainType. FILTER isIri(?domainType). } UNION { ?p <http://www.w3.org/2000/01/rdf-schema#subPropertyOf>+ ?parentProperty.?parentProperty <http://www.w3.org/2000/01/rdf-schema#domain>/(<http://www.w3.org/2002/07/owl#unionOf>/rdf:rest*/rdf:first)*/^rdfs:subClassOf* ?domainType. FILTER isIri(?domainType). }}}} BIND (COALESCE(sameTerm(?cType,?domainType),false) AS ?typeMatch) .BIND (<urn:domainViolationBy> as ?violates) .} GROUP BY ?c ?p ?violates HAVING(MAX(?typeMatch) = false)} UNION { SELECT DISTINCT ?c ?violates ?p  where {graph <http://test.com/inportdata> { ?x ?p ?c .FILTER (?p IN (<http://www.w3.org/2004/02/skos/core#hasTopConcept>,<http://www.w3.org/2004/02/skos/core#narrower>,<http://www.w3.org/2004/02/skos/core#broader>,<http://www.w3.org/2004/02/skos/core#related>,<http://www.w3.org/2004/02/skos/core#member>,<http://www.w3.org/2004/02/skos/core#broaderTransitive>,<http://www.w3.org/2004/02/skos/core#narrowerTransitive>)) OPTIONAL {?c a ?cType.}}{select ?p ?rangeType where {graph <tmp:validationengine/uni-schema> {{?p <http://www.w3.org/2000/01/rdf-schema#range>/(<http://www.w3.org/2002/07/owl#unionOf>/rdf:rest*/rdf:first)*/^rdfs:subClassOf* ?rangeType. FILTER isIri(?rangeType). } UNION {?p <http://www.w3.org/2000/01/rdf-schema#subPropertyOf>+ ?parentProperty.?parentProperty <http://www.w3.org/2000/01/rdf-schema#range>/(<http://www.w3.org/2002/07/owl#unionOf>/rdf:rest*/rdf:first)*/^rdfs:subClassOf* ?rangeType. FILTER isIri(?rangeType). }}}}BIND (COALESCE(sameTerm(?cType,?rangeType),false) AS ?typeMatch) .BIND (<urn:rangeViolationBy> as ?violates) .} GROUP BY ?c ?p ?violates HAVING(MAX(?typeMatch) = false)}}

on this dataset:

@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix cycAnnot: <http://sw.cyc.com/CycAnnotations_v1#> .
@prefix cyc: <http://sw.cyc.com/concept/> .
@prefix dbpedia: <http://dbpedia.org/resource/> .
@prefix ctag: <http://commontag.org/ns#> .
@prefix opencyc: <http://sw.opencyc.org/concept/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix csw: <http://semantic-web.at/ontologies/csw.owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix freebase: <http://rdf.freebase.com/ns/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix tags: <http://www.holygoat.co.uk/owl/redwood/0.1/tags/> .
@prefix sesame: <http://www.openrdf.org/schema/sesame#> .
@prefix fn: <http://www.w3.org/2005/xpath-functions#> .

<http://localhost/alignedtest/0> skos:hasTopConcept <http://localhost/alignedtest/import_1>;
   a skos:ConceptScheme.

<http://localhost/alignedtest/1> skos:hasTopConcept <http://localhost/alignedtest/import_1>.

<http://localhost/alignedtest/import_1> a skos:Concept ;
   skos:prefLabel "imported concept 1"@en ;
   skos:altLabel "imported concept 1"@en ;
   skos:topConceptOf <http://localhost/alignedtest/0> ;
   skos:narrower   <http://localhost/alignedtest/import_2> ;
   skos:topConceptOf <http://localhost/alignedtest/1> .

 <http://localhost/alignedtest/import_2> skos:prefLabel "import concept 2"@en.

I am getting the following error after upgrading from 3.7.7 to 4.2.4:

java.lang.AssertionError: We don’t actually support adding a binding.
    at org.eclipse.rdf4j.query.algebra.evaluation.ArrayBindingSet.addBinding(ArrayBindingSet.java:327)
    at org.eclipse.rdf4j.query.MutableBindingSet.addBinding(MutableBindingSet.java:30)
    at org.eclipse.rdf4j.query.algebra.evaluation.iterator.HashJoinIteration.getNextElement(HashJoinIteration.java:203)
    at org.eclipse.rdf4j.query.algebra.evaluation.iterator.HashJoinIteration.getNextElement(HashJoinIteration.java:46)
    at org.eclipse.rdf4j.common.iteration.LookAheadIteration.lookAhead(LookAheadIteration.java:80)
    at org.eclipse.rdf4j.common.iteration.LookAheadIteration.hasNext(LookAheadIteration.java:54)
    at org.eclipse.rdf4j.query.algebra.evaluation.iterator.JoinIterator.getNextElement(JoinIterator.java:77)
    at org.eclipse.rdf4j.query.algebra.evaluation.iterator.JoinIterator.getNextElement(JoinIterator.java:34)
    at org.eclipse.rdf4j.common.iteration.LookAheadIteration.lookAhead(LookAheadIteration.java:80)
    at org.eclipse.rdf4j.common.iteration.LookAheadIteration.hasNext(LookAheadIteration.java:54)
    at org.eclipse.rdf4j.query.algebra.evaluation.iterator.JoinIterator.getNextElement(JoinIterator.java:77)
    at org.eclipse.rdf4j.query.algebra.evaluation.iterator.JoinIterator.getNextElement(JoinIterator.java:34)
    at org.eclipse.rdf4j.common.iteration.LookAheadIteration.lookAhead(LookAheadIteration.java:80)
    at org.eclipse.rdf4j.common.iteration.LookAheadIteration.hasNext(LookAheadIteration.java:54)
    at org.eclipse.rdf4j.common.iteration.DualUnionIteration.getNextElement(DualUnionIteration.java:62)
    at org.eclipse.rdf4j.common.iteration.DualUnionIteration.lookAhead(DualUnionIteration.java:118)
    at org.eclipse.rdf4j.common.iteration.DualUnionIteration.hasNext(DualUnionIteration.java:92)
    at org.eclipse.rdf4j.common.iteration.ConvertingIteration.hasNext(ConvertingIteration.java:66)
    at org.eclipse.rdf4j.query.algebra.evaluation.iterator.JoinIterator.getNextElement(JoinIterator.java:77)
    at org.eclipse.rdf4j.query.algebra.evaluation.iterator.JoinIterator.getNextElement(JoinIterator.java:34)
    at org.eclipse.rdf4j.common.iteration.LookAheadIteration.lookAhead(LookAheadIteration.java:80)
    at org.eclipse.rdf4j.common.iteration.LookAheadIteration.hasNext(LookAheadIteration.java:54)
    at org.eclipse.rdf4j.common.iteration.ConvertingIteration.hasNext(ConvertingIteration.java:66)
    at org.eclipse.rdf4j.common.iteration.ConvertingIteration.hasNext(ConvertingIteration.java:66)
    at org.eclipse.rdf4j.query.algebra.evaluation.iterator.GroupIterator.buildEntries(GroupIterator.java:365)
    at org.eclipse.rdf4j.query.algebra.evaluation.iterator.GroupIterator.createIterator(GroupIterator.java:264)
    at org.eclipse.rdf4j.query.algebra.evaluation.iterator.GroupIterator.hasNext(GroupIterator.java:140)
    at org.eclipse.rdf4j.common.iteration.IterationWrapper.hasNext(IterationWrapper.java:67)
    at org.eclipse.rdf4j.common.iteration.FilterIteration.findNextElement(FilterIteration.java:78)
    at org.eclipse.rdf4j.common.iteration.FilterIteration.hasNext(FilterIteration.java:49)
    at org.eclipse.rdf4j.common.iteration.ConvertingIteration.hasNext(ConvertingIteration.java:66)
    at org.eclipse.rdf4j.common.iteration.ConvertingIteration.hasNext(ConvertingIteration.java:66)
    at org.eclipse.rdf4j.common.iteration.IterationWrapper.hasNext(IterationWrapper.java:67)
    at org.eclipse.rdf4j.common.iteration.FilterIteration.findNextElement(FilterIteration.java:78)
    at org.eclipse.rdf4j.common.iteration.FilterIteration.hasNext(FilterIteration.java:49)
    at org.eclipse.rdf4j.common.iteration.DualUnionIteration.getNextElement(DualUnionIteration.java:69)
    at org.eclipse.rdf4j.common.iteration.DualUnionIteration.lookAhead(DualUnionIteration.java:118)
    at org.eclipse.rdf4j.common.iteration.DualUnionIteration.hasNext(DualUnionIteration.java:92)
    at org.eclipse.rdf4j.common.iteration.ConvertingIteration.hasNext(ConvertingIteration.java:66)
    at org.eclipse.rdf4j.common.iteration.ConvertingIteration.hasNext(ConvertingIteration.java:66)
    at org.eclipse.rdf4j.common.iteration.IterationWrapper.hasNext(IterationWrapper.java:67)
    at org.eclipse.rdf4j.sail.base.SailClosingIteration.hasNext(SailClosingIteration.java:84)
    at org.eclipse.rdf4j.common.iteration.IterationWrapper.hasNext(IterationWrapper.java:67)
    at org.eclipse.rdf4j.sail.helpers.SailBaseIteration.hasNext(SailBaseIteration.java:43)
    at org.eclipse.rdf4j.sail.helpers.CleanerIteration.hasNext(CleanerIteration.java:42)
    at org.eclipse.rdf4j.common.iteration.IterationWrapper.hasNext(IterationWrapper.java:67)

We have analysed the code for class HashJoinIteration and found out that the probably seems to be originating after

QueryBindingSet result = new QueryBindingSet(currentScanElem);

has been changed to:

MutableBindingSet result = bsMaker.apply(currentScanElem);

We then tried to revert this change and RDF4J seems to build with no errors, also when running the above mentioned query on the same dataset the error is not produced.

We wanted however to make sure that there are no better ways to solve the issue

Expected Behavior

The above mentioned query should, in theory, be executed without any errors or generating a different error since no bindings were added.

Steps To Reproduce

Version

4.2.3

Are you interested in contributing a solution yourself?

Yes

Anything else?

No response

hmottestad commented 1 year ago

I'm trying to run your query and I'm getting the following exception:

Exception in thread "main" org.eclipse.rdf4j.query.MalformedQueryException: Encountered " "bind" "BIND "" at line 51, column 5.
Was expecting one of:
    "}" ...
    "order" ...
    "group" ...
    "limit" ...
    "offset" ...
    "having" ...
    "bindings" ...
    "values" ...
hmottestad commented 1 year ago

This is my code:

public class Temp {

    public static void main(String[] args) throws IOException {
        SailRepository sailRepository = new SailRepository(new MemoryStore());
        StringReader stringReader = new StringReader("@prefix owl: <http://www.w3.org/2002/07/owl#> .\n" +
                "@prefix cycAnnot: <http://sw.cyc.com/CycAnnotations_v1#> .\n" +
                "@prefix cyc: <http://sw.cyc.com/concept/> .\n" +
                "@prefix dbpedia: <http://dbpedia.org/resource/> .\n" +
                "@prefix ctag: <http://commontag.org/ns#> .\n" +
                "@prefix opencyc: <http://sw.opencyc.org/concept/> .\n" +
                "@prefix foaf: <http://xmlns.com/foaf/0.1/> .\n" +
                "@prefix csw: <http://semantic-web.at/ontologies/csw.owl#> .\n" +
                "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n" +
                "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n" +
                "@prefix skos: <http://www.w3.org/2004/02/skos/core#> .\n" +
                "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n" +
                "@prefix dc: <http://purl.org/dc/elements/1.1/> .\n" +
                "@prefix freebase: <http://rdf.freebase.com/ns/> .\n" +
                "@prefix dcterms: <http://purl.org/dc/terms/> .\n" +
                "@prefix tags: <http://www.holygoat.co.uk/owl/redwood/0.1/tags/> .\n" +
                "@prefix sesame: <http://www.openrdf.org/schema/sesame#> .\n" +
                "@prefix fn: <http://www.w3.org/2005/xpath-functions#> .\n" +
                "\n" +
                "<http://localhost/alignedtest/0> skos:hasTopConcept <http://localhost/alignedtest/import_1>;\n" +
                "   a skos:ConceptScheme.\n" +
                "\n" +
                "<http://localhost/alignedtest/1> skos:hasTopConcept <http://localhost/alignedtest/import_1>.\n" +
                "\n" +
                "<http://localhost/alignedtest/import_1> a skos:Concept ;\n" +
                "   skos:prefLabel \"imported concept 1\"@en ;\n" +
                "   skos:altLabel \"imported concept 1\"@en ;\n" +
                "   skos:topConceptOf <http://localhost/alignedtest/0> ;\n" +
                "   skos:narrower   <http://localhost/alignedtest/import_2> ;\n" +
                "   skos:topConceptOf <http://localhost/alignedtest/1> .\n" +
                "\n" +
                " <http://localhost/alignedtest/import_2> skos:prefLabel \"import concept 2\"@en.");

        try (SailRepositoryConnection connection = sailRepository.getConnection()) {
            connection.add(stringReader, RDFFormat.TURTLE);
        }

        try (SailRepositoryConnection connection = sailRepository.getConnection()) {
            connection.prepareTupleQuery("PREFIX owl: <http://www.w3.org/2002/07/owl#>\n" +
                    "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n" +
                    "PREFIX freebase: <http://rdf.freebase.com/ns/>\n" +
                    "PREFIX skos: <http://www.w3.org/2004/02/skos/core#>\n" +
                    "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n" +
                    "PREFIX dbpedia: <http://dbpedia.org/resource/>\n" +
                    "PREFIX users: <http://schema.semantic-web.at/users/>\n" +
                    "PREFIX tags: <http://www.holygoat.co.uk/owl/redwood/0.1/tags/>\n" +
                    "PREFIX skos-xl: <http://www.w3.org/2008/05/skos-xl#>\n" +
                    "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
                    "PREFIX dcterms: <http://purl.org/dc/terms/>\n" +
                    "PREFIX ctag: <http://commontag.org/ns#>\n" +
                    "PREFIX foaf: <http://xmlns.com/foaf/0.1/>\n" +
                    "PREFIX dc: <http://purl.org/dc/elements/1.1/>\n" +
                    "\n" +
                    "SELECT (?p AS ?resource) (?violates AS ?property) (?c AS ?value)\n" +
                    "WHERE {\n" +
                    "  {\n" +
                    "    SELECT DISTINCT ?c ?violates ?p\n" +
                    "    WHERE {\n" +
                    "      GRAPH <http://test.com/inportdata> {\n" +
                    "        ?c ?p ?x .\n" +
                    "        FILTER (?p IN (\n" +
                    "          <http://www.w3.org/2004/02/skos/core#hasTopConcept>,\n" +
                    "          <http://www.w3.org/2004/02/skos/core#narrower>,\n" +
                    "          <http://www.w3.org/2004/02/skos/core#broader>,\n" +
                    "          <http://www.w3.org/2004/02/skos/core#related>,\n" +
                    "          <http://www.w3.org/2004/02/skos/core#member>,\n" +
                    "          <http://www.w3.org/2004/02/skos/core#broaderTransitive>,\n" +
                    "          <http://www.w3.org/2004/02/skos/core#narrowerTransitive>\n" +
                    "        ))\n" +
                    "        OPTIONAL { ?c a ?cType }\n" +
                    "      }\n" +
                    "      {\n" +
                    "        SELECT ?p ?domainType\n" +
                    "        WHERE {\n" +
                    "          GRAPH <tmp:validationengine/uni-schema> {\n" +
                    "            {\n" +
                    "              ?p <http://www.w3.org/2000/01/rdf-schema#domain>/(<http://www.w3.org/2002/07/owl#unionOf>/rdf:rest*/rdf:first)*/^rdfs:subClassOf* ?domainType .\n" +
                    "              FILTER isIri(?domainType)\n" +
                    "            }\n" +
                    "            UNION {\n" +
                    "              ?p <http://www.w3.org/2000/01/rdf-schema#subPropertyOf>+ ?parentProperty .\n" +
                    "              ?parentProperty <http://www.w3.org/2000/01/rdf-schema#domain>/(<http://www.w3.org/2002/07/owl#unionOf>/rdf:rest*/rdf:first)*/^rdfs:subClassOf* ?domainType .\n" +
                    "              FILTER isIri(?domainType)\n" +
                    "            }\n" +
                    "          }\n" +
                    "        }\n" +
                    "      }\n" +
                    "    }\n" +
                    "    BIND (COALESCE(sameTerm(?cType, ?domainType), false) AS ?typeMatch)\n" +
                    "    BIND (<urn:domainViolationBy> AS ?violates)\n" +
                    "  }\n" +
                    "  GROUP BY ?c ?p ?violates\n" +
                    "  HAVING (MAX(?typeMatch) = false)\n" +
                    "}\n" +
                    "UNION\n" +
                    "{\n" +
                    "  SELECT DISTINCT ?c ?violates ?p\n" +
                    "  WHERE {\n" +
                    "    GRAPH <http://test.com/inportdata> {\n" +
                    "      ?x ?p ?c .\n" +
                    "      FILTER (?p IN (\n" +
                    "        <http://www.w3.org/2004/02/skos/core#hasTopConcept>,\n" +
                    "        <http://www.w3.org/2004/02/skos/core#narrower>,\n" +
                    "        <http://www.w3.org/2004/02/skos/core#broader>,\n" +
                    "        <http://www.w3.org/2004/02/skos/core#related>,\n" +
                    "        <http://www.w3.org/2004/02/skos/core#member>,\n" +
                    "        <http://www.w3.org/2004/02/skos/core#broaderTransitive>,\n" +
                    "        <http://www.w3.org/2004/02/skos/core#narrowerTransitive>\n" +
                    "      ))\n" +
                    "      OPTIONAL { ?c a ?cType }\n" +
                    "    }\n" +
                    "    {\n" +
                    "      SELECT ?p ?rangeType\n" +
                    "      WHERE {\n" +
                    "        GRAPH <tmp:validationengine/uni-schema> {\n" +
                    "          {\n" +
                    "            ?p <http://www.w3.org/2000/01/rdf-schema#range>/(<http://www.w3.org/2002/07/owl#unionOf>/rdf:rest*/rdf:first)*/^rdfs:subClassOf* ?rangeType .\n" +
                    "            FILTER isIri(?rangeType)\n" +
                    "          }\n" +
                    "          UNION {\n" +
                    "            ?p <http://www.w3.org/2000/01/rdf-schema#subPropertyOf>+ ?parentProperty .\n" +
                    "            ?parentProperty <http://www.w3.org/2000/01/rdf-schema#range>/(<http://www.w3.org/2002/07/owl#unionOf>/rdf:rest*/rdf:first)*/^rdfs:subClassOf* ?rangeType .\n" +
                    "            FILTER isIri(?rangeType)\n" +
                    "          }\n" +
                    "        }\n" +
                    "      }\n" +
                    "    }\n" +
                    "    BIND (COALESCE(sameTerm(?cType, ?rangeType), false) AS ?typeMatch)\n" +
                    "    BIND (<urn:rangeViolationBy> AS ?violates)\n" +
                    "  }\n" +
                    "  GROUP BY ?c ?p ?violates\n" +
                    "  HAVING (MAX(?typeMatch) = false)\n" +
                    "}");
        }

    }
}
hmottestad commented 1 year ago

It is also unclear which version you are using. You mention 4.0.0, 4.2.3 and 4.2.4.

Could you clarify which version you are using?

Could you also test with 4.3.2? That is the latest release.

JervenBolleman commented 1 year ago

I suspect the real error is somewhat removed from the location of the Exception somewhere in the method findAllVariablesUsedInQuery of the ArrayBindingBasedQueryEvaluationContext.

During initialization all variables used in the query should be found for use during the query. The error suggest that a variable was not found. (running with -ea for assertions enabled should give a clearer message).

However, I fail to replicate the bug. Also when I remove the named graph parts in the query these lead to no data being bound if the dataset has no graphs.

vallerap commented 1 year ago

Thank you for your attention to the issue I raised. I apologize for not providing clear steps to reproduce the error initially. Although I can consistently reproduce the error in my environment, it seems to be elusive when starting from scratch in a new project.

I am working on providing a more accurate representation of the steps required to reproduce the issue. I am investigating the behavior further to provide a comprehensive set of steps.

It's worth noting that the error occurs without any modifications, apart from upgrading RDF4J from version 3.7.7 to 4.2.3.

Please bear with me while I gather more information and deliver an improved description of the issue.

P.s.: I modified my first comment and corrected the query

hmottestad commented 1 year ago

I've added some better error messages and logging to a branch here that you can test out if you want. Let us know what the error says.

https://github.com/eclipse/rdf4j/pull/4649

hmottestad commented 1 year ago

I actually think I might be onto something.

@JervenBolleman I've added a check that tests all the join attributes and it actually causes issues with some of the existing tests we have (at least NativeSPARQL11QueryComplianceTest). https://github.com/eclipse/rdf4j/pull/4649

EDIT: My test code is wrong. I assumed that all join attributes would be added to the results, but that not true. Constants within StatementPattern can be used as join attributes but are not added to the results. It might be that is is related to this issue, but I would need to be able to reproduce the issue first to see.

vallerap commented 1 year ago

Hi guys,

I checked out, built and integrated 4646 the error message is the following:

2023-07-03 12:27:26 [ERROR] ArrayBindingSet We don't actually support adding a binding. intermediate_join_2-311788384 : http://www.w3.org/2004/02/skos/core#related

java.lang.AssertionError: We don't actually support adding a binding. intermediate_join_2-311788384 : http://www.w3.org/2004/02/skos/core#related

    at org.eclipse.rdf4j.query.algebra.evaluation.ArrayBindingSet.addBinding(ArrayBindingSet.java:336)
    at org.eclipse.rdf4j.query.MutableBindingSet.addBinding(MutableBindingSet.java:30)
    at org.eclipse.rdf4j.query.algebra.evaluation.iterator.HashJoinIteration.getNextElement(HashJoinIteration.java:201)
    at org.eclipse.rdf4j.query.algebra.evaluation.iterator.HashJoinIteration.getNextElement(HashJoinIteration.java:47)
    at org.eclipse.rdf4j.common.iteration.LookAheadIteration.lookAhead(LookAheadIteration.java:80)
    at org.eclipse.rdf4j.common.iteration.LookAheadIteration.hasNext(LookAheadIteration.java:54)
    at org.eclipse.rdf4j.query.algebra.evaluation.iterator.JoinIterator.getNextElement(JoinIterator.java:77)
    at org.eclipse.rdf4j.query.algebra.evaluation.iterator.JoinIterator.getNextElement(JoinIterator.java:34)
    at org.eclipse.rdf4j.common.iteration.LookAheadIteration.lookAhead(LookAheadIteration.java:80)
    at org.eclipse.rdf4j.common.iteration.LookAheadIteration.hasNext(LookAheadIteration.java:54)
    at org.eclipse.rdf4j.query.algebra.evaluation.iterator.JoinIterator.getNextElement(JoinIterator.java:77)
    at org.eclipse.rdf4j.query.algebra.evaluation.iterator.JoinIterator.getNextElement(JoinIterator.java:34)
    at org.eclipse.rdf4j.common.iteration.LookAheadIteration.lookAhead(LookAheadIteration.java:80)
    at org.eclipse.rdf4j.common.iteration.LookAheadIteration.hasNext(LookAheadIteration.java:54)
    at org.eclipse.rdf4j.common.iteration.DualUnionIteration.getNextElement(DualUnionIteration.java:62)
    at org.eclipse.rdf4j.common.iteration.DualUnionIteration.lookAhead(DualUnionIteration.java:118)
    at org.eclipse.rdf4j.common.iteration.DualUnionIteration.hasNext(DualUnionIteration.java:92)
    at org.eclipse.rdf4j.common.iteration.ConvertingIteration.hasNext(ConvertingIteration.java:66)
    at org.eclipse.rdf4j.query.algebra.evaluation.iterator.JoinIterator.getNextElement(JoinIterator.java:77)
    at org.eclipse.rdf4j.query.algebra.evaluation.iterator.JoinIterator.getNextElement(JoinIterator.java:34)
    at org.eclipse.rdf4j.common.iteration.LookAheadIteration.lookAhead(LookAheadIteration.java:80)
    at org.eclipse.rdf4j.common.iteration.LookAheadIteration.hasNext(LookAheadIteration.java:54)
    at org.eclipse.rdf4j.common.iteration.ConvertingIteration.hasNext(ConvertingIteration.java:66)
    at org.eclipse.rdf4j.common.iteration.ConvertingIteration.hasNext(ConvertingIteration.java:66)
    at org.eclipse.rdf4j.query.algebra.evaluation.iterator.GroupIterator.buildEntries(GroupIterator.java:295)
    at org.eclipse.rdf4j.query.algebra.evaluation.iterator.GroupIterator.createIterator(GroupIterator.java:179)
    at org.eclipse.rdf4j.query.algebra.evaluation.iterator.GroupIterator.hasNext(GroupIterator.java:144)
    at org.eclipse.rdf4j.common.iteration.IterationWrapper.hasNext(IterationWrapper.java:67)
    at org.eclipse.rdf4j.common.iteration.FilterIteration.findNextElement(FilterIteration.java:78)
    at org.eclipse.rdf4j.common.iteration.FilterIteration.hasNext(FilterIteration.java:49)
    at org.eclipse.rdf4j.common.iteration.ConvertingIteration.hasNext(ConvertingIteration.java:66)
    at org.eclipse.rdf4j.common.iteration.ConvertingIteration.hasNext(ConvertingIteration.java:66)
    at org.eclipse.rdf4j.common.iteration.IterationWrapper.hasNext(IterationWrapper.java:67)
    at org.eclipse.rdf4j.common.iteration.FilterIteration.findNextElement(FilterIteration.java:78)
    at org.eclipse.rdf4j.common.iteration.FilterIteration.hasNext(FilterIteration.java:49)
    at org.eclipse.rdf4j.common.iteration.DualUnionIteration.getNextElement(DualUnionIteration.java:69)
    at org.eclipse.rdf4j.common.iteration.DualUnionIteration.lookAhead(DualUnionIteration.java:118)
    at org.eclipse.rdf4j.common.iteration.DualUnionIteration.hasNext(DualUnionIteration.java:92)
    at org.eclipse.rdf4j.common.iteration.ConvertingIteration.hasNext(ConvertingIteration.java:66)
    at org.eclipse.rdf4j.common.iteration.ConvertingIteration.hasNext(ConvertingIteration.java:66)
    at org.eclipse.rdf4j.common.iteration.IterationWrapper.hasNext(IterationWrapper.java:67)
    at org.eclipse.rdf4j.sail.base.SailClosingIteration.hasNext(SailClosingIteration.java:84)
    at org.eclipse.rdf4j.sail.helpers.TupleExprWrapperIteration.hasNext(TupleExprWrapperIteration.java:50)
    at org.eclipse.rdf4j.common.iteration.IterationWrapper.hasNext(IterationWrapper.java:67)
    at org.eclipse.rdf4j.sail.helpers.SailBaseIteration.hasNext(SailBaseIteration.java:43)
    at org.eclipse.rdf4j.sail.helpers.CleanerIteration.hasNext(CleanerIteration.java:42)
    at org.eclipse.rdf4j.common.iteration.IterationWrapper.hasNext(IterationWrapper.java:67) <28 internal lines>

Process finished with exit code 255

After using 4646 there are a few more tests failing for the same reason, they all seem to be related to http://www.w3.org/2004/02/skos/core#related

image

I'm currently analysing our project to provide steps to replicate the issue

hmottestad commented 1 year ago

That var name prefix seems to stem from the PathIteration: https://github.com/eclipse/rdf4j/blob/6641e1dc94422db65a6efe507f4d1b339c6e7659/core/queryalgebra/evaluation/src/main/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/PathIteration.java#L67

I assume that it's not a var that should leak out of the PathIteration.

vallerap commented 1 year ago

Hi guys,

Thank you for your patience. I have successfully reproduced the issue and would like to provide you with a direct link to a custom repository that demonstrates the problem: https://github.com/vallerap/rdf4j_issue_test (for simplicity I haven't used the onejar).

To reproduce the error we can simply run the main method in the class Temp. It's worth mentioning that since the error is thrown through assert it is required to use that we use the JVM parameter -ea

Please let me know if you encounter any difficulties accessing the repository.

Thank you once again for your support and cooperation :)

JervenBolleman commented 1 year ago

@vallerap @hmottestad I hope to push a fix this weekend.