There are 2 relations:
Prediction(cname, etype)
Measures(etype, provider)
cname - city name of predicted future disaster.
etype - event type. earthquake, tsunami...
provider - police, ambulance...
I need to write a query using domain relational calculus and it should find a provider that provides service to all predicted events in Milano.
I have this so far:
{<P> | ∃et <et,P> ∈ Measures ^ ∀ ev (<'Milano', ev> ∈ Prediction
⟹ ∃pr(ev,pr) ^ pr=P)}
I am not sure about it. Is it ok? or something is wrong?
You don't give a reference to your version of RA (relational algebra) or DRC (domain relational calculus). I'll guess some syntax from your attempt.
That is a classic ambiguous use of "all"/"every". If no event types happen in Milano, do you want all providers or no providers? (This is a common issue in queries calculated via variants of relational division.)
Maybe you want providers p where for all types e, if Milano suffers e then p services e:
But from your query it seems like maybe you want providers p where there is a type that Milano suffers & for all types e, if Milano suffers e then p services e:
Your query seems to be trying to be like the following complication of that: