How/why is Jena's LATERAL different from the spec? Should I not be relying on the current implementation? I am also wondering why VALUES is not used for substitution—was it not meant as the method for passing bindings to SERVICEs?
The SERVICE wraps a custom ServiceExecutor into an endpoint, so it's not a Fuseki. I'm executing the query using the sparql CLI command so the warning originates from it, not from my code. A simpler query: PREFIX worker: <https://example.org/ontology/worker#> PREFIX wd: <https://w3id.org/atomgraph/workday#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT * WHERE { ?dgsWorker a worker:87eba76e7f ; rdfs:label ?label . LATERAL { SERVICE <http://localhost:8181/workday/sparql> { ?wdWorker a wd:Worker ; foaf:name ?label . } } } The queries that the Workday endpoint receives look like this (one for each ?label which is a person's name) SELECT ?wdWorker ("John Doe" AS ?label) WHERE { ?wdWorker a < https://w3id.org/atomgraph/workday#Worker> ; <http://xmlns.com/foaf/0.1/name> "John Doe" } An even simpler query that still prints the same warning: PREFIX worker: <https://example.org/ontology/worker#> PREFIX wd: <https://w3id.org/atomgraph/workday#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX owl: <http://www.w3.org/2002/07/owl#> SELECT * WHERE { ?dgsWorker a worker:87eba76e7f ; rdfs:label ?label . LATERAL { SERVICE <http://localhost:8181/workday/sparql> { ?wdWorker a wd:Worker ; foaf:name ?label . } } } The query the endpoint receives then looks slightly different: SELECT * WHERE { ?wdWorker a < https://w3id.org/atomgraph/workday#Worker> ; <http://xmlns.com/foaf/0.1/name> "John Doe" BIND("John Doe" AS ?label) } On Wed, Mar 11, 2026 at 10:49 AM Andy Seaborne <[email protected]> wrote: > The current LATERAL implementation in Jena does not work the way the > spec is going. > > Jena is rewriting the query (as you can see in the Fuseki log) as > > "SELECT ?wdWorker ("string" AS ?label) {" > > which is illegal because ?label is set in the query pattern. > > At a guess, the syntax checker for LATERAL is not looking inside SERVICE > but I'd also expect the server to reject the query (400), not fail as an > execution error. > > Does that form appear in the fuseki log? > Any other messages? > > > 14:39:59 WARN QueryIterCommonParent$ConverterExtend :: Binding > already for > > ?label (same value) > > Is that in the Fuseki log or output by the local query execution log? > > Do you have a simpler query example? > > Andy > > On 09/03/2026 14:02, Martynas Jusevičius wrote: > > Hi, > > > > I found a use case for LATERAL and I'm testing a query like this: > > > > PREFIX worker: <https://example.org/ontology/worker#> > > PREFIX wd: <https://w3id.org/atomgraph/workday#> > > PREFIX foaf: <http://xmlns.com/foaf/0.1/> > > PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> > > PREFIX owl: <http://www.w3.org/2002/07/owl#> > > > > CONSTRUCT { > > ?dgsWorker owl:sameAs ?wdWorker . > > } > > WHERE { > > ?dgsWorker a worker:Person ; > > rdfs:label ?label . > > > > LATERAL { > > SERVICE <http://localhost:8181/workday/sparql> { > > SELECT ?wdWorker ?label { > > ?wdWorker a wd:Worker ; > > foaf:name ?label . > > } > > } > > } > > } > > > > It gets names from a local file and reconciles them against a virtual > > SPARQL endpoint. > > The query produces results but each SERVICE call prints a warning like > this: > > > > 14:39:59 WARN QueryIterCommonParent$ConverterExtend :: Binding already > for > > ?label (same value) > > > > What does this mean exactly? Does the query need reformulation to avoid > > this? > > > > Thanks. > > > > Martynas > > > >
