Une dichotomie sur l’évaluation de requêtes closes sous homomorphismes sur les graphes probabilistes
Antoine Amarilli1and İsmail İlkan Ceylan2 29 octobre 2020
1Télécom Paris
2University of Oxford
1/12
Uncertain data management
In this talk, we managedatarepresented as alabeled graph
WorksAt
Antoine Télécom Paris Antoine Paris Sud
Benny Paris Sud
Benny Technion
İsmail U. Oxford
MemberOf
Télécom Paris ParisTech Télécom Paris IP Paris
Paris Sud IP Paris Paris Sud Paris-Saclay Technion CESAER
A.
B.
İ.
Télécom Paris
Paris Sud
Technion
U. Oxford
ParisTech
IP Paris
Paris-Saclay
CESAER
→ Problem:we are notcertainabout the true state of the data
Uncertain data management
In this talk, we managedatarepresented as alabeled graph
WorksAt
Antoine Télécom Paris Antoine Paris Sud
Benny Paris Sud
Benny Technion
İsmail U. Oxford
MemberOf
Télécom Paris ParisTech Télécom Paris IP Paris
Paris Sud IP Paris Paris Sud Paris-Saclay Technion CESAER
A.
B.
İ.
Télécom Paris
Paris Sud
Technion
U. Oxford
ParisTech
IP Paris
Paris-Saclay
CESAER
→ Problem:we are notcertainabout the true state of the data
2/12
Uncertain data management
In this talk, we managedatarepresented as alabeled graph
WorksAt
Antoine Télécom Paris Antoine Paris Sud
Benny Paris Sud
Benny Technion
İsmail U. Oxford
MemberOf
Télécom Paris ParisTech Télécom Paris IP Paris
Paris Sud IP Paris Paris Sud Paris-Saclay Technion CESAER
A.
B.
İ.
Télécom Paris
Paris Sud
Technion
U. Oxford
ParisTech
IP Paris
Paris-Saclay
CESAER
→ Problem:we are notcertainabout the true state of the data
Uncertain data management
In this talk, we managedatarepresented as alabeled graph
WorksAt
Antoine Télécom Paris Antoine Paris Sud
Benny Paris Sud
Benny Technion
İsmail U. Oxford
MemberOf
Télécom Paris ParisTech Télécom Paris IP Paris
Paris Sud IP Paris Paris Sud Paris-Saclay Technion CESAER
A.
B.
İ.
Télécom Paris
Paris Sud
Technion
U. Oxford
ParisTech
IP Paris
Paris-Saclay
CESAER
→ Problem:we are notcertainabout the true state of the data
2/12
Uncertain data management
In this talk, we managedatarepresented as alabeled graph
WorksAt
Antoine Télécom Paris Antoine Paris Sud
Benny Paris Sud
Benny Technion
İsmail U. Oxford
MemberOf
Télécom Paris ParisTech Télécom Paris IP Paris
Paris Sud IP Paris Paris Sud Paris-Saclay Technion CESAER
A.
B.
İ.
Télécom Paris
Paris Sud
Technion
U. Oxford
ParisTech
IP Paris
Paris-Saclay
CESAER
→ Problem:we are notcertainabout the true state of the data
Uncertain data management
In this talk, we managedatarepresented as alabeled graph
WorksAt
Antoine Télécom Paris Antoine Paris Sud
Benny Paris Sud
Benny Technion
İsmail U. Oxford
MemberOf
Télécom Paris ParisTech Télécom Paris IP Paris
Paris Sud IP Paris Paris Sud Paris-Saclay Technion CESAER
A.
B.
İ.
Télécom Paris
Paris Sud
Technion
U. Oxford
ParisTech
IP Paris
Paris-Saclay
CESAER
→ Problem:we are notcertainabout the true state of the data
2/12
Uncertain data management
In this talk, we managedatarepresented as alabeled graph
WorksAt
Antoine Télécom Paris Antoine Paris Sud
Benny Paris Sud
Benny Technion
İsmail U. Oxford
MemberOf
Télécom Paris ParisTech Télécom Paris IP Paris
Paris Sud IP Paris Paris Sud Paris-Saclay Technion CESAER
A.
B.
İ.
Télécom Paris
Paris Sud
Technion
U. Oxford
ParisTech
IP Paris
Paris-Saclay
CESAER
→ Problem:we are notcertainabout the true state of the data 2/12
Uncertain data model A.
B.
İ.
Télécom Paris
Paris Sud
Technion
U. Oxford
ParisTech
IP Paris
Paris-Saclay
CESAER
80% 10%
40% 80%
100%
90% 90% 50%
90%
100%
•
Uncertain data model:TID, for tuple-independent database•
Each fact (edge) carries aprobability•
Each fact exists with its givenprobability•
All facts areindependent•
Possible worldW:subset of facts•
What is theprobabilityof this possible world?0.03%Pr(W) = Y
F∈W
Pr(F)
!
× Y
F∈W/
1−Pr(F)
!
3/12
Uncertain data model A.
B.
İ.
Télécom Paris
Paris Sud
Technion
U. Oxford
ParisTech
IP Paris
Paris-Saclay
CESAER 80%
10%
40%
80%
100%
90%
90%
50%
90%
100%
•
Uncertain data model:TID, for tuple-independent database•
Each fact (edge) carries aprobability•
Each fact exists with its givenprobability•
All facts areindependent•
Possible worldW:subset of facts•
What is theprobabilityof this possible world?0.03%Pr(W) = Y
F∈W
Pr(F)
!
× Y
F∈W/
1−Pr(F)
!
Uncertain data model A.
B.
İ.
Télécom Paris
Paris Sud
Technion
U. Oxford
ParisTech
IP Paris
Paris-Saclay
CESAER 80%
10%
40%
80%
100%
90%
90%
50%
90%
100%
•
Uncertain data model:TID, for tuple-independent database•
Each fact (edge) carries aprobability•
Each fact exists with its givenprobability•
All facts areindependent•
Possible worldW:subset of facts•
What is theprobabilityof this possible world?0.03%Pr(W) = Y
F∈W
Pr(F)
!
× Y
F∈W/
1−Pr(F)
!
3/12
Uncertain data model A.
B.
İ.
Télécom Paris
Paris Sud
Technion
U. Oxford
ParisTech
IP Paris
Paris-Saclay
CESAER 80%
10%
40%
80%
100%
90%
90%
50%
90%
100%
•
Uncertain data model:TID, for tuple-independent database•
Each fact (edge) carries aprobability•
Each fact exists with its givenprobability•
All facts areindependent•
Possible worldW:subset of facts•
What is theprobabilityof this possible world?0.03%Pr(W) = Y
F∈W
Pr(F)
!
× Y
F∈W/
1−Pr(F)
!
Uncertain data model A.
B.
İ.
Télécom Paris
Paris Sud
Technion
U. Oxford
ParisTech
IP Paris
Paris-Saclay
CESAER
80% 10%
40% 80%
100%
90% 90% 50%
90%
100%
•
Uncertain data model:TID, for tuple-independent database•
Each fact (edge) carries aprobability•
Each fact exists with its givenprobability•
All facts areindependent•
Possible worldW:subset of facts•
What is theprobabilityof this possible world?0.03%Pr(W) = Y
F∈W
Pr(F)
!
× Y
F∈W/
1−Pr(F)
!
3/12
Uncertain data model A.
B.
İ.
Télécom Paris
Paris Sud
Technion
U. Oxford
ParisTech
IP Paris
Paris-Saclay
CESAER
80% 10%
40% 80%
100%
90% 90% 50%
90%
100%
•
Uncertain data model:TID, for tuple-independent database•
Each fact (edge) carries aprobability•
Each fact exists with its givenprobability•
All facts areindependent•
Possible worldW:subset of facts•
What is theprobabilityof this possible world?0.03%
Pr(W) = Y
F∈W
Pr(F)
!
× Y
F∈W/
1−Pr(F)
!
Uncertain data model A.
B.
İ.
Télécom Paris
Paris Sud
Technion
U. Oxford
ParisTech
IP Paris
Paris-Saclay
CESAER 80%
10%
40%
80%
100%
90%
90%
50%
90%
100%
•
Uncertain data model:TID, for tuple-independent database•
Each fact (edge) carries aprobability•
Each fact exists with its givenprobability•
All facts areindependent•
Possible worldW:subset of facts•
What is theprobabilityof this possible world?0.03%
Pr(W) = Y
F∈W
Pr(F)
!
× Y
F∈W/
1−Pr(F)
!
3/12
Uncertain data model A.
B.
İ.
Télécom Paris
Paris Sud
Technion
U. Oxford
ParisTech
IP Paris
Paris-Saclay
CESAER 80%
10%
40%
80%
100%
90%
90%
50%
90%
100%
•
Uncertain data model:TID, for tuple-independent database•
Each fact (edge) carries aprobability•
Each fact exists with its givenprobability•
All facts areindependent•
Possible worldW:subset of facts•
What is theprobabilityof this possible world?0.03%Pr(W) = Y
F∈W
Pr(F)
!
× Y
F∈W/
1−Pr(F)
!
Uncertain data model A.
B.
İ.
Télécom Paris
Paris Sud
Technion
U. Oxford
ParisTech
IP Paris
Paris-Saclay
CESAER 80%
10%
40%
80%
100%
90%
90%
50%
90%
100%
•
Uncertain data model:TID, for tuple-independent database•
Each fact (edge) carries aprobability•
Each fact exists with its givenprobability•
All facts areindependent•
Possible worldW:subset of facts•
What is theprobabilityof this possible world?0.03%Pr(W) = Y
F∈W
Pr(F)
!
× Y
F∈W/
1−Pr(F)
!
3/12
Queries
•
Query:maps a graph (without probabilities) to YES/NO•
Conjunctive query(CQ): can I find a match of apattern? e.g., x y z→ We want ahomomorphismfrom the pattern to the graph (not necessarilyinjective)
•
Union of conjunctive queries(UCQ): can I find a match ofsome pattern?→ Homomorphism-closed queryQ: ifGsatisfiesQandGhas a homomorphism toG0 thenG0 also satisfiesQ
Intuition about homomorphism-closed queries:
•
GeneralizeCQsandUCQs, but alsoregular path queries(RPQs),Datalog, etc.•
Do not allow forinequalitiesornegation•
A homomorphism-closed query can be seen as aninfinite union of CQs:→ The query isboundedif the union is finite (it is a UCQ),unboundedotherwise
•
Allows pretty wild things, e.g., “There is a path whose length is prime”Queries
•
Query:maps a graph (without probabilities) to YES/NO•
Conjunctive query(CQ): can I find a match of apattern? e.g., x y z→ We want ahomomorphismfrom the pattern to the graph (not necessarilyinjective)
•
Union of conjunctive queries(UCQ): can I find a match ofsome pattern?→ Homomorphism-closed queryQ: ifGsatisfiesQandGhas a homomorphism toG0 thenG0 also satisfiesQ
Intuition about homomorphism-closed queries:
•
GeneralizeCQsandUCQs, but alsoregular path queries(RPQs),Datalog, etc.•
Do not allow forinequalitiesornegation•
A homomorphism-closed query can be seen as aninfinite union of CQs:→ The query isboundedif the union is finite (it is a UCQ),unboundedotherwise
•
Allows pretty wild things, e.g., “There is a path whose length is prime”4/12
Queries
•
Query:maps a graph (without probabilities) to YES/NO•
Conjunctive query(CQ): can I find a match of apattern? e.g., x y z→ We want ahomomorphismfrom the pattern to the graph (not necessarilyinjective)
•
Union of conjunctive queries(UCQ): can I find a match ofsome pattern?→ Homomorphism-closed queryQ: ifGsatisfiesQandGhas a homomorphism toG0 thenG0 also satisfiesQ
Intuition about homomorphism-closed queries:
•
GeneralizeCQsandUCQs, but alsoregular path queries(RPQs),Datalog, etc.•
Do not allow forinequalitiesornegation•
A homomorphism-closed query can be seen as aninfinite union of CQs:→ The query isboundedif the union is finite (it is a UCQ),unboundedotherwise
•
Allows pretty wild things, e.g., “There is a path whose length is prime”Queries
•
Query:maps a graph (without probabilities) to YES/NO•
Conjunctive query(CQ): can I find a match of apattern? e.g., x y z→ We want ahomomorphismfrom the pattern to the graph (not necessarilyinjective)
•
Union of conjunctive queries(UCQ): can I find a match ofsome pattern?→ Homomorphism-closed queryQ: ifGsatisfiesQandGhas a homomorphism toG0 thenG0 also satisfiesQ
Intuition about homomorphism-closed queries:
•
GeneralizeCQsandUCQs, but alsoregular path queries(RPQs),Datalog, etc.•
Do not allow forinequalitiesornegation•
A homomorphism-closed query can be seen as aninfinite union of CQs:→ The query isboundedif the union is finite (it is a UCQ),unboundedotherwise
•
Allows pretty wild things, e.g., “There is a path whose length is prime”4/12
Queries
•
Query:maps a graph (without probabilities) to YES/NO•
Conjunctive query(CQ): can I find a match of apattern? e.g., x y z→ We want ahomomorphismfrom the pattern to the graph (not necessarilyinjective)
•
Union of conjunctive queries(UCQ): can I find a match ofsome pattern?→ Homomorphism-closed queryQ: ifGsatisfiesQandGhas a homomorphism toG0 thenG0 also satisfiesQ
Intuition about homomorphism-closed queries:
•
GeneralizeCQsandUCQs, but alsoregular path queries(RPQs),Datalog, etc.•
Do not allow forinequalitiesornegation•
A homomorphism-closed query can be seen as aninfinite union of CQs:→ The query isboundedif the union is finite (it is a UCQ),unboundedotherwise
•
Allows pretty wild things, e.g., “There is a path whose length is prime”Queries
•
Query:maps a graph (without probabilities) to YES/NO•
Conjunctive query(CQ): can I find a match of apattern? e.g., x y z→ We want ahomomorphismfrom the pattern to the graph (not necessarilyinjective)
•
Union of conjunctive queries(UCQ): can I find a match ofsome pattern?→ Homomorphism-closed queryQ: ifGsatisfiesQandGhas a homomorphism toG0 thenG0 also satisfiesQ
Intuition about homomorphism-closed queries:
•
GeneralizeCQsandUCQs, but alsoregular path queries(RPQs),Datalog, etc.•
Do not allow forinequalitiesornegation•
A homomorphism-closed query can be seen as aninfinite union of CQs:→ The query isboundedif the union is finite (it is a UCQ),unboundedotherwise
•
Allows pretty wild things, e.g., “There is a path whose length is prime”4/12
Queries
•
Query:maps a graph (without probabilities) to YES/NO•
Conjunctive query(CQ): can I find a match of apattern? e.g., x y z→ We want ahomomorphismfrom the pattern to the graph (not necessarilyinjective)
•
Union of conjunctive queries(UCQ): can I find a match ofsome pattern?→ Homomorphism-closed queryQ: ifGsatisfiesQandGhas a homomorphism toG0 thenG0 also satisfiesQ
Intuition about homomorphism-closed queries:
•
GeneralizeCQsandUCQs, but alsoregular path queries(RPQs),Datalog, etc.•
Do not allow forinequalitiesornegation•
A homomorphism-closed query can be seen as aninfinite union of CQs:→ The query isboundedif the union is finite (it is a UCQ),unboundedotherwise
•
Allows pretty wild things, e.g., “There is a path whose length is prime”Queries
•
Query:maps a graph (without probabilities) to YES/NO•
Conjunctive query(CQ): can I find a match of apattern? e.g., x y z→ We want ahomomorphismfrom the pattern to the graph (not necessarilyinjective)
•
Union of conjunctive queries(UCQ): can I find a match ofsome pattern?→ Homomorphism-closed queryQ: ifGsatisfiesQandGhas a homomorphism toG0 thenG0 also satisfiesQ
Intuition about homomorphism-closed queries:
•
GeneralizeCQsandUCQs, but alsoregular path queries(RPQs),Datalog, etc.•
Do not allow forinequalitiesornegation•
A homomorphism-closed query can be seen as aninfinite union of CQs:→ The query isboundedif the union is finite (it is a UCQ),unboundedotherwise
•
Allows pretty wild things, e.g., “There is a path whose length is prime”4/12
Queries
•
Query:maps a graph (without probabilities) to YES/NO•
Conjunctive query(CQ): can I find a match of apattern? e.g., x y z→ We want ahomomorphismfrom the pattern to the graph (not necessarilyinjective)
•
Union of conjunctive queries(UCQ): can I find a match ofsome pattern?→ Homomorphism-closed queryQ: ifGsatisfiesQandGhas a homomorphism toG0 thenG0 also satisfiesQ
Intuition about homomorphism-closed queries:
•
GeneralizeCQsandUCQs, but alsoregular path queries(RPQs),Datalog, etc.•
Do not allow forinequalitiesornegation•
A homomorphism-closed query can be seen as aninfinite union of CQs:→ The query isboundedif the union is finite (it is a UCQ),unboundedotherwise
•
Allows pretty wild things, e.g., “There is a path whose length is prime”Queries
•
Query:maps a graph (without probabilities) to YES/NO•
Conjunctive query(CQ): can I find a match of apattern? e.g., x y z→ We want ahomomorphismfrom the pattern to the graph (not necessarilyinjective)
•
Union of conjunctive queries(UCQ): can I find a match ofsome pattern?→ Homomorphism-closed queryQ: ifGsatisfiesQandGhas a homomorphism toG0 thenG0 also satisfiesQ
Intuition about homomorphism-closed queries:
•
GeneralizeCQsandUCQs, but alsoregular path queries(RPQs),Datalog, etc.•
Do not allow forinequalitiesornegation•
A homomorphism-closed query can be seen as aninfinite union of CQs:→ The query isboundedif the union is finite (it is a UCQ),unboundedotherwise
•
Allows pretty wild things, e.g., “There is a path whose length is prime” 4/12Problem statement: Probabilistic query evaluation (PQE)
•
Wefixa queryQ, for instance the CQ: x y z•
Theinputis a TIDD: A.B.
İ.
Télécom Paris
Paris Sud
Technion
U. Oxford
ParisTech
IP Paris
Paris-Saclay
CESAER 80%
10%
40% 80%
100%
90% 90% 50%
90%
100%
•
Theoutputis thetotal probabilityof the worlds which satisfy the query:• Formally:P
W⊆D,W|=QPr(W)
→ Intuition:theprobabilitythat the query is true
→ What is thecomplexityof the problemPQE(Q), depending on the queryQ?
Problem statement: Probabilistic query evaluation (PQE)
•
Wefixa queryQ, for instance the CQ: x y z•
Theinputis a TIDD: A.B.
İ.
Télécom Paris
Paris Sud
Technion
U. Oxford
ParisTech
IP Paris
Paris-Saclay
CESAER 80%
10%
40%
80%
100%
90%
90%
50%
90%
100%
•
Theoutputis thetotal probabilityof the worlds which satisfy the query:• Formally:P
W⊆D,W|=QPr(W)
→ Intuition:theprobabilitythat the query is true
→ What is thecomplexityof the problemPQE(Q), depending on the queryQ?
5/12
Problem statement: Probabilistic query evaluation (PQE)
•
Wefixa queryQ, for instance the CQ: x y z•
Theinputis a TIDD: A.B.
İ.
Télécom Paris
Paris Sud
Technion
U. Oxford
ParisTech
IP Paris
Paris-Saclay
CESAER 80%
10%
40%
80%
100%
90%
90%
50%
90%
100%
•
Theoutputis thetotal probabilityof the worlds which satisfy the query:• Formally:P
W⊆D,W|=QPr(W)
→ Intuition:theprobabilitythat the query is true
→ What is thecomplexityof the problemPQE(Q), depending on the queryQ?
Problem statement: Probabilistic query evaluation (PQE)
•
Wefixa queryQ, for instance the CQ: x y z•
Theinputis a TIDD: A.B.
İ.
Télécom Paris
Paris Sud
Technion
U. Oxford
ParisTech
IP Paris
Paris-Saclay
CESAER 80%
10%
40%
80%
100%
90%
90%
50%
90%
100%
•
Theoutputis thetotal probabilityof the worlds which satisfy the query:• Formally:P
W⊆D,W|=QPr(W)
→ Intuition:theprobabilitythat the query is true
→ What is thecomplexityof the problemPQE(Q), depending on the queryQ?
5/12
Problem statement: Probabilistic query evaluation (PQE)
•
Wefixa queryQ, for instance the CQ: x y z•
Theinputis a TIDD: A.B.
İ.
Télécom Paris
Paris Sud
Technion
U. Oxford
ParisTech
IP Paris
Paris-Saclay
CESAER 80%
10%
40%
80%
100%
90%
90%
50%
90%
100%
•
Theoutputis thetotal probabilityof the worlds which satisfy the query:• Formally:P
W⊆D,W|=QPr(W)
→ Intuition:theprobabilitythat the query is true
→ What is thecomplexityof the problemPQE(Q), depending on the queryQ?
Existing results on PQE
Dichotomy on theunions of conjunctive queries(UCQs):
Theorem [Dalvi and Suciu, 2012]
•
Some UCQsQaresafeandPQE(Q)is inPTIME•
All others areunsafeandPQE(Q)is#P-hard•
The CQ x y z issafe, but the CQ x y z w isunsafe What aboutmore expressive queries?•
Work by [Fink and Olteanu, 2016] aboutnegation•
No work aboutrecursive queries(but no works about RPQs, Datalog, etc.)•
Only exception: work onontology-mediated query answering[Jung and Lutz, 2012]6/12
Existing results on PQE
Dichotomy on theunions of conjunctive queries(UCQs):
Theorem [Dalvi and Suciu, 2012]
•
Some UCQsQaresafeandPQE(Q)is inPTIME•
All others areunsafeandPQE(Q)is#P-hard•
The CQ x y z issafe, but the CQ x y z w isunsafeWhat aboutmore expressive queries?
•
Work by [Fink and Olteanu, 2016] aboutnegation•
No work aboutrecursive queries(but no works about RPQs, Datalog, etc.)•
Only exception: work onontology-mediated query answering[Jung and Lutz, 2012]Existing results on PQE
Dichotomy on theunions of conjunctive queries(UCQs):
Theorem [Dalvi and Suciu, 2012]
•
Some UCQsQaresafeandPQE(Q)is inPTIME•
All others areunsafeandPQE(Q)is#P-hard•
The CQ x y z issafe, but the CQ x y z w isunsafe What aboutmore expressive queries?•
Work by [Fink and Olteanu, 2016] aboutnegation•
No work aboutrecursive queries(but no works about RPQs, Datalog, etc.)•
Only exception: work onontology-mediated query answering[Jung and Lutz, 2012]6/12
Existing results on PQE
Dichotomy on theunions of conjunctive queries(UCQs):
Theorem [Dalvi and Suciu, 2012]
•
Some UCQsQaresafeandPQE(Q)is inPTIME•
All others areunsafeandPQE(Q)is#P-hard•
The CQ x y z issafe, but the CQ x y z w isunsafe What aboutmore expressive queries?•
Work by [Fink and Olteanu, 2016] aboutnegation•
No work aboutrecursive queries(but no works about RPQs, Datalog, etc.)•
Only exception: work onontology-mediated query answering[Jung and Lutz, 2012]Existing results on PQE
Dichotomy on theunions of conjunctive queries(UCQs):
Theorem [Dalvi and Suciu, 2012]
•
Some UCQsQaresafeandPQE(Q)is inPTIME•
All others areunsafeandPQE(Q)is#P-hard•
The CQ x y z issafe, but the CQ x y z w isunsafe What aboutmore expressive queries?•
Work by [Fink and Olteanu, 2016] aboutnegation•
No work aboutrecursive queries(but no works about RPQs, Datalog, etc.)•
Only exception: work onontology-mediated query answering[Jung and Lutz, 2012]6/12
Existing results on PQE
Dichotomy on theunions of conjunctive queries(UCQs):
Theorem [Dalvi and Suciu, 2012]
•
Some UCQsQaresafeandPQE(Q)is inPTIME•
All others areunsafeandPQE(Q)is#P-hard•
The CQ x y z issafe, but the CQ x y z w isunsafe What aboutmore expressive queries?•
Work by [Fink and Olteanu, 2016] aboutnegation•
No work aboutrecursive queries(but no works about RPQs, Datalog, etc.)•
Only exception: work onontology-mediated query answering[Jung and Lutz, 2012]Our result
We study PQE forhomomorphism-closed queriesand show:
Theorem
For anyquery Q closed under homomorphisms:
•
EitherQis equivalent to asafe UCQ(hencebounded) andPQE(Q)is inPTIME•
In all other cases,PQE(Q)is#P-hard•
This extends the result of [Jung and Lutz, 2012] and covers RPQs, Datalog, etc.•
Example: theRPQQ: ∗• It isnot equivalent to a UCQ: infinite disjunction i
for alli∈N
• Hence,PQE(Q)is#P-hard
•
We do not study thecomplexity of deciding which case applies• Depends on how queries arerepresented
7/12
Our result
We study PQE forhomomorphism-closed queriesand show:
Theorem
For anyquery Q closed under homomorphisms:
•
EitherQis equivalent to asafe UCQ(hencebounded) andPQE(Q)is inPTIME•
In all other cases,PQE(Q)is#P-hard•
This extends the result of [Jung and Lutz, 2012] and covers RPQs, Datalog, etc.•
Example: theRPQQ: ∗• It isnot equivalent to a UCQ: infinite disjunction i
for alli∈N
• Hence,PQE(Q)is#P-hard
•
We do not study thecomplexity of deciding which case applies• Depends on how queries arerepresented
Our result
We study PQE forhomomorphism-closed queriesand show:
Theorem
For anyquery Q closed under homomorphisms:
•
EitherQis equivalent to asafe UCQ(hencebounded) andPQE(Q)is inPTIME•
In all other cases,PQE(Q)is#P-hard•
This extends the result of [Jung and Lutz, 2012] and covers RPQs, Datalog, etc.•
Example: theRPQQ: ∗• It isnot equivalent to a UCQ: infinite disjunction i
for alli∈N
• Hence,PQE(Q)is#P-hard
•
We do not study thecomplexity of deciding which case applies• Depends on how queries arerepresented
7/12
Our result
We study PQE forhomomorphism-closed queriesand show:
Theorem
For anyquery Q closed under homomorphisms:
•
EitherQis equivalent to asafe UCQ(hencebounded) andPQE(Q)is inPTIME•
In all other cases,PQE(Q)is#P-hard•
This extends the result of [Jung and Lutz, 2012] and covers RPQs, Datalog, etc.•
Example: theRPQQ: ∗• It isnot equivalent to a UCQ: infinite disjunction i
for alli∈N
• Hence,PQE(Q)is#P-hard
•
We do not study thecomplexity of deciding which case applies• Depends on how queries arerepresented
Our result
We study PQE forhomomorphism-closed queriesand show:
Theorem
For anyquery Q closed under homomorphisms:
•
EitherQis equivalent to asafe UCQ(hencebounded) andPQE(Q)is inPTIME•
In all other cases,PQE(Q)is#P-hard•
This extends the result of [Jung and Lutz, 2012] and covers RPQs, Datalog, etc.•
Example: theRPQQ: ∗• It isnot equivalent to a UCQ: infinite disjunction i
for alli∈N
• Hence,PQE(Q)is#P-hard
•
We do not study thecomplexity of deciding which case applies• Depends on how queries arerepresented
7/12
Our result
We study PQE forhomomorphism-closed queriesand show:
Theorem
For anyquery Q closed under homomorphisms:
•
EitherQis equivalent to asafe UCQ(hencebounded) andPQE(Q)is inPTIME•
In all other cases,PQE(Q)is#P-hard•
This extends the result of [Jung and Lutz, 2012] and covers RPQs, Datalog, etc.•
Example: theRPQQ: ∗• It isnot equivalent to a UCQ: infinite disjunction i
for alli∈N
• Hence,PQE(Q)is#P-hard
•
We do not study thecomplexity of deciding which case applies• Depends on how queries arerepresented
Proof structure
Basic idea: finding a tight pattern
The challenging part is to show:
Theorem
For any queryQclosed under homomorphisms andunbounded,PQE(Q)is#P-hard
Idea: find atight pattern, i.e., a graph with three distinguished edges such that:
•
• •
• satisfiesQ
but •
•
•
•
•
• violatesQ
Theorem
Any unbounded query closed under homomorphisms has a tight pattern
Basic idea: finding a tight pattern
The challenging part is to show:
Theorem
For any queryQclosed under homomorphisms andunbounded,PQE(Q)is#P-hard Idea: find atight pattern, i.e., a graph with three distinguished edges such that:
•
• •
• satisfiesQ
but •
•
•
•
•
• violatesQ
Theorem
Any unbounded query closed under homomorphisms has a tight pattern
8/12
Basic idea: finding a tight pattern
The challenging part is to show:
Theorem
For any queryQclosed under homomorphisms andunbounded,PQE(Q)is#P-hard Idea: find atight pattern, i.e., a graph with three distinguished edges such that:
•
• •
• satisfiesQ
but
•
•
•
•
•
• violatesQ
Theorem
Any unbounded query closed under homomorphisms has a tight pattern
Basic idea: finding a tight pattern
The challenging part is to show:
Theorem
For any queryQclosed under homomorphisms andunbounded,PQE(Q)is#P-hard Idea: find atight pattern, i.e., a graph with three distinguished edges such that:
•
• •
• satisfiesQ
but •
•
•
•
•
• violatesQ
Theorem
Any unbounded query closed under homomorphisms has a tight pattern
8/12
Basic idea: finding a tight pattern
The challenging part is to show:
Theorem
For any queryQclosed under homomorphisms andunbounded,PQE(Q)is#P-hard Idea: find atight pattern, i.e., a graph with three distinguished edges such that:
•
• •
• satisfiesQ
but •
•
•
•
•
• violatesQ
Theorem
Any unbounded query closed under homomorphisms has a tight pattern
Using tight patterns to show hardness of PQE
•
Fix the queryQand thetight pattern:•
• •
• satisfiesQ
but •
•
•
•
•
• violatesQ
AND •
•
•
•
•
• violatesQ
•
We reduce from PQE for theunsafeCQ:Q0: x y z w a01a02 a03
a1
a2
a3
b1
b2
b01
b02 1/2
1/2 1/2
1/2
1/2
is coded as
•
•
•
•
•
•
•
•
• 1/21/21/2
1/2 1/2
Idea:possible worlds at thelefthave a path that matchesQ0
iff the corresponding possible world of the TID at therightsatisfies the queryQ... ... except we needmorefrom the tight pattern!
9/12
Using tight patterns to show hardness of PQE
•
Fix the queryQand thetight pattern:•
• •
• satisfiesQ
but •
•
•
•
•
• violatesQ
AND •
•
•
•
•
• violatesQ
•
We reduce from PQE for theunsafeCQ:Q0: x y z wa01 a02 a03
a1
a2
a3
b1
b2
b01
b02 1/2
1/2 1/2
1/2
1/2
is coded as
•
•
•
•
•
•
•
•
• 1/21/21/2
1/2 1/2
Idea:possible worlds at thelefthave a path that matchesQ0
iff the corresponding possible world of the TID at therightsatisfies the queryQ... ... except we needmorefrom the tight pattern!
Using tight patterns to show hardness of PQE
•
Fix the queryQand thetight pattern:•
• •
• satisfiesQ
but •
•
•
•
•
• violatesQ
AND •
•
•
•
•
• violatesQ
•
We reduce from PQE for theunsafeCQ:Q0: x y z w a01a02 a03
a1
a2
a3
b1
b2
b01
b02 1/2
1/2 1/2
1/2
1/2
is coded as
•
•
•
•
•
•
•
•
• 1/21/21/2
1/2 1/2
Idea:possible worlds at thelefthave a path that matchesQ0
iff the corresponding possible world of the TID at therightsatisfies the queryQ... ... except we needmorefrom the tight pattern!
9/12
Using tight patterns to show hardness of PQE
•
Fix the queryQand thetight pattern:•
• •
• satisfiesQ
but •
•
•
•
•
• violatesQ
AND •
•
•
•
•
• violatesQ
•
We reduce from PQE for theunsafeCQ:Q0: x y z w a01a02 a03
a1
a2
a3
b1
b2
b01
b02 1/2
1/2 1/2
1/2
1/2
is coded as
•
•
•
•
•
•
•
•
• 1/21/21/2
1/2 1/2
Idea:possible worlds at thelefthave a path that matchesQ0
iff the corresponding possible world of the TID at therightsatisfies the queryQ...
... except we needmorefrom the tight pattern!
Using tight patterns to show hardness of PQE
•
Fix the queryQand thetight pattern:•
• •
• satisfiesQ
but •
•
•
•
•
• violatesQ
AND •
•
•
•
•
• violatesQ
•
We reduce from PQE for theunsafeCQ:Q0: x y z w a01a02 a03
a1
a2
a3
b1
b2
b01
b02
1/2 1/2 1/2
1/2
1/2
is coded as
•
•
•
•
•
•
•
•
•
1/21/21/2
1/2 1/2
Idea:possible worlds at thelefthave a path that matchesQ0
iff the corresponding possible world of the TID at therightsatisfies the queryQ...
... except we needmorefrom the tight pattern!
9/12
Using tight patterns to show hardness of PQE
•
Fix the queryQand thetight pattern:•
• •
• satisfiesQ
but •
•
•
•
•
• violatesQ
AND •
•
•
•
•
• violatesQ
•
We reduce from PQE for theunsafeCQ:Q0: x y z w a01a02 a03
a1
a2
a3
b1
b2
b01
b02
1/2 1/2 1/2
1/2
1/2
is coded as
•
•
•
•
•
•
•
•
•
1/21/21/2
1/2 1/2
Idea:possible worlds at thelefthave a path that matchesQ0
iff the corresponding possible world of the TID at therightsatisfies the queryQ...
... except we needmorefrom the tight pattern!
Using tight patterns to show hardness of PQE
•
Fix the queryQand thetight pattern:•
• •
• satisfiesQ
but •
•
•
•
•
• violatesQ
AND •
•
•
•
•
• violatesQ
•
We reduce from PQE for theunsafeCQ:Q0: x y z w a01a02 a03
a1
a2
a3
b1
b2
b01
b02
1/2 1/2 1/2
1/2
1/2
is coded as
•
•
•
•
•
•
•
•
•
1/21/21/2
1/2 1/2
Idea:possible worlds at thelefthave a path that matchesQ0
iff the corresponding possible world of the TID at therightsatisfies the queryQ...
... except we needmorefrom the tight pattern! 9/12
Using tight patterns to show hardness of PQE
•
Fix the queryQand thetight pattern:•
• •
• satisfiesQ
but •
•
•
•
•
• violatesQ
AND •
•
•
•
•
• violatesQ
•
We reduce from PQE for theunsafeCQ:Q0: x y z w a01a02 a03
a1
a2
a3
b1
b2
b01
b02
1/2 1/2 1/2
1/2
1/2
is coded as
•
•
•
•
•
•
•
•
•
1/21/21/2
1/2 1/2
Idea:possible worlds at thelefthave a path that matchesQ0
iff the corresponding possible world of the TID at therightsatisfies the queryQ...
... except we needmorefrom the tight pattern! 9/12
Saving the proof
We know that we have atight pattern:
•
• •
• satisfiesQ
but •
•
•
•
•
• violatesQ
Consider itsiterates
for eachn∈N:
•
• • • •
•
n
Case 1:some iterateviolatesthe query:
•
• • • •
•
i
satisfiesQ
but •
• • • •
•
i+1
violatesQ
→ Reduce fromPQE(Q0)as we explained Case 2:all iteratessatisfythe query:
•
• • • •
•
n
satisfiesQfor alln ∈N
but •
•
•
•
•
• violatesQ
→ Call this aniterable pattern
10/12
Saving the proof
We know that we have atight pattern:
•
• •
• satisfiesQ
but •
•
•
•
•
• violatesQ Consider itsiterates
for eachn∈N:
•
• • • •
•
n
Case 1:some iterateviolatesthe query:
•
• • • •
• i
satisfiesQ
but •
• • • •
• i+1
violatesQ
→ Reduce fromPQE(Q0)as we explained Case 2:all iteratessatisfythe query:
•
• • • •
• n
satisfiesQfor alln∈N
but •
•
•
•
•
• violatesQ
→ Call this aniterable pattern
Saving the proof
We know that we have atight pattern:
•
• •
• satisfiesQ
but •
•
•
•
•
• violatesQ Consider itsiteratesfor eachn∈N:
•
• • • •
• n
Case 1:some iterateviolatesthe query:
•
• • • •
• i
satisfiesQ
but •
• • • •
• i+1
violatesQ
→ Reduce fromPQE(Q0)as we explained Case 2:all iteratessatisfythe query:
•
• • • •
• n
satisfiesQfor alln∈N
but •
•
•
•
•
• violatesQ
→ Call this aniterable pattern
10/12
Saving the proof
We know that we have atight pattern:
•
• •
• satisfiesQ
but •
•
•
•
•
• violatesQ Consider itsiteratesfor eachn∈N:
•
• • • •
• n
Case 1:some iterateviolatesthe query:
•
• • • •
• i
satisfiesQ
but •
• • • •
• i+1
violatesQ
→ Reduce fromPQE(Q0)as we explained Case 2:all iteratessatisfythe query:
•
• • • •
• n
satisfiesQfor alln∈N
but •
•
•
•
•
• violatesQ
→ Call this aniterable pattern
Saving the proof
We know that we have atight pattern:
•
• •
• satisfiesQ
but •
•
•
•
•
• violatesQ Consider itsiteratesfor eachn∈N:
•
• • • •
• n
Case 1:some iterateviolatesthe query:
•
• • • •
• i
satisfiesQ
but •
• • • •
• i+1
violatesQ
→ Reduce fromPQE(Q0)as we explained Case 2:all iteratessatisfythe query:
•
• • • •
• n
satisfiesQfor alln∈N
but •
•
•
•
•
• violatesQ
→ Call this aniterable pattern
10/12
Saving the proof
We know that we have atight pattern:
•
• •
• satisfiesQ
but •
•
•
•
•
• violatesQ Consider itsiteratesfor eachn∈N:
•
• • • •
• n
Case 1:some iterateviolatesthe query:
•
• • • •
• i
satisfiesQ
but •
• • • •
• i+1
violatesQ
→ Reduce fromPQE(Q0)as we explained
Case 2:all iteratessatisfythe query:
•
• • • •
• n
satisfiesQfor alln∈N
but •
•
•
•
•
• violatesQ
→ Call this aniterable pattern