query-764c37ddbb568afab68f04a1846ef47c

rq turtle/ttl

Missing P361 or P527:

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?b ?missing ?a ?bLabel ?aLabel WHERE {
  BIND(wdt:P361 AS ?missing) .
  BIND(IF(?missing=wdt:P361, wdt:P527, wdt:P361) AS ?existing) .
  VALUES ?gamesClass { wd:Q2748100 wd:Q82414 }

  # discipline/event missing "part of" games/discipline
  { ?a wdt:P31 ?gamesClass; ?existing ?b . ?b wdt:P31 wd:Q26132862 } UNION { ?a wdt:P31 wd:Q26132862; ?existing ?b . ?b wdt:P31 wd:Q18536594 }

  # games/discipline missing "has part" discipline/event
  #{ ?a wdt:P31 wd:Q26132862; ?existing ?b . ?b wdt:P31 ?gamesClass } UNION { ?a wdt:P31 wd:Q18536594; ?existing ?b . ?b wdt:P31 wd:Q26132862 }  

  MINUS { ?b ?missing ?a }
  SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?a"):::projected v5("?b"):::projected v2("?existing") v3("?gamesClass") v1("?missing"):::projected c5(["bd:serviceParam"]):::iri c3(["wd:Q18536594"]):::iri c7(["en"]):::literal c2(["wd:Q26132862"]):::iri bind0[/"'wdt:P361'"/] bind0 --as--o v1 bind1[/"if(?missing = 'wdt:P361','wdt:P527','wdt:P361')"/] v1 --o bind1 bind1 --as--o v2 bind2[/VALUES ?gamesClass/] bind2-->v3 bind20(["wd:Q2748100"]) bind20 --> bind2 bind21(["wd:Q82414"]) bind21 --> bind2 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v4 --"wdt:P31"--> c2 v4 -->v2--> v5 v5 --"wdt:P31"--> c3 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v4 --"wdt:P31"--> v3 v4 -->v2--> v5 v5 --"wdt:P31"--> c2 end union0r <== or ==> union0l end subgraph minus3["MINUS"] style minus3 stroke-width:6px,fill:pink,stroke:red; v5 -->v1--> v4 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c7 end