# Potentially bound

### Definition: potentially bound variable

Let P,P1, P2 be graph patterns, SM be a set of solution modifiers, and E,E1,...En be expressions or project expressions. A variable ?v is potentially bound within a graph pattern P if

• P is a basic graph pattern that contains ?v
• P is a list group graph patterns P1 ... Pn and ?v is potentially bound within some Pi
• P = GRAPH t { P1 } and ?v is potentially bound within P1 or ?v = t
• P = P1 FILTER ( E1 ) and ?v is potentially bound within P1, i.e. FILTER expressions cannot bind variables
• P = P1 UNION P2 and ?v is potentially bound within P1 or within P2
• P = P1 OPTIONAL { P2 } and ?v is potentially bound within P1 or within P2
• P = SELECT E1 ... En WHERE { P1 } SM such that either there is an Ei of the form ?v or (E AS ?v)
• P = P1 MINUS P2 and ?v is potentially bound within P1
• P = SERVICE t { P1 } and ?v is potentially bound within P1 or ?v = t
• P = { P1 } GROUP BY E1 ... En such that either there is an Ei of the form ?v or (E AS ?v)
• P = P1 HAVING ( E1 ) and ?v is potentially bound within P1, i.e. HAVING expressions cannot bind variables
• P = P1 BINDINGS ?v1 ... ?vn { BindingValues } and ?v is either potentially bound within P1 or ?v = ?vi
• BIND(expr AS ?var) makes ?var potentially bound.

The intuition behind the notion of "potentially bound" variables is to define variables "visible" from outside the pattern, as opposed to variables that are local to the pattern.