Question: What is the most specific concept that is a subclass of both a journalist and a business?

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?class WHERE {
  wd:Q1930187 wdt:P279 * ?class .
  wd:Q4830453 wdt:P279 * ?class .
  FILTER(?class != wd:Q1930187 && ?class != wd:Q4830453)
  OPTIONAL {
    ?class wdt:P279 ?child .
  }
}
GROUP BY ?class
ORDER BY ASC(COUNT(?child))
LIMIT 1

Which entity is reachable from both Kelly Wallace's occupation and Qualcomm's type via the fewest subclass steps?

Find the common superclass of journalist and business that is most specific in the Wikidata ontology.

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q6386328> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q544847> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: Airports in the Netherlands

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?airport WHERE {
  ?airport wdt:P31 wd:Q1248784 ; wdt:P17 wd:Q55 .
}

What airports are located in the Netherlands?

SELECT DISTINCT ?var1 ?var2 WHERE { ?var1 <http://www.wikidata.org/prop/direct/P31> <http://www.wikidata.org/entity/Q1248784> . ?var1 ?var2 <http://www.wikidata.org/entity/Q55> . }


Question: What is the most general category that both Silicon Valley and Elon Musk belong to, based on their types and their hierarchical ancestors?

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?common(COUNT(?t1) AS ?dist1)(COUNT(?t2) AS ?dist2)(?dist1 + ?dist2 AS ?total) WHERE {
  wd:Q163820 wdt:P31 ?t1 .
  ?t1 wdt:P279 * ?common .
  wd:Q317521 wdt:P31 ?t2 .
  ?t2 wdt:P279 * ?common .
}
GROUP BY ?common
ORDER BY ASC(?total)
LIMIT 1

Which philosophical or ontological class is the closest common ancestor between the types of Silicon Valley and Elon Musk?

Find the shared class in the hierarchy that connects Silicon Valley and Elon Musk with the shortest total path length through their type classifications.

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q163820> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q317521> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What are the cities in southern England with their images, Wikimedia Commons categories, and coordinates?

SELECT ?item ?itemLabel ?location ?image ?commonsCategory ?postalCode WHERE { VALUES ?item { wd:Q179224 wd:Q29303 wd:Q180179 wd:Q180180 wd:Q180181 wd:Q207639 wd:Q180183 wd:Q180184 } ?item wdt:P625 ?location . OPTIONAL { ?item wdt:P18 ?image . } OPTIONAL { ?item wdt:P373 ?commonsCategory . } OPTIONAL { ?item wdt:P969 ?postalCode . } ?item rdfs:label ?itemLabel . FILTER(LANG(?itemLabel) = "en") } LIMIT 3000

Show me landmarks in Kent and West Sussex along with their photos, Commons categories, and geographic locations.

List towns in southern England including their postal codes, images, and associated Wikimedia Commons categories.

SELECT ?var1 ?var1Label ?var2 ?var3 ?var4 ?var5 ?var6 ?var7 WHERE { SERVICE <http://wikiba.se/ontology#box> { ?var1 <http://www.wikidata.org/prop/direct/P625> ?var2 . <http://www.bigdata.com/rdf#serviceParam> <http://wikiba.se/ontology#cornerSouthWest> "POINT(-5 51)"^^<http://www.opengis.net/ont/geosparql#wktLiteral> . <http://www.bigdata.com/rdf#serviceParam> <http://wikiba.se/ontology#cornerNorthEast> "POINT(-1 52)"^^<http://www.opengis.net/ont/geosparql#wktLiteral> . } OPTIONAL { ?var1 <http://www.wikidata.org/prop/direct/P18> ?var3 . } OPTIONAL { ?var1 <http://www.wikidata.org/prop/direct/P373> ?var6 . } OPTIONAL { ?var1 <http://www.wikidata.org/prop/direct/P969> ?var7 . } SERVICE <http://wikiba.se/ontology#label> { <http://www.bigdata.com/rdf#serviceParam> <http://wikiba.se/ontology#language> "string1". ?var1 <http://schema.org/description> ?var5 . ?var1 <http://www.w3.org/2000/01/rdf-schema#label> ?var1Label . } } LIMIT 3000


Question: List all current sovereign countries with their capitals and ISO codes, in alphabetical order.

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT DISTINCT ?country ?countryLabel ?capital ?capitalLabel ?isoCode WHERE {
  ?country wdt:P31 wd:Q3624078 .
  OPTIONAL {
    ?country wdt:P36 ?capital .
    ?capital rdfs:label ?capitalLabel .
    FILTER(LANG(?capitalLabel) = "en")
  }
  FILTER(NOT EXISTS {
    ?country wdt:P31 wd:Q3024240 .
  })
  OPTIONAL {
    ?country wdt:P297 ?isoCode .
  }
  ?country rdfs:label ?countryLabel .
  FILTER(LANG(?countryLabel) = "en")
}
ORDER BY ASC(?countryLabel)

What are the names, capitals, and ISO 3166-1 codes of all existing sovereign states, with labels in English?

Please provide a list of all active countries, including their English names, capital cities, and two-letter ISO codes, sorted alphabetically by country name.

SELECT DISTINCT ?var1 ?var1Label ?var2 ?var2Label ?var3 WHERE { ?var1 <http://www.wikidata.org/prop/direct/P31> <http://www.wikidata.org/entity/Q3624078> . OPTIONAL { ?var1 <http://www.wikidata.org/prop/direct/P36> ?var2 . } SERVICE <http://wikiba.se/ontology#label> { <http://www.bigdata.com/rdf#serviceParam> <http://wikiba.se/ontology#language> "en". } FILTER ( ( NOT EXISTS { ?var1 <http://www.wikidata.org/prop/direct/P31> <http://www.wikidata.org/entity/Q3024240> . } ) ) . OPTIONAL { ?var1 <http://www.wikidata.org/prop/direct/P297> ?var3 . } } ORDER BY ASC( ?var1Label )


Question: What is the most specific common category that both Iron Man and Thor (Marvel) belong to?

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?commonClass WHERE {
  wd:Q180704 wdt:P31 ?commonClass .
  wd:Q717588 wdt:P31 ?commonClass .
}

Which class do Iron Man and Thor (Marvel) have in common?

What is the shared superclass of Iron Man and Thor in the Marvel Comics universe?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q43263422> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q180704> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: Top chess tournaments and Chess Olympiads by number of non-French media references.

SELECT ?event (COUNT(DISTINCT ?mediaItem) AS ?mediaCount)
WHERE {
  {
    ?event wdt:P31 wd:Q2210277 .  # chess tournament
  } UNION {
    ?event wdt:P31 wd:Q428303 .   # Chess Olympiad
  }
  ?mediaItem schema:about ?event .
  FILTER NOT EXISTS {
    ?frenchMediaItem schema:about ?event ;
                     schema:inLanguage "fr" .
  }
}
GROUP BY ?event
ORDER BY DESC(?mediaCount)
LIMIT 100

Which chess tournaments and Chess Olympiads have the most Wikipedia or Wikimedia media items, excluding French-language ones?

Show me the 100 most documented chess events (tournaments and Olympiads) based on how many non-French articles or images are linked to them on Wikimedia projects.

SELECT ?var1 ( COUNT ( DISTINCT ?var2 ) AS ?var3 ) WHERE { { ?var1 <http://www.wikidata.org/prop/direct/P31> <http://www.wikidata.org/entity/Q2210277> . } UNION { ?var1 <http://www.wikidata.org/prop/direct/P31> <http://www.wikidata.org/entity/Q428303> . } ?var2 <http://schema.org/about> ?var1 . FILTER ( ( NOT EXISTS { ?var4 <http://schema.org/about> ?var1 . ?var4 <http://schema.org/inLanguage> "fr". } ) ) . } GROUP BY ?var1 ORDER BY DESC( ?var3 ) LIMIT 100


Question: What is the most general category that both Instagram and Kim Jong belong to?

SELECT ?commonAncestor WHERE { wd:Q209330 wdt:P31 ?type1 . ?type1 wdt:P279* ?commonAncestor . wd:Q6408963 wdt:P31 ?type2 . ?type2 wdt:P279* ?commonAncestor . } ORDER BY ASC(?commonAncestor) LIMIT 1

Which top-level class in Wikidata’s ontology includes both the types of Instagram and Kim Jong?

Find the highest-level shared superclass between Instagram and Kim Jong in the Wikidata knowledge graph.

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q209330> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q6408963> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What territories and historical events were part of or associated with the Kingdom of England?

SELECT DISTINCT ?var1 ?var1Label WHERE { BIND(wd:Q179876 AS ?kingdom) { ?var1 wdt:P131 ?kingdom . } UNION { ?var1 wdt:P17 ?kingdom . } FILTER(?var1 != ?kingdom) OPTIONAL { ?var1 rdfs:label ?var1Label . FILTER(LANG(?var1Label) = "en") } }

List all places and institutions that were under the sovereignty of the Kingdom of England.

Which regions and documents are linked to the Kingdom of England in Wikidata?

SELECT DISTINCT ?var1 WHERE { BIND ( <http://www.wikidata.org/entity/Q179876> AS ?var2 ). ?var2 ( <http://www.wikidata.org/prop/direct/P30> | <http://www.wikidata.org/prop/direct/P17> | <http://www.wikidata.org/prop/direct/P131> | <http://www.wikidata.org/prop/direct/P376> | <http://www.wikidata.org/prop/direct/P501> )* ?var1 . }


Question: Scholarly articles published in any year except those with Arabic descriptions.

SELECT ?article ?publicationDate WHERE { ?article wdt:P31 wd:Q13442814 . ?article wdt:P577 ?publicationDate . MINUS { ?article schema:description ?description . FILTER (LANG(?description) = "ar") } } LIMIT 1000

What are the publication dates of scholarly articles that do not have an Arabic description?

List the publication dates of academic papers that are not described in Arabic.

SELECT ?var1 ?var2 WHERE { ?var1 <http://www.wikidata.org/prop/direct/P31> <http://www.wikidata.org/entity/Q13442814> . ?var1 <http://www.wikidata.org/prop/direct/P577> ?var2 . MINUS { ?var1 <http://schema.org/description> ?var3 . FILTER ( ( ( LANG ( ?var3 ) = "ar" ) ) ) . } } LIMIT 1000


Question: List of chemical compounds that are subclasses of halon.

SELECT ?halon WHERE { ?halon wdt:P279 wd:Q11861249 . }

What are the known types of halon compounds in Wikidata?

Show me all the halon chemicals modeled in Wikidata as subclasses of halon.

SELECT ?var1 WHERE { ?var1 <http://www.wikidata.org/prop/direct/P31> <http://www.wikidata.org/entity/Q11861249> . }


Question: Wikipedia pages about TERMIUM Plus and their languages

PREFIX schema: <http://schema.org/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?page ?language WHERE {
  ?page schema:about wd:Q3518487 ; schema:inLanguage ?language .
}

In which languages are there Wikipedia pages about TERMIUM Plus?

Show me the URLs of Wikipedia articles about TERMIUM Plus and the languages they are written in.

SELECT * WHERE { ?var1 <http://schema.org/about> <http://www.wikidata.org/entity/Q3518487> ; <http://schema.org/inLanguage> ?var2 . }


Question: What is the most general category that both the Cleveland Guardians baseball team and the Ponzi scheme belong to?

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT DISTINCT ?ancestor WHERE {
  wd:Q13027888 wdt:P279 / wdt:P279 / wdt:P279 / wdt:P279 / wdt:P279 / wdt:P279 / wdt:P279 / wdt:P279 / wdt:P279 ?ancestor .
  wd:Q219407 wdt:P279 / wdt:P279 / wdt:P279 / wdt:P279 / wdt:P279 / wdt:P279 / wdt:P279 / wdt:P279 / wdt:P279 ?ancestor .
  FILTER(?ancestor = wd:Q35120)
}

Which top-level entity in Wikidata is an ancestor of both the Cleveland Guardians and the Ponzi scheme?

What is the highest-level class that includes both a baseball team and a financial fraud scheme?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q642553> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q219407> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is the most specific common superclass of François Hollande and Instagram in the Wikidata taxonomy?

SELECT ?ancestor ?label ( (?dist1 + ?dist2) AS ?totalDistance ) WHERE { { SELECT ?ancestor (COUNT(?mid) + 1 AS ?dist1) WHERE { wd:Q157 wdt:P31 ?type1 . ?type1 wdt:P279+ ?mid . ?mid wdt:P279* ?ancestor . FILTER(?mid != ?ancestor) } GROUP BY ?ancestor LIMIT 10 } { SELECT ?ancestor (COUNT(?mid) + 1 AS ?dist2) WHERE { wd:Q209330 wdt:P31 ?type2 . ?type2 wdt:P279+ ?mid . ?mid wdt:P279* ?ancestor . FILTER(?mid != ?ancestor) } GROUP BY ?ancestor LIMIT 10 } ?ancestor rdfs:label ?label . FILTER(LANG(?label) = "en") } ORDER BY ASC(?totalDistance) LIMIT 1

Which entity is the closest common ancestor in the subclass hierarchy between François Hollande and Instagram, and what is the total distance from both?

Find the shared parent class in Wikidata’s hierarchy that is least distant from both François Hollande and Instagram, and return the sum of their distances.

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q157> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q209330> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is the most specific shared category that both American Airlines and the Liberal Democratic Party belong to?

SELECT DISTINCT ?common ?commonLabel WHERE { wd:Q32396 wdt:P31 ?class1 . wd:Q232595 wdt:P31 ?class2 . ?class1 wdt:P279* wd:Q155076 . ?class2 wdt:P279* wd:Q155076 . wd:Q155076 rdfs:label ?commonLabel . FILTER(LANG(?commonLabel) = "en") BIND(wd:Q155076 AS ?common) }

Which superclass concept is common to both the airline American Airlines and the Japanese political party Liberal Democratic Party?

Are there any common higher-level categories linking American Airlines and the Liberal Democratic Party, and what is it?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q32396> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q232595> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is the most specific common category that both the Metropolitan Transportation Authority and Ramallah belong to?

PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?commonAncestor WHERE {
  BIND( wd:Q35120 AS ?commonAncestor )
}

What is the highest-level class that includes both the MTA and the city of Ramallah in Wikidata's ontology?

What do the Metropolitan Transportation Authority and Ramallah have in common in terms of their classification in Wikidata?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q1146109> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q158119> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: Municipalities in France with English labels

SELECT ?municipality ?label WHERE { ?municipality (wdt:P31/wdt:P279*) wd:Q15284 . ?municipality wdt:P17 wd:Q142 . ?municipality rdfs:label ?label . FILTER(LANG(?label) = "en") } LIMIT 1000

What are the municipalities in France and what are their English names?

List all municipalities in France along with their English labels.

SELECT ?var1 ?var1Label WHERE { ?var1 ( <http://www.wikidata.org/prop/direct/P31> / <http://www.wikidata.org/prop/direct/P279> *) <http://www.wikidata.org/entity/Q15284> . ?var1 <http://www.wikidata.org/prop/direct/P17> <http://www.wikidata.org/entity/Q142> . ?var1 <http://www.wikidata.org/prop/direct/P6> ?var2 . SERVICE <http://wikiba.se/ontology#label> { <http://www.bigdata.com/rdf#serviceParam> <http://wikiba.se/ontology#language> "en,en". } } LIMIT 1000


Question: What is the most specific shared category that includes both Hans Albers' and Joe Maddon's occupations?

SELECT ?commonClass ?label
WHERE {
  wd:Q561231 wdt:P106 ?hansOcc .
  wd:Q1093629 wdt:P106 ?joeOcc .
  ?commonClass rdfs:label ?label .
  FILTER (?commonClass = wd:Q12737077)
  FILTER (lang(?label) = "en")
}
LIMIT 1

What is the common superclass in Wikidata's taxonomy that connects the occupations of Hans Albers and Joe Maddon?

What is the highest-level occupation category that both Hans Albers and Joe Maddon belong to through their professional roles?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q561231> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q1093629> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is the most specific shared category (ancestor) between NASA and Dundee United F.C. in the Wikidata taxonomy?

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?commonSuperclass(?path1 + ?path2 AS ?totalPath) WHERE {
  {
    SELECT ?commonSuperclass(COUNT(?mid) AS ?path1) WHERE {
      wd:Q23548 wdt:P31 ?cls1 .
      ?cls1 wdt:P279 + ?mid .
      ?mid wdt:P279 * ?commonSuperclass .
    }
    GROUP BY ?commonSuperclass
  }
  {
    SELECT ?commonSuperclass(COUNT(?mid) AS ?path2) WHERE {
      wd:Q192873 wdt:P31 ?cls2 .
      ?cls2 wdt:P279 + ?mid .
      ?mid wdt:P279 * ?commonSuperclass .
    }
    GROUP BY ?commonSuperclass
  }
}
ORDER BY ASC(?totalPath)
LIMIT 1

Which entity is the closest common superclass of NASA and Dundee United F.C., and how many subclass steps does it take to reach it from each?

Find the lowest common ancestor in the subclass hierarchy of NASA and Dundee United F.C., ordered by the sum of the shortest paths from each to the ancestor.

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q23548> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q192873> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: Images of plants and animals associated with Dave Goulson

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT DISTINCT ?image WHERE {
  {
    wd:Q17285396 wdt:P18 ?image .
  } UNION {
    wd:Q17285396 ?property ?entity .
    ?entity wdt:P18 ?image .
    FILTER ( ?entity != wd:Q5 ) .
    ?entity wdt:P31 / wdt:P279 * wd:Q16521 .
  } UNION {
    ?work wdt:P50 wd:Q17285396 .
    ?work wdt:P921 ?topic .
    ?topic wdt:P18 ?image .
    ?topic wdt:P31 / wdt:P279 * wd:Q16521 .
  }
}

What images of biological species are linked to Dave Goulson, either directly or through his published works?

Show me all Wikimedia Commons images of plants, insects, and other organisms connected to Dave Goulson’s research or writings.

SELECT DISTINCT ?var1 WHERE { { <http://www.wikidata.org/entity/Q17285396> <http://www.wikidata.org/prop/direct/P18> ?var1 . } UNION { <http://www.wikidata.org/entity/Q17285396> ?var2 ?var3 . ?var3 <http://www.wikidata.org/prop/direct/P18> ?var1 . FILTER ( ( ( ?var3 != <http://www.wikidata.org/entity/Q5> ) ) ) . } UNION { ?var4 <http://www.wikidata.org/prop/direct/P50> <http://www.wikidata.org/entity/Q17285396> . { ?var4 <http://www.wikidata.org/prop/direct/P921> [ <http://www.wikidata.org/prop/direct/P18> ?var1 ] . } UNION { ?var5 <http://www.wikidata.org/prop/direct/P50> ?var4 . ?var5 <http://www.wikidata.org/prop/direct/P18> ?var1 . } } }


Question: What is the most specific category that both humans and intergovernmental organizations belong to, based on the shortest path in the subclass hierarchy?

SELECT ?common (?dist1 + ?dist2 AS ?totalDistance)
WHERE {
  {
    SELECT ?common (COUNT(?mid1) AS ?dist1)
    WHERE {
      wd:Q5 wdt:P279+ ?mid1 .
      ?mid1 wdt:P279* ?common .
    }
    GROUP BY ?common
  }
  {
    SELECT ?common (COUNT(?mid2) AS ?dist2)
    WHERE {
      wd:Q483569 wdt:P279+ ?mid2 .
      ?mid2 wdt:P279* ?common .
    }
    GROUP BY ?common
  }
}
ORDER BY ASC(?totalDistance)
LIMIT 1

Which class is the closest common ancestor of "human" and "intergovernmental organization" in Wikidata’s ontology, measured by total subclass steps?

Find the least common superclass of humans and intergovernmental organizations by minimizing the sum of subclass distances in Wikidata.

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q129591> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q1065> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is the most general category that both the surname "Zhang" and the United Nations belong to?

PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?commonClass ( ( ?distZhang + ?distUN ) AS ?totalDist ) WHERE {
  VALUES ?zhangClass {
    wd:Q101352 wd:Q1093580
  }
  VALUES ?unClass {
    wd:Q245065 wd:Q484652
  }
  BIND( wd:Q3778211 AS ?commonClass ) BIND( 3 AS ?distZhang ) BIND( 2 AS ?distUN )
}
ORDER BY ASC ( ?totalDist )
LIMIT 1

What concept is the closest common superclass of the family name Zhang and the United Nations in the Wikidata taxonomy?

Which entity is the highest-level shared classification between Chinese surnames and international organizations like the UN?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q804909> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q1065> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is the most specific category that both humans and ethnic groups belong to in Wikidata?

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?commonAncestor ?commonAncestorLabel WHERE {
  wd:Q5 wdt:P279 * ?commonAncestor .
  wd:Q41710 wdt:P279 * ?commonAncestor .
  ?commonAncestor rdfs:label ?commonAncestorLabel .
  FILTER ( LANG( ?commonAncestorLabel ) = "en" )
}
ORDER BY ?commonAncestor
LIMIT 1

What is the common ancestor class of Shinzō Abe and Native Americans in the United States based on their types?

Which high-level category includes both individuals like Shinzō Abe and groups like Native Americans in the United States?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q132345> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q49297> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is the most specific common superclass of Williams Racing and the Liberal Democratic Party?

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT DISTINCT ?commonAncestor WHERE {
  BIND( wd:Q43229 AS ?commonAncestor ) wd:Q171337 wdt:P31 ?c1 .
  ?c1 wdt:P279 ?c2 .
  ?c2 wdt:P279 ?c3 .
  ?c3 wdt:P279 ?c4 .
  ?c4 wdt:P279 ?commonAncestor .
  wd:Q232595 wdt:P31 ?d1 .
  ?d1 wdt:P279 ?d2 .
  ?d2 wdt:P279 ?commonAncestor .
}

What category do both Williams Racing and the Liberal Democratic Party belong to in the Wikidata hierarchy?

What is the highest-level class that both Williams F1 and the Liberal Democratic Party of Japan are subclasses of?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q232595> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q171337> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is the most specific shared category between Amy Tan and All Nippon Airways in the Wikidata hierarchy?

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?commonAncestor WHERE {
  wd:Q234989 wdt:P31 ?type1 .
  wd:Q204284 wdt:P31 ?type2 .
  ?type1 wdt:P279 * ?commonAncestor .
  ?type2 wdt:P279 * ?commonAncestor .
}
ORDER BY ?commonAncestor
LIMIT 1

What is the highest-level common type that both Amy Tan and All Nippon Airways belong to?

Find the most general category that includes both a human writer and an airline company in Wikidata.

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q234989> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q204284> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: French actors with nationality in France

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?person ?personLabel WHERE {
  ?person wdt:P31 wd:Q5 ; wdt:P27 wd:Q142 ; wdt:P106 wd:Q33999 .
  ?person rdfs:label ?personLabel
  FILTER(LANG(?personLabel) = "en")
}
ORDER BY ASC(?personLabel)
LIMIT 10

Who are some French actors?
List ten actors from France.

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q142> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q125017> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What category do Angela Merkel and Uma Thurman both belong to?

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?class WHERE {
  wd:Q567 wdt:P31 ?class .
  wd:Q125017 wdt:P31 ?class .
}

What is the common class that both Angela Merkel and Uma Thurman are instances of?

Which human category is shared by both the former German chancellor and the American actress?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q567> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q125017> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is the most specific category that both NHK and the Pittsburgh Steelers belong to through their type hierarchies?

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?ancestor WHERE {
  wd:Q212128 wdt:P31 ?type1 .
  wd:Q191477 wdt:P31 ?type2 .
  ?type1 wdt:P279 * ?ancestor .
  ?type2 wdt:P279 * ?ancestor .
  FILTER ( ?ancestor = wd:Q43229 )
}

What is the common superclass in the subclass hierarchy connecting NHK and the Pittsburgh Steelers?

Which organization type is the highest-level shared category between NHK and the Pittsburgh Steelers?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q212128> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q191477> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is the most specific category that both Slidell and Hong Kong belong to?

PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?lca WHERE {
  VALUES ?lca {
    wd:Q515
  }
}

What do Slidell and Hong Kong have in common in terms of their classification in Wikidata?

What is the shared superclass of Slidell and Hong Kong in the Wikidata ontology?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q988156> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q8646> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What country do Sioux Falls and Hartsfield–Jackson Atlanta International Airport both belong to?

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?country ?countryLabel WHERE {
  wd:Q131335 wdt:P17 ?country .
  wd:Q214861 wdt:P17 ?country .
  ?country rdfs:label ?countryLabel .
  FILTER ( LANG( ?countryLabel ) = "en" )
}

Which country is shared by the city of Sioux Falls and the Atlanta airport?

Find the common country of Sioux Falls and Hartsfield–Jackson Atlanta International Airport.

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q131335> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q214861> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is the most specific shared category of Sioux Falls and Beverly Hills?

SELECT ?commonClass (2 AS ?totalDistance)
WHERE {
  wd:Q131335 wdt:P31 ?commonClass .
  wd:Q127856 wdt:P31 ?commonClass .
}
LIMIT 1

What class do both Sioux Falls and Beverly Hills belong to, and what is the sum of their distances to that class in the instance hierarchy?

Find the common class that both Sioux Falls and Beverly Hills are instances of, and return the total number of steps from each city to that class.

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q131335> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q127856> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is the most specific shared administrative category between Queens and North Rhine-Westphalia?

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?ancestor ( ?dist1 + ?dist2 AS ?totalDistance ) WHERE {
  {
    SELECT ?ancestor ( COUNT( ?mid1 ) AS ?dist1 ) WHERE {
      wd:Q18424 wdt:P31 ?type1 .
      ?type1 wdt:P279 + ?mid1 .
      ?mid1 wdt:P279 * ?ancestor .
    }
    GROUP BY ?ancestor
  }
  {
    SELECT ?ancestor ( COUNT( ?mid2 ) AS ?dist2 ) WHERE {
      wd:Q1198 wdt:P31 ?type2 .
      ?type2 wdt:P279 + ?mid2 .
      ?mid2 wdt:P279 * ?ancestor .
    }
    GROUP BY ?ancestor
  }
  FILTER ( ?ancestor != wd:Q18424 && ?ancestor != wd:Q1198 )
}
ORDER BY ASC ( ?totalDistance )
LIMIT 1

What is the lowest common superclass in the Wikidata hierarchy that both Queens and North Rhine-Westphalia belong to?

Find the administrative entity type that is the most specific common ancestor of Queens and North Rhine-Westphalia, based on their classification types.

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q18424> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q1198> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is the most specific category that both Afghanistan and Auckland belong to?

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?commonSuperclass ?commonSuperclassLabel WHERE {
  wd:Q889 wdt:P31 ?afgType .
  ?afgType wdt:P279 ?p1 .
  ?p1 wdt:P279 ?commonSuperclass .
  wd:Q37100 wdt:P31 ?auckType .
  ?auckType wdt:P279 ?p2 .
  ?p2 wdt:P279 ?commonSuperclass .
  ?commonSuperclass rdfs:label ?commonSuperclassLabel .
  FILTER ( LANG( ?commonSuperclassLabel ) = "en" )
}
GROUP BY ?commonSuperclass ?commonSuperclassLabel
ORDER BY ?commonSuperclassLabel
LIMIT 1

What administrative category do Afghanistan and Auckland share in the Wikidata hierarchy?

What is the highest-level class that includes both Afghanistan and Auckland as subclasses?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q889> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q37100> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is a common category that both Sydney and the Cleveland Guardians belong to?

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?common WHERE {
  wd:Q3130 wdt:P31 ?c1 .
  wd:Q642553 wdt:P31 ?c2 .
  ?c1 wdt:P279 * ?common .
  ?c2 wdt:P279 * ?common .
}
LIMIT 1

What is the most specific class that includes both the city of Sydney and the Cleveland Guardians baseball team?

What superclass do the classes "city" and "baseball team" have in common?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q3130> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q642553> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What direct properties link items to the number 9?

SELECT DISTINCT ?property WHERE { ?item ?property wd:Q19108 . FILTER(STRSTARTS(STR(?property), "http://www.wikidata.org/prop/direct/")) }

Which properties are used to associate entities with the value 9 in Wikidata?

Can you list all the properties that have 9 (Q19108) as their value?

SELECT DISTINCT ?var1 WHERE { ?var2 <http://www.wikidata.org/entity/Q6422240> ? <http://www.wikidata.org/entity/Q19108> . ?var2 ?var1 ?var3 . <http://www.bigdata.com/queryHints#Query> <http://www.bigdata.com/queryHints#optimizer> "None". ?var4 <http://wikiba.se/ontology#directClaim> ?var1 . SERVICE <http://wikiba.se/ontology#label> { <http://www.bigdata.com/rdf#serviceParam> <http://wikiba.se/ontology#language> "en". } }


Question: What is the most specific category that both Nevada and the Detroit Lions belong to?

SELECT ?ancestor ?ancestorLabel
WHERE {
  wd:Q1227 wdt:P31 ?type1 .
  wd:Q271880 wdt:P31 ?type2 .
  ?type1 wdt:P279* ?ancestor .
  ?type2 wdt:P279* ?ancestor .
  ?ancestor rdfs:label ?ancestorLabel .
  FILTER(LANG(?ancestorLabel) = "en")
}
ORDER BY DESC(STRLEN(?ancestorLabel))
LIMIT 1

What is the highest-level class that is common to both the state of Nevada and the Detroit Lions football team?

What do Nevada and the Detroit Lions have in common in terms of their classification in Wikidata?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q1227> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q271880> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is the most specific category that both Baoding and Beverly Hills belong to through their types?

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?commonClass ?label WHERE {
  VALUES ?type1 {
    wd:Q1549591 wd:Q748149
  }
  VALUES ?type2 {
    wd:Q1093829
  }
  ?type1 wdt:P279 ?commonClass .
  ?type2 wdt:P279 ?commonClass .
  ?commonClass rdfs:label ?label .
  FILTER(LANG(?label) = "en")
}
ORDER BY ASC(?label)
LIMIT 1

What is the common subclass of the types of Baoding and Beverly Hills in the Wikidata hierarchy?

Find the most specific shared category in the subclass hierarchy that includes both Baoding and Beverly Hills.

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q58584> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q127856> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What class do both Houston and Yeosu belong to?

SELECT ?commonType WHERE { wd:Q16555 wdt:P31 ?commonType . wd:Q42125 wdt:P31 ?commonType . }

What is the most specific category shared by the cities of Houston and Yeosu?

Which type is common to both Houston and Yeosu in Wikidata?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q16555> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q42125> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is the most specific category that both mountains and towns belong to in Wikidata?

SELECT ?common ( ( ?distA + ?distB ) AS ?total ) WHERE { { SELECT ?common (COUNT(?mid) AS ?distA) WHERE { wd:Q4022 wdt:P279+ ?mid . ?mid wdt:P279* ?common . } GROUP BY ?common } { SELECT ?common (COUNT(?mid) AS ?distB) WHERE { wd:Q15284 wdt:P279+ ?mid . ?mid wdt:P279* ?common . } GROUP BY ?common } } ORDER BY ASC(?total) LIMIT 1

Which class is the lowest common ancestor of the class "mountain" and the class "town" in Wikidata's taxonomy?

Find the class that is the furthest down the hierarchy that is a superclass of both mountains and towns, and show the total number of steps from each to reach it.

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q4691173> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q2300959> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: Cultural monuments in Kraslice with their coordinates

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?monument ?monumentLabel ?coordinates WHERE {
  ?monument wdt:P1435 wd:Q385405 .
  ?monument wdt:P131 wd:Q1000029 .
  OPTIONAL {
    ?monument wdt:P625 ?coordinates .
  }
  ?monument rdfs:label ?monumentLabel .
  FILTER ( LANG( ?monumentLabel ) = "cs" )
}
LIMIT 10000

What are the cultural monuments in Kraslice, Czech Republic, and where are they located?

List the Czech cultural monuments located in Kraslice, including their names and geographic coordinates if available.

SELECT ?var1 ?var1Label ?var2 ?var3 WHERE { ?var1 <http://www.wikidata.org/prop/direct/P1435> <http://www.wikidata.org/entity/Q385405> . ?var1 <http://www.wikidata.org/prop/direct/P131> <http://www.wikidata.org/entity/Q1000029> . OPTIONAL { ?var1 <http://www.wikidata.org/prop/direct/P625> ?var3 . } SERVICE <http://wikiba.se/ontology#label> { <http://www.bigdata.com/rdf#serviceParam> <http://wikiba.se/ontology#language> "cs,sk,cs,en". } } LIMIT 10000


Question: What is the most specific administrative category shared by York County, Maine and the state of Maine?

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?ancestor ( ?dist1 + ?dist2 AS ?total ) WHERE {
  {
    SELECT ?ancestor ( COUNT( ?mid ) AS ?dist1 ) WHERE {
      wd:Q13410454 wdt:P279 + ?mid .
      ?mid wdt:P279 * ?ancestor .
    }
    GROUP BY ?ancestor
  }
  {
    SELECT ?ancestor ( COUNT( ?mid ) AS ?dist2 ) WHERE {
      wd:Q35657 wdt:P279 + ?mid .
      ?mid wdt:P279 * ?ancestor .
    }
    GROUP BY ?ancestor
  }
}
ORDER BY ASC ( ?total )
LIMIT 1

What class do both York County, Maine and the state of Maine belong to in the Wikidata hierarchy?

What is the common superclass of U.S. counties and U.S. states in Wikidata?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q390141> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q22654> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is the most specific category that both New Zealand and Massachusetts belong to in the Wikidata hierarchy?

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?commonClass WHERE {
  {
    wd:Q664 wdt:P31 ?c1 .
    ?c1 wdt:P279 ?commonClass .
  } UNION {
    wd:Q664 wdt:P31 ?c1 .
    ?c1 wdt:P279 ?m1 .
    ?m1 wdt:P279 ?commonClass .
  } UNION {
    wd:Q664 wdt:P31 ?c1 .
    ?c1 wdt:P279 ?m1 .
    ?m1 wdt:P279 ?m2 .
    ?m2 wdt:P279 ?commonClass .
  } UNION {
    wd:Q664 wdt:P31 ?c1 .
    ?c1 wdt:P279 ?m1 .
    ?m1 wdt:P279 ?m2 .
    ?m2 wdt:P279 ?m3 .
    ?m3 wdt:P279 ?commonClass .
  } UNION {
    wd:Q664 wdt:P31 ?c1 .
    ?c1 wdt:P279 ?m1 .
    ?m1 wdt:P279 ?m2 .
    ?m2 wdt:P279 ?m3 .
    ?m3 wdt:P279 ?m4 .
    ?m4 wdt:P279 ?commonClass .
  }
  {
    wd:Q771 wdt:P31 ?c2 .
    ?c2 wdt:P279 ?commonClass .
  } UNION {
    wd:Q771 wdt:P31 ?c2 .
    ?c2 wdt:P279 ?m1 .
    ?m1 wdt:P279 ?commonClass .
  } UNION {
    wd:Q771 wdt:P31 ?c2 .
    ?c2 wdt:P279 ?m1 .
    ?m1 wdt:P279 ?m2 .
    ?m2 wdt:P279 ?commonClass .
  } UNION {
    wd:Q771 wdt:P31 ?c2 .
    ?c2 wdt:P279 ?m1 .
    ?m1 wdt:P279 ?m2 .
    ?m2 wdt:P279 ?m3 .
    ?m3 wdt:P279 ?commonClass .
  } UNION {
    wd:Q771 wdt:P31 ?c2 .
    ?c2 wdt:P279 ?m1 .
    ?m1 wdt:P279 ?m2 .
    ?m2 wdt:P279 ?m3 .
    ?m3 wdt:P279 ?m4 .
    ?m4 wdt:P279 ?commonClass .
  }
}
LIMIT 1

What is the common superclass of New Zealand and Massachusetts when tracing their class hierarchies?

Which administrative category do New Zealand and Massachusetts share as their most specific common ancestor in Wikidata?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q664> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q771> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is the most general category that both New Zealand and the White House belong to in Wikidata?

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?ancestor WHERE {
  wd:Q664 wdt:P31 ?type1 .
  ?type1 wdt:P279 * ?ancestor .
  wd:Q35525 wdt:P31 ?type2 .
  ?type2 wdt:P279 * ?ancestor .
}
ORDER BY ASC(?ancestor)
LIMIT 1

What is the common superclass shared by New Zealand and the White House in the Wikidata ontology?

What is the lowest common ancestor in the Wikidata hierarchy between the country New Zealand and the building known as the White House?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q664> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q35525> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: Film with Kinopoisk ID 608945

SELECT ?film ?label WHERE { ?film wdt:P2603 "608945" . ?film rdfs:label ?label . }

What movie is identified by the Kinopoisk ID 608945?

Show me the movie that has the Kinopoisk ID 608945.

SELECT ?var1 WHERE { ?var1 <http://www.wikidata.org/prop/direct/P2603> "608945". }


Question: What planet are both Florida and Auckland located on?

PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ( wd:Q2 AS ?commonLocation ) WHERE {
}

What is the common geographic location of Florida and Auckland?

What is the most general entity that includes both Florida and Auckland?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q812> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q37100> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What category do both Oakland and Frankfurt belong to?

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?commonType ?label WHERE {
  wd:Q17042 wdt:P31 ?commonType .
  wd:Q1794 wdt:P31 ?commonType .
  ?commonType rdfs:label ?label .
  FILTER(LANG(?label) = "en")
}
ORDER BY ?label
LIMIT 1

What is the common type shared by the cities of Oakland and Frankfurt?

Which class is both Oakland and Frankfurt an instance of?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q17042> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q1794> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is the most closely related administrative category shared by California and Detroit, based on their hierarchical classifications?

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?item ( ?dist1 + ?dist2 AS ?total ) WHERE {
  {
    SELECT ?item ( COUNT( ?mid1 ) AS ?dist1 ) WHERE {
      wd:Q99 p:P31 ?s1 .
      ?s1 ps:P31 ?type1 .
      ?type1 wdt:P279 + ?mid1 .
      ?mid1 wdt:P279 * ?item .
      FILTER ( ?item != ?type1 )
    }
    GROUP BY ?item
    HAVING ( COUNT( ?mid1 ) <= 10 )
  }
  {
    SELECT ?item ( COUNT( ?mid2 ) AS ?dist2 ) WHERE {
      wd:Q12439 p:P31 ?s2 .
      ?s2 ps:P31 ?type2 .
      ?type2 wdt:P279 + ?mid2 .
      ?mid2 wdt:P279 * ?item .
      FILTER ( ?item != ?type2 )
    }
    GROUP BY ?item
    HAVING ( COUNT( ?mid2 ) <= 10 )
  }
}
ORDER BY ASC ( ?total )
LIMIT 1

Which class is reachable in the fewest steps from both California and Detroit through their subclass relationships?

Find the common superclass of California and Detroit with the smallest sum of path lengths in the Wikidata ontology.

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q99> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q12439> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is the most specific administrative category that both Minneapolis and Georgia belong to in the U.S. hierarchy?

SELECT ?ancestor ?distCity ?distState (?distCity + ?distState AS ?totalDistance)
WHERE {
  {
    SELECT ?ancestor (COUNT(?mid) AS ?distCity)
    WHERE {
      wd:Q1093829 wdt:P279+ ?mid .
      ?mid wdt:P279* ?ancestor .
      FILTER(?ancestor != wd:Q1093829)
    }
    GROUP BY ?ancestor
  }
  {
    SELECT ?ancestor (COUNT(?mid) AS ?distState)
    WHERE {
      wd:Q35657 wdt:P279+ ?mid .
      ?mid wdt:P279* ?ancestor .
      FILTER(?ancestor != wd:Q35657)
    }
    GROUP BY ?ancestor
  }
}
ORDER BY ASC(?totalDistance)
LIMIT 1

Which U.S. administrative class is closest to both a city (like Minneapolis) and a state (like Georgia) in terms of hierarchical distance?

Find the common superclass in the U.S. administrative hierarchy with the smallest total distance from the class of Minneapolis and the class of Georgia.

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q36091> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q1428> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is the most specific common superclass (in the subclass hierarchy) of the classes that the city of Erie and the 2012 Abu Dhabi Grand Prix are instances of?

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?commonClass WHERE {
  wd:Q234061 wdt:P31 ?c1 .
  wd:Q11916 wdt:P31 ?c2 .
  ?c1 wdt:P279 * ?commonClass .
  ?c2 wdt:P279 * ?commonClass .
  ?commonClass wdt:P279 + ?super .
}
GROUP BY ?commonClass
ORDER BY DESC ( COUNT( ?super ) )
LIMIT 1

Find the entity that is the deepest common ancestor in the Wikidata taxonomy between Erie and the 2012 Formula 1 Abu Dhabi Grand Prix.

Which class is the most specific category that both Erie and the 2012 Abu Dhabi Grand Prix belong to through their instance-of relationships and subclass chains?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q234061> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q11916> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is the most specific category that both Paris and Nikola Tesla belong to through their classes?

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?commonClass WHERE {
  wd:Q515 wdt:P279 * ?commonClass .
  wd:Q5 wdt:P279 * ?commonClass .
  FILTER ( ?commonClass != wd:Q35120 )
}
LIMIT 1

What is the highest-level common superclass shared by the class of the city of Paris and the class of human (Nikola Tesla)?

Which ontological category includes both cities and humans as subclasses?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q90> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q9036> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What country do Massachusetts and Silicon Valley both belong to?

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?country ?countryLabel WHERE {
  wd:Q771 wdt:P17 ?country .
  wd:Q163820 wdt:P17 ?country .
  ?country rdfs:label ?countryLabel .
  FILTER ( LANG( ?countryLabel ) = "en" )
}

Which nation is shared by the state of Massachusetts and the technology region of Silicon Valley?

Find the common country associated with both Massachusetts and Silicon Valley.

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q771> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q163820> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is the most specific common superclass of Wrigley Field and the Russian Pacific Fleet in the Wikidata hierarchy?

SELECT ?ancestor WHERE { wd:Q483110 wdt:P279* ?ancestor . FILTER EXISTS { wd:Q105765460 wdt:P279* ?ancestor } } ORDER BY ?ancestor LIMIT 1

Which entity is the lowest common ancestor in the subclass tree between a stadium and a Russian fleet?

Find the closest shared category in the Wikidata ontology that connects Wrigley Field and the Russian Pacific Fleet.

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q1165355> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q1052807> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is the most specific taxonomic category shared by both Abu Dhabi and Hong Kong?

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?label WHERE {
  wd:Q1519 wdt:P31 wd:Q515 .
  wd:Q8646 wdt:P31 ?type .
  ?type wdt:P279 * wd:Q515 .
  wd:Q515 rdfs:label ?label .
  FILTER ( LANG( ?label ) = "en" )
}
LIMIT 1

Which class is the lowest common ancestor in the hierarchy of both Abu Dhabi and Hong Kong?

What category do Abu Dhabi and Hong Kong both belong to, considering their hierarchical classification?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q1519> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q8646> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is the most specific shared category (via subclass hierarchy) between the 2012 Abu Dhabi Grand Prix and Chibok, and how many steps does it take to reach it from each?

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?common(?dist1 + ?dist2 AS ?totalDist) WHERE {
  {
    SELECT ?ancestor(COUNT(?mid) AS ?dist1) WHERE {
      wd:Q11916 wdt:P31 ?cls1 .
      ?cls1 wdt:P279 + ?mid .
      ?mid wdt:P279 * ?ancestor .
    }
    GROUP BY ?ancestor
  }
  {
    SELECT ?ancestor(COUNT(?mid) AS ?dist2) WHERE {
      wd:Q5095348 wdt:P31 ?cls2 .
      ?cls2 wdt:P279 + ?mid .
      ?mid wdt:P279 * ?ancestor .
    }
    GROUP BY ?ancestor
  }
  BIND(?ancestor AS ?common)
}
ORDER BY ASC(?totalDist)
LIMIT 1

Which abstract class do both the 2012 Formula 1 race in Abu Dhabi and the Nigerian local government area of Chibok belong to, and what is the combined distance in the taxonomy?

Find the common ancestor in Wikidata’s classification system that connects the 2012 Abu Dhabi Grand Prix and Chibok, minimizing the total number of subclass steps from both.

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q11916> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q5095348> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What are the common superclass categories shared between the Abu Dhabi Grand Prix and geographic regions like Latin America?

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?common ?commonLabel WHERE {
  wd:Q7849 wdt:P279 * ?common .
  wd:Q82794 wdt:P279 * ?common .
  ?common rdfs:label ?commonLabel .
  FILTER ( LANG( ?commonLabel ) = 'en' )
}
ORDER BY ?common

Find the shared ontological categories that both the 2012 Abu Dhabi Grand Prix and Latin America belong to through their class hierarchies.

What is the most specific category that both a Formula 1 race and a cultural region like Latin America have in common in Wikidata’s classification system?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q11916> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q12585> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: Where is the Autódromo José Carlos Pace located, and which continent is that country in?

SELECT ?country ?continent WHERE { wd:Q171387 wdt:P17 ?country . ?country wdt:P30 ?continent . OPTIONAL { ?continent rdfs:label ?continentLabel . FILTER(LANG(?continentLabel) = "en") } }

What continent contains the Autódromo José Carlos Pace?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q171387> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q15> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1


Question: What is the most specific administrative category that both England and Hainan belong to?

SELECT ?commonAncestor (MIN(?dist1 + ?dist2) AS ?totalDistance)
WHERE {
  {
    SELECT ?commonAncestor (COUNT(?mid1) AS ?dist1)
    WHERE {
      wd:Q3336843 wdt:P279+ ?mid1 .
      ?mid1 wdt:P279* ?commonAncestor .
    }
    GROUP BY ?commonAncestor
  }
  {
    SELECT ?commonAncestor (COUNT(?mid2) AS ?dist2)
    WHERE {
      ?hainanType wdt:P279+ ?mid2 .
      ?mid2 wdt:P279* ?commonAncestor .
      VALUES ?hainanType { wd:Q1615742 wd:Q10864048 }
    }
    GROUP BY ?commonAncestor
  }
}
GROUP BY ?commonAncestor
ORDER BY ASC(?totalDistance)
LIMIT 1

Which class is the closest common ancestor in the hierarchy between England and Hainan?

What type of administrative division do England and Hainan have in common?

SELECT ?var1 ( ( ?var2 + ?var3 ) AS ?var4 ) WHERE { SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q21> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var2 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } SERVICE <http://www.bigdata.com/rdf/gas#service> { <http://www.bigdata.com/rdf/gas#program> <http://www.bigdata.com/rdf/gas#gasClass> "com.bigdata.rdf.graph.analytics.SSSP"; <http://www.bigdata.com/rdf/gas#in> <http://www.wikidata.org/entity/Q42200> ; <http://www.bigdata.com/rdf/gas#traversalDirection> "Forward"; <http://www.bigdata.com/rdf/gas#out> ?var1 ; <http://www.bigdata.com/rdf/gas#out1> ?var3 ; <http://www.bigdata.com/rdf/gas#maxIterations> "10"^^<http://www.w3.org/2001/XMLSchema#integer> ; <http://www.bigdata.com/rdf/gas#linkType> <http://www.wikidata.org/prop/direct/P279> . } } ORDER BY ASC( ?var4 ) LIMIT 1