Meeting minutes
Discussion: subqueries -- LATERAL-like and parameterization-like behaviours
AndyS: Added sometests to exists-filter for filter inside {},and OPTIONAL
AndyS: Inside subqueries, a variable can be "hidden" by projection
Example 1
SELECT ?v WHERE {
BIND ( <ex:a> AS ?v )
FILTER EXISTS { SELECT ?v WHERE { FILTER (?v = <ex:a>) } }
}
Example 2
SELECT ?v WHERE {
BIND ( <ex:a> AS ?v )
FILTER EXISTS {
SELECT ?Z WHERE {
BIND("abc" AS ?Z)
FILTER (?v = <ex:a>)
} }
}
AndyS: parameterized-like vs LATERAL-like
james: pref like a parameterized query
… because have seen this on our services
<pfps> is there any definition of parameterized queries?
<pfps> how about in SHACL?
james: No there isn't
… one should tend have something as close as possible to parameterized queries
tpt: Maybe to 2 kinds and param query : SQL like is replace regardless
… and scoped considered defn
pfps: SHACL?
AndyS: SHACL has a similar mechanism .. a bit weak , e.g. can get into bad queries.
<pfps> does SQL have a mechanism for hiding interior variables?
AndyS: SHACL 1.2 does not use SPARQL so widely
<pfps> if not, then I don't see that experience from SQL is relevant
tpt: SQL -- Prepared queries
Tallted: no protection in ODBC/JDBC - but we(OpenLink) add defenses
<Tpt> SELECT employee_number, name
<Tpt> FROM employees emp
<Tpt> WHERE salary > (
<Tpt> SELECT AVG(salary)
<Tpt> FROM employees
<Tpt> WHERE department = emp.department);
james: Q to tpt -- dynamic scope vs parameterized queries
tpt: this SQL
james: what is the relation to parameters and whether they have scope of the query
tpt: we substitute in the subquery IFF variables exposed.
tpt: Correlated behavior
<AndyS> s/correated/correlated/
tpt: capture inside if in the project
james: there are case where the expecation is the opposite.
tpt: example SELECT ?x WHERE ... ?y ... and binding ?y
… do we have to use the same mechanism parameterized and LATERAL - seem like two similiar but different
james: maybe having one is easier to explain
AndyS: Looking at SQL has a distraction: we are talking at mechanism that works on SPARQL variables but SQL has no variable
Andy: In Tpt's example it's correlation, we need to be careful taking from SQL
AndyS: If I remember correctly you have to replace all parameters in the parametrized query
tpt: Agree SQL is different because parameterization and correlation are separate concepts
… SQL is an inspiration
AndyS: The renaming is a separate step, we can use it only on LATERAL but not in parameterized query while sharing execution
gtw: No strong feeling - slightly in favor of composability i.e. correlated
… which is a little further from SPARQL 1.1
<pfps> I prefer to have project hide here just like it does elsewhere
pfps: prefer that projection hides so hidden naming renaming is idempotent
FILTER EXISTS { SELECT ?v WHERE { FILTER (?v = <ex:a>) } }
<pfps> FILTER EXISTS { SELECT ?X WHERE { FILTER (?v = <ex:a> ) } }
<pfps> first affected, second not
pfps: latter case ?v is not affected
tallted: SQL - different parameterization syntax for the parameterization position.
james: in the back of my mind - there are cases where a variable in a filter regardless of position is intended to have an effect.
<AndyS> s/where having a variable/
<james> ... where the variable is intended to be a request parameter.
<TallTed> relatively recent documentation (last updated circa 2016) --
<TallTed> 16.2.5. SPARQL Inline in SQL
gtw: in AWS the open cypher style of different syntax for parameter points.
Topic for next time
<gtw> potential regrets for next week (some uncertainty).
<james> i would be here