Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Count number of triples #44

Open
koslambrou opened this issue Jan 10, 2021 · 0 comments
Open

Count number of triples #44

koslambrou opened this issue Jan 10, 2021 · 0 comments

Comments

@koslambrou
Copy link

The following SPARQL query allows to fetch the number of triples in the database:

SELECT (COUNT(*) as ?count) WHERE {
  ?s ?p ?o .
}

However, there's doesn't seem to an equivalent of writing that query in HSparql.

The closest SPARQL query would be:

SELECT (COUNT(?s) as ?count) WHERE {
  ?s ?p ?o .
}

Which translates to:

countTriplesQuery :: Query SelectQuery
countTriplesQuery = do
  s <- var
  p <- var
  o <- var
  t <- triple s p o
  
  c <- var
  select [count s `as` c]

However, this SPARQL query is much slower than the 1st when tested on Wikidata.

Possible enhancement ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant