Question: I am using the Wikidata Query Service (<https://query.wikidata.org>) to get details about movies and Tv shows.

I know I can query for genre of all items that are instance of film (query below) but I want to look for just specific movies. 

```
SELECT ?item ?itemLabel ?genreLabel
WHERE
{
    ?item wdt:P31 wd:Q11424 .
    OPTIONAL {
        ?item wdt:P136 ?genre
    }
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
} LIMIT 10

```

I have a list of the Wikidata item numbers (Q###) for movies and Tv shows that I want to get properties about. I need to query these specific films or TV shows. For example, if I know that Star Wars Episode IV: A New Hope is Q17738 in Wikidata, how can I query for specific properties of it?

Answer: 
There are (at least) two ways of specifying multiple items in SPARQL.

`FILTER (?item IN (...list...))`: [SPARQL definition](https://www.w3.org/TR/sparql11-query/#func-in)

```
SELECT ?item ?itemLabel ?genreLabel
WHERE
{
    ?item wdt:P31 wd:Q11424 .

    FILTER (?item IN (wd:Q17738, wd:Q181795))

    OPTIONAL {
        ?item wdt:P136 ?genre
    }
    SERVICE wikibase:label { bd:serviceParam wikibase:language  
                                "[AUTO_LANGUAGE],en" }
} LIMIT 10

```

`VALUES ?item { ...list... }`: [SPARQL definition](https://www.w3.org/TR/sparql11-query/#inline-data)

```
SELECT ?item ?itemLabel ?genreLabel
WHERE
{
    ?item wdt:P31 wd:Q11424 .

    VALUES ?item { wd:Q17738 wd:Q181795 }

    OPTIONAL {
        ?item wdt:P136 ?genre
    }
    SERVICE wikibase:label { bd:serviceParam wikibase:language  
                                "[AUTO_LANGUAGE],en" }
} LIMIT 10

```

The difference is that `IN` is simply a function: is argument in this list?

`VALUES` is a way to pass in data to a query. Although we used the simple form you can provide full, tabular data:

```
VALUES (?x ?y) {
   (:uri1 1)
   (:uri2 UNDEF)
}

```

The syntax has a special case for one variable, so I didn't have to write `VALUES ?item { (wd:Q17738) (wd:Q181795) }`.
You could get properties about a given entity from the SPARQL endpoint, but you are probably better off querying the [`wbgetentities`](https://www.wikidata.org/w/api.php?action=help&modules=wbgetentities) Wikidata API module.

Ex: <https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q17738&languages=en|de|fr&format=json>

See also: [Getting readable results from Wikidata](https://stackoverflow.com/a/31290824/3324977)