Skip to content

Commit

Permalink
Fix count triple query in Blazegraph client
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Dumas committed Oct 23, 2024
1 parent 895a4e8 commit bb756b4
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,12 @@ class BlazegraphClient(
* Count all the triples on an index
*/
def count(index: String): IO[Long] = {
val sparqlQuery = SparqlConstructQuery.unsafe("SELECT (COUNT(?s) AS ?count) WHERE { ?s ?p ?o }")
val sparqlQuery = SparqlConstructQuery.unsafe("SELECT (COUNT(*) AS ?count) WHERE { ?s ?p ?o }")
query(Set(index), sparqlQuery, SparqlResultsJson)
.flatMap { response =>
val count = for {
head <- response.value.results.bindings.headOption
_ = println(response)
countAsString <- head.get("count")
count <- countAsString.value.toLongOption
} yield count
Expand Down

0 comments on commit bb756b4

Please sign in to comment.