Not understanding UNION well, or something

I'm trying to expand the query shown at 
http://www.snee.com/bobdc.blog/2008/11/sparql-at-the-movies.html#id203668 
to include the director and movie names in the result of the query sent 
to http://data.linkedmdb.org/sparql. I guess my main problem is trying 
to understand how I can set it up so that ?actor is bound to the same 
value throughout the query but ?movie and ?movieName can be bound to 
different values in the two patterns. I know that one actor was in a 
single movie by each of the two directors named below, and while the 
following doesn't give me an error when submitted it gives an unrelated 
set of data. I may be going about it completely wrong.

Any suggestions?

thanks,

Bob

####################

SELECT ?actorName ?dirName ?movieName WHERE {

  ?dir1 <http://data.linkedmdb.org/resource/movie/director_name> "John 
Waters".
  ?dir2 <http://data.linkedmdb.org/resource/movie/director_name> "Steven 
Spielberg".

  ?actor  <http://data.linkedmdb.org/resource/movie/actor_name> ?actorName.

   {
     ?movie <http://data.linkedmdb.org/resource/movie/director> ?dir1;
            <http://data.linkedmdb.org/resource/movie/actor> ?actor;
            <http://purl.org/dc/terms/title> ?movieName.
     ?dir1 <http://data.linkedmdb.org/resource/movie/director_name> 
?dirName.
   }

   UNION

   {
     ?movie <http://data.linkedmdb.org/resource/movie/director> ?dir2;
            <http://data.linkedmdb.org/resource/movie/actor> ?actor;
            <http://purl.org/dc/terms/title> ?movieName.
     ?dir2 <http://data.linkedmdb.org/resource/movie/director_name> 
?dirName.
   }
}

Received on Thursday, 13 November 2008 00:07:24 UTC