[Mulgara-general] server stats

Alex Hall alexhall at revelytix.com
Tue Sep 1 18:10:29 UTC 2009


Gregg Reynolds wrote:
> Is there a way to query the server for stats?  E.g. how many triples in
> a graph, how many queries served, etc.

You can find the number of triples in a graph using the aggregate
"count" function in TQL:

select count( select $s $p $o from <myGraphUri> where $s $p $o ) from
<rmi://localhost/server1#> where $x <mulgara:is> 'foo';

The where clause of the outer query is a throw-away; it is required by
the grammar but not relevant for this particular query.  It might have
actually been made optional in the grammar by now but I don't remember
off the top of my head.  At any rate, the real work is done by the count
function; it gets the number of rows in the result set of its inner
query.  Keep in mind, there are no internal data structures to track the
number of statements in a graph and this query may cause all of those
statements to be materialized so it won't necessarily perform all that well.

There is no equivalent count function in the current version of SPARQL,
although this is a required feature for the next version.  Paul has also
mentioned implementing the HEAD method as a count for the SPARQL and TQL
endpoints, but to the best of my knowledge this has not been done yet.

As for other types of server statistics, such as number of queries
served, we do not track those.

Regards,
Alex



More information about the Mulgara-general mailing list