query-09665809c0f95c641ffe4b888383d8a4

rq turtle/ttl

title: Works not tagged as being about the target topic but citing AND cited from works that are PREFIX target: http://www.wikidata.org/entity/Q85759287

SELECT DISTINCT ?cited_work ?title ?count (REPLACE(STR(?cited_work), ".Q", "Q") AS ?qid) ("P921" AS ?property) (REPLACE(STR(target:), ".Q", "Q") AS ?target) ("S887" AS ?heuristic) ("Q69652283" AS ?deduced)

WITH { SELECT (count(?work) as ?count) ?cited_work WHERE { { ?work wdt:P921/wdt:P31/wdt:P279 target: . } union { ?work wdt:P921/wdt:P361+ target: . } union { ?work wdt:P921/wdt:P1269+ target: . } ?work wdt:P2860 ?cited_work . } GROUP BY ?cited_work ORDER BY DESC(?count) LIMIT 20000 } AS %result WHERE { INCLUDE %result FILTER (?count > 20) FILTER NOT EXISTS {?cited_work wdt:P921 target: } ?cited_work wdt:P1476 ?title . ?cited_work wdt:P2860 [wdt:P921 target: ] . SERVICE wikibase:label { bd:serviceParam wikibase:language "en,da,de,es,fr,jp,nl,no,ru,sv,zh" . } } ORDER BY DESC(?count) LIMIT 200

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title: Works not tagged as being about the target topic but citing AND cited from works that are
PREFIX target: <http://www.wikidata.org/entity/Q85759287>

SELECT DISTINCT
  ?cited_work ?title ?count
  (REPLACE(STR(?cited_work), ".*Q", "Q") AS ?qid) 
  ("P921" AS ?property)
  (REPLACE(STR(target:), ".*Q", "Q") AS ?target) 
  ("S887" AS ?heuristic)
  ("Q69652283" AS ?deduced)

WHERE {
   {
  SELECT (count(?work) as ?count) ?cited_work WHERE {
    { ?work wdt:P921/wdt:P31*/wdt:P279* target: . }
    union { ?work wdt:P921/wdt:P361+ target: . }
    union { ?work wdt:P921/wdt:P1269+ target: . }
    ?work wdt:P2860 ?cited_work .
  }
  GROUP BY ?cited_work
  ORDER BY DESC(?count)
  LIMIT 20000
}  FILTER (?count > 20)
  FILTER NOT EXISTS {?cited_work wdt:P921 target: }
  ?cited_work wdt:P1476 ?title .
  ?cited_work wdt:P2860 [wdt:P921 target: ] .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,da,de,es,fr,jp,nl,no,ru,sv,zh" . } 
}
ORDER BY DESC(?count)
LIMIT 200

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?cited_work"):::projected v4("?count"):::projected v9("?deduced") v8("?heuristic") v6("?property") v5("?qid") v7("?target") v4("?title"):::projected v3("?work") a1((" ")) a2((" ")) a3((" ")) a4((" ")) a5((" ")) c13(["en,da,de,es,fr,jp,nl,no,ru,sv,zh"]):::literal c11(["bd:serviceParam"]):::iri c2([http://www.wikidata.org/entity/Q85759287]):::iri f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"wdt:P921"--> e0c2 e0v1("?cited_work"):::projected e0c2([http://www.wikidata.org/entity/Q85759287]):::iri end f0--EXISTS--> f0e0 f0 --> v2 f0 --> c1 f0 --> c2 v2 --"wdt:P921"--> c2 f1[["?count > '20^^xsd:integer'"]] f1 --> v4 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P921"--> a4 a4 --"wdt:P1269"--> c2 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P921"--> a3 a3 --"wdt:P361"--> c2 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P921"--> a1 a1 --"wdt:P31"--> a2 a2 --"wdt:P279"--> c2 end union0r <== or ==> union0l end v3 --"wdt:P2860"--> v2 bind3[/"count(?work)"/] v3 --o bind3 bind3 --as--o v4 v2 --"wdt:P1476"--> v4 a5 --"wdt:P921"--> c2 v2 --"wdt:P2860"--> a5 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end bind4[/"replace(str(?cited_work),'.*Q','Q')"/] v2 --o bind4 bind4 --as--o v5 bind5[/"'P921'"/] bind5 --as--o v6 bind6[/"replace(str(http://www.wikidata.org/entity/Q85759287),'.*Q','Q')"/] bind6 --as--o v7 bind7[/"'S887'"/] bind7 --as--o v8 bind8[/"'Q69652283'"/] bind8 --as--o v9