query-37c3ab893574abae14194f59e8046d62

rq turtle/ttl

Co-occurring topics

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX target1: <http://www.wikidata.org/entity/Q20984804>
PREFIX target2: <http://www.wikidata.org/entity/Q179965>

SELECT DISTINCT
  ?works 

  ?topic ?topicLabel
  (CONCAT("#topic/", SUBSTR(STR(?topic), 32)) AS ?topicUrl)

  ?example_work ?example_workLabel
  (CONCAT("#work/", SUBSTR(STR(?example_work), 32)) AS ?example_workUrl)
WITH {
  SELECT 
    (COUNT(DISTINCT ?work) AS ?works)
    ?topic
    (SAMPLE(?work) AS ?example_work)
  WHERE {
    ?work wdt:P50 target1: ;
          wdt:P921 ?topic ;
          wdt:P921 / (wdt:P361| wdt:P1269 | wdt:P31

Query found at