Were M2 and M3 executive produced by a spouse of M0 and written by a producer and director of M1
SELECT count(*) WHERE {
?x0 ns:people.person.spouse_s/ns:people.marriage.spouse|ns:fictional_universe.fictional_character.married_to/ns:fictional_universe.marriage_of_fictional_characters.spouses M0 .
?x1 ns:film.director.film M1 .
?x1 ns:film.producer.film|ns:film.production_company.films M1 .
FILTER ( ?x0 != M0 ) .
M2 ns:film.film.executive_produced_by ?x0 .
M2 ns:film.film.written_by ?x1 .
M3 ns:film.film.executive_produced_by ?x0 .
M3 ns:film.film.written_by ?x1
}