query: #summary of test results for women related tests for non fiction, ordered by number of wikipedia sitelinks
  SELECT ?item ?itemLabel ?type (MIN(YEAR(?date)) AS ?year)
  (GROUP_CONCAT(DISTINCT ?zimmerman; separator = '/') AS ?Zimmerman) 
  (GROUP_CONCAT(DISTINCT ?finkbeiner; separator = '/') AS ?Finkbeiner) 
  ?sitelinks
  #first I'm getting all items with at least one result for one of the tests
  WITH { SELECT DISTINCT ?item ?type WHERE {
      #getting possible results
      VALUES ?test {wd:Q105642280 wd:Q14928138}
      #for consideration an item has to have at least one result for one of the tests
      ?item wdt:P5021 ?test.
      #excluding television series episodes and chapters
      MINUS{?item wdt:P31/wdt:P279* wd:Q21191270}
      MINUS{?item wdt:P31/wdt:P279* wd:Q1980247}
      OPTIONAL{?item wdt:P31/wdt:P279* wd:Q11424 BIND("film" AS ?type)}
      OPTIONAL{?item wdt:P31/wdt:P279* wd:Q5398426 BIND("television series" AS ?type)}
      OPTIONAL{?item wdt:P31/wdt:P279* wd:Q7725634 BIND("literary work" AS ?type)}
  }
  } AS %items
  #now I get the results for all relevant tests
   WHERE {    
      INCLUDE %items
      #getting zimmerman
      OPTIONAL{?item p:P5021 ?st_zimmerman. ?st_zimmerman ps:P5021 wd:Q105642280; pq:P9259 ?zimmerman_result.
              ?zimmerman_result rdfs:label ?zimmerman. FILTER(LANG(?zimmerman)="en")}
      #getting finkbeiner
      OPTIONAL{?item p:P5021 ?st_finkbeiner. ?st_finkbeiner ps:P5021 wd:Q14928138; pq:P9259 ?finkbeiner_result.
              ?finkbeiner_result rdfs:label ?finkbeiner. FILTER(LANG(?finkbeiner)="en")}
      ?item wikibase:sitelinks ?sitelinks.
      OPTIONAL{?item wdt:P577 ?publication}
      OPTIONAL{?item wdt:P580 ?start}
      BIND(IF(BOUND(?publication),?publication,?start) AS ?date)
     
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  }
  GROUP BY ?item ?itemLabel ?count ?sitelinks ?type
  ORDER BY DESC(?sitelinks)