[SPARQL] how to query when the entity code is known

Querying with Q-code known

How did I encounter this?

Since I decided to separate the query into pieces, the subsequent queries start by the retrieved entity codes. This is how to use the entity code.

Syntax

SELECT ?someData
WHERE {
  wd:Q1234 wdt:P31 ?someData .
}
  • wd:Q1234 is the entity Q-code (the item whose data you want).
  • wdt:P31 is the property (e.g., “instance of”) desired to be queried.
  • ?someData is the variable capturing the result (e.g., the type of wd:Q1234).

Comments