query-1da7fdf13a738025d76c1654f0c11ac6

rq turtle/ttl

imported from Wikimedia project (P143),  mass (P2067),  occupation (P106),  instance of (P31)Properties:  fencer (Q13381863),  human (Q5)Items:

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT ?type ?count
WHERE {
  {
    SELECT ("Total count of fencers with mass present on their item" AS ?type) (COUNT(DISTINCT ?item) AS ?count)
    WHERE {  { SELECT ?item ?mass WHERE { ?item wdt:P31 wd:Q5; wdt:P106 wd:Q13381863; p:P2067 ?mass } }}
  }
  UNION
  {
    SELECT ("Total count of fencers with sourced mass present on their item" AS ?type) (COUNT(DISTINCT ?item) AS ?count)
    WHERE {  { SELECT ?item ?mass WHERE {  { SELECT ?item ?mass WHERE { ?item wdt:P31 wd:Q5; wdt:P106 wd:Q13381863; p:P2067 ?mass } }?mass prov:wasDerivedFrom ?ref } }}
  }
  UNION
  {
    SELECT ("Total count of fencers with non-Wikimedia sourced mass present on their item" AS ?type) (COUNT(DISTINCT ?item) AS ?count)
    WHERE {  { SELECT ?item ?mass WHERE {  { SELECT ?item ?mass WHERE { ?item wdt:P31 wd:Q5; wdt:P106 wd:Q13381863; p:P2067 ?mass } }?mass prov:wasDerivedFrom ?ref MINUS { ?ref pr:P143 [] } } }}
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?count"):::projected v1("?item") v2("?mass") v5("?ref") v6("?type"):::projected a1((" ")) c2(["wd:Q5"]):::iri c4(["wd:Q13381863"]):::iri 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; v1 --"p:direct/P31"--> c2 v1 --"p:direct/P106"--> c4 v1 --"p:P2067"--> v2 v2 --"prov:wasDerivedFrom"--> v5 subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; v5 --"p:reference/P143"--> a1 end bind2[/"'Total count of fencers with non-Wikimedia sourced mass present on their item'"/] bind2 --as--o v6 bind3[/"count(?item)"/] v1 --o bind3 bind3 --as--o v6 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v1 --"p:direct/P31"--> c2 v1 --"p:direct/P106"--> c4 v1 --"p:P2067"--> v2 v2 --"prov:wasDerivedFrom"--> v5 bind5[/"'Total count of fencers with sourced mass present on their item'"/] bind5 --as--o v6 bind6[/"count(?item)"/] v1 --o bind6 bind6 --as--o v6 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"p:direct/P31"--> c2 v1 --"p:direct/P106"--> c4 v1 --"p:P2067"--> v2 bind8[/"'Total count of fencers with mass present on their item'"/] bind8 --as--o v6 bind9[/"count(?item)"/] v1 --o bind9 bind9 --as--o v6 end union0r <== or ==> union0l end