query-cf8e08f360717a2360681f3128850c3b
So, OP, you would need to check dates with a filter; here I've changed the main search term to "three" to see what we get.
Use at
- https://query.wikidata.org/sparql
PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?itemDescription (group_concat(distinct YEAR(?publication_date);separator=", ") as ?pd) (group_concat(distinct ?imdb_code;separator="; ") as ?imdb) (GROUP_CONCAT(distinct ?directorLabel;separator="; ") AS ?directors) (GROUP_CONCAT(distinct ?screenwriterLabel;separator="; ") AS ?screenwriter) 
WHERE {
 SERVICE wikibase:mwapi
 {
   bd:serviceParam wikibase:api "Search" .
   bd:serviceParam wikibase:endpoint "www.wikidata.org" .
   bd:serviceParam mwapi:srnamespace "0" .
   bd:serviceParam mwapi:srsearch "1997 haswbstatement:P31=Q11424 inlabel:'three'@en" .
   ?item wikibase:apiOutputItem mwapi:title.
 }
  OPTIONAL {?item wdt:P577 ?publication_date }
  OPTIONAL {?item wdt:P345 ?imdb_code .}
  OPTIONAL {?item wdt:P57 ?director .}
  OPTIONAL {?item wdt:P58 ?screenwriter .}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,it,es,de,fr,hu,ro" . 
                            ?item rdfs:label ?itemLabel .
                            ?director rdfs:label ?directorLabel .
                            ?screenwriter rdfs:label ?screenwriterLabel.
                            ?item schema:description ?itemDescription .
                         } 
} group by ?item ?itemLabel ?itemDescription
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v4("?director")
  v7("?directorLabel"):::projected 
  v12("?directors")
  v11("?imdb")
  v3("?imdb_code"):::projected 
  v1("?item"):::projected 
  v9("?itemDescription"):::projected 
  v6("?itemLabel"):::projected 
  v10("?pd")
  v2("?publication_date"):::projected 
  v13("?screenwriter")
  v8("?screenwriterLabel"):::projected 
  c6(["www.wikidata.org"]):::literal 
  c19(["#91;AUTO_LANGUAGE#93;,en,it,es,de,fr,hu,ro"]):::literal 
  c10(["1997 haswbstatement:P31=Q11424 inlabel:'three'@en"]):::literal 
  c8(["0"]):::literal 
  c2(["bd:serviceParam"]):::iri 
  c4(["Search"]):::literal 
  c12(["mwapi:title"]):::iri 
  subgraph s1["http://wikiba.se/ontology#mwapi"]
    style s1 stroke-width:4px;
    c2 --"mwapi:api"-->  c4
    c2 --"mwapi:endpoint"-->  c6
    c2 --"mwapi:srnamespace"-->  c8
    c2 --"mwapi:srsearch"-->  c10
    v1 --"mwapi:apiOutputItem"-->  c12
  end
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v1 -."wdt:P577".->  v2
  end
  subgraph optional1["(optional)"]
  style optional1 fill:#bbf,stroke-dasharray: 5 5;
    v1 -."wdt:P345".->  v3
  end
  subgraph optional2["(optional)"]
  style optional2 fill:#bbf,stroke-dasharray: 5 5;
    v1 -."wdt:P57".->  v4
  end
  subgraph optional3["(optional)"]
  style optional3 fill:#bbf,stroke-dasharray: 5 5;
    v1 -."wdt:P58".->  v13
  end
  subgraph s2["http://wikiba.se/ontology#label"]
    style s2 stroke-width:4px;
    c2 --"mwapi:language"-->  c19
    v1 --"rdfs:label"-->  v6
    v4 --"rdfs:label"-->  v7
    v13 --"rdfs:label"-->  v8
    v1 --"schema:description"-->  v9
  end
  bind4[/"year-from-dateTime(?publication_date)"/]
  v2 --o bind4
  bind4 --as--o v10
  bind5[/"?imdb_code"/]
  v3 --o bind5
  bind5 --as--o v11
  bind6[/"?directorLabel"/]
  v7 --o bind6
  bind6 --as--o v12
  bind7[/"?screenwriterLabel"/]
  v8 --o bind7
  bind7 --as--o v13