If I want to get the metrics of a single corpus as included in the response of the v1/corpora endpoint when setting the parameter include to "metrics"I have to get all corpora and then filter for the corpus I am interested in and retrieve the metrics from there. The function that generates the metrics for a corpus is a local function (local:get-corpus-metrics($name)) that – because it is in the local namespace in the api.xqm module can't be called from another module. Because it generates metrics it could become metrics:get-corpus-metrics or moved to the util module dutil:get-corpus-metrics. Anything would be fine as long as it is callable.
This is the function: https://github.com/dracor-org/dracor-api/blob/main/modules/api.xqm#L199-L225
(There is a function dutil:get-corpus-meta-data but this returns metadata on the individual plays in a corpus, not the corpus itself.)
If I want to get the metrics of a single corpus as included in the response of the
v1/corporaendpoint when setting the parameterincludeto"metrics"I have to get all corpora and then filter for the corpus I am interested in and retrieve the metrics from there. The function that generates the metrics for a corpus is a local function (local:get-corpus-metrics($name)) that – because it is in the local namespace in theapi.xqmmodule can't be called from another module. Because it generates metrics it could becomemetrics:get-corpus-metricsor moved to the util moduledutil:get-corpus-metrics. Anything would be fine as long as it is callable.This is the function: https://github.com/dracor-org/dracor-api/blob/main/modules/api.xqm#L199-L225
(There is a function
dutil:get-corpus-meta-databut this returns metadata on the individual plays in a corpus, not the corpus itself.)