The Knowledge Graph Conference Icon
The Knowledge Graph Conference
  • 馃彔Home
  • 馃搮Events
  • 馃懁Members
  • 馃數Announcements
  • 馃數Ask
  • 馃數Ask The Ontologists
  • 馃數Events
  • 馃數Jobs
  • 馃數Promotions
  • 馃數Share
Powered by Tightknit
Ask
Ask

Using COUNT() Function in RDFLib: Guidance Needed

Avatar of Leia D.Leia D.
路May 18, 2022 04:05 PM

For those of you that work in RDFLib, have you used the COUNT() function? If so, how do you print your results? I know this is basic yet I need some guidance. Thanks!

5 comments

路 Sorted by Oldest
    • Avatar of nabeel
      nabeel
      路

      like to count the number of results?

    • Avatar of nabeel
      nabeel
      路

      my general practice to count the number of results from like a SPARQL query is to use

      res = graph.query(sparql_query)
      len(res)

    • Avatar of Leia D.
      Leia D.
      路

      Yes. I'll need to use SUM() too but think that would follow a similar pattern.

    • Avatar of nabeel
      nabeel
      路

      hmm i haven't used the COUNT() or SUM() rdflib functions myself

    • Avatar of Leia D.
      Leia D.
      路

      I see. Thank you for your suggestion! I'll try it.