query-37d1c0e23ff152068b1da50c4af7e0de

rq turtle/ttl

22:56, 21 February 2018 (UTC) Jura--- come up first. (Q2157934)Nur Fettahoğlu and (Q1884931)Gertrude of Saxony (Q760847)Madison Ivy (Q526915)Princess Eugénie of Sweden Above a simplified version. 23:24, 21 February 2018 (UTC)) talk (Doc Taxon ? hint:: what is the meaning of Jura1@I integrated wdt:P106 as optional, but it's not possible to group the results. I tried several combinations for GROUP BY, no success but "Query is malformed: Bad aggregate":

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
select ?item ?itemLabel ?occLabel ?sitelinks
with
{
  select distinct ?item 
  where
  {
    hint:Query hint:optimizer "None".
    values ?item_class { wd:Q34 wd:Q183 }
    ?item wdt:P27 ?item_class; wdt:P21 wd:Q6581072; wdt:P31 wd:Q5.
    FILTER NOT EXISTS { [] schema:about ?item ; schema:isPartOf <https://de.wikipedia.org/> }
  }
} as %subquery
where
{
  include %subquery.
  optional {?item wdt:P106 ?occ.}
  bind(xsd:integer(substr(str(?item), 33)) as ?num).
  ?item wikibase:sitelinks ?sitelinks 
  service wikibase:label {bd:serviceParam wikibase:language "de,en".}
} 
group by ...???...
order by desc(?sitelinks) asc(?num)

Query found at