You might want to look at the following bits of code then:

  *   
https://github.com/apache/jena/blob/main/jena-arq/src/main/java/org/apache/jena/sparql/engine/optimizer/StatsMatcher.java
 - The code that uses pre-computed statistics, plus some weighting factors to 
decide how to reorder triple/quad patterns within BGPs
  *   
https://github.com/apache/jena/blob/main/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/TransformReorder.java
 - An algebra transform that reorders the triple/quad patterns within BGPs.  
Jena has both a statistics and a non-statistics based reordering available.
  *   
https://github.com/apache/jena/blob/main/jena-cmds/src/main/java/tdb/tdbstats.java
 - A command line utility that pre-computes cardinality statistics for TDB 
databases

Rob

From: Hashim Khan <engr.hashimwa...@gmail.com>
Date: Tuesday, 12 April 2022 at 16:13
To: users@jena.apache.org <users@jena.apache.org>
Subject: Re: cardinality estimation
HI,
     I just want to see how cardinality estimation can be done
programmatically. whatever query or dataset it may be, but I want to see it
practically.

On Tue, Apr 12, 2022 at 4:33 PM rve...@dotnetrdf.org <rve...@dotnetrdf.org>
wrote:

> Hi
>
> Could you provide more detail about what you are after?  The amount of
> triples that are scanned for a given SPARQL query can vary widely both
> based on the query and how that query gets optimised (which can be data
> dependent)
>
> I don’t think there is anything specifically exposed in the Jena APIs for
> this
>
> Rob
>
> From: Hashim Khan <engr.hashimwa...@gmail.com>
> Date: Tuesday, 12 April 2022 at 14:02
> To: users@jena.apache.org <users@jena.apache.org>
> Subject: cardinality estimation
> Hi,
>      I would like to ask about any specific class or method in Jana which
> can return a value showing the estimated number of triples for a SPARQL
> query?
>
>
> Regards
> --
> *Hashim Khan*
>


--
*Hashim Khan*

Reply via email to