blazegraph / database

Blazegraph High Performance Graph Database
GNU General Public License v2.0
872 stars 170 forks source link

HAVING with mutiple conditions does not work #234

Open WolfgangFahl opened 1 year ago

WolfgangFahl commented 1 year ago
# truly tabular aggregate query for 
# Q1667921:novel series
# generated by trulytabular.py version 0.3.1 on 2022-07-30T07:44:32.582930
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX schema: <http://schema.org/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
SELECT ?novel_series ?novel_seriesLabel
  (SAMPLE (?genre) AS ?genre_sample)
  (SAMPLE (?author) AS ?author_sample)
  (SAMPLE (?title) AS ?title_sample)
WHERE {
  # instanceof Q1667921:novel series
  ?novel_series wdt:P31 wd:Q1667921.
  # label
  ?novel_series rdfs:label ?novel_seriesLabel.  
  FILTER (LANG(?novel_seriesLabel) = "en").
  # genre (P136)
  OPTIONAL { 
    ?novel_series wdt:P136 ?genre. 
  }
  # author (P50)
  OPTIONAL { 
    ?novel_series wdt:P50 ?author. 
  }
  # title (P1476)
  OPTIONAL { 
    ?novel_series wdt:P1476 ?title. 
  }
}
GROUP BY ?novel_series ?novel_seriesLabel
HAVING 
  (COUNT(?genre)=1)
  (COUNT(?author)=1)
  (COUNT(?title)=1)

works on

but not on