aboutsummaryrefslogtreecommitdiff
path: root/gn3/api
diff options
context:
space:
mode:
authorMunyoki Kilyungi2023-11-13 13:22:12 +0300
committerBonfaceKilz2023-11-27 12:29:25 +0300
commit72955126fa988aceeb18ce434f0cee7b1ae94127 (patch)
tree68a1ee0cad0806407911a5d3c5dbd070cd3de1fc /gn3/api
parentd902a3f5af32d7f81e8e21604ae0f2c6c118c5e2 (diff)
downloadgenenetwork3-72955126fa988aceeb18ce434f0cee7b1ae94127.tar.gz
Return distinct results after a dataset search.
* gn3/api/metadata.py (search_datasets): Return distinct search results. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'gn3/api')
-rw-r--r--gn3/api/metadata.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/gn3/api/metadata.py b/gn3/api/metadata.py
index 60be66e..6623508 100644
--- a/gn3/api/metadata.py
+++ b/gn3/api/metadata.py
@@ -280,7 +280,7 @@ CONSTRUCT {
]
} WHERE {
{
- SELECT ?dataset ?label ?inbredSetName ?datasetType ?title WHERE {
+ SELECT DISTINCT ?dataset ?label ?inbredSetName ?datasetType ?title WHERE {
?dataset rdf:type dcat:Dataset ;
rdfs:label ?label ;
?datasetPredicate ?datasetObject ;
@@ -301,7 +301,7 @@ CONSTRUCT {
}
{
- SELECT (COUNT(*)/$limit+1 AS ?totalCount) WHERE {
+ SELECT (COUNT(DISTINCT ?dataset)/$limit+1 AS ?pages) (COUNT(DISTINCT ?dataset) AS ?hits) WHERE {
?dataset rdf:type dcat:Dataset ;
?p ?o .
?o bif:contains "'$term'" .