aboutsummaryrefslogtreecommitdiffstats
path: root/bsfs/triple_store/sparql/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'bsfs/triple_store/sparql/utils.py')
-rw-r--r--bsfs/triple_store/sparql/utils.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/bsfs/triple_store/sparql/utils.py b/bsfs/triple_store/sparql/utils.py
index deca4d8..38062c2 100644
--- a/bsfs/triple_store/sparql/utils.py
+++ b/bsfs/triple_store/sparql/utils.py
@@ -1,9 +1,4 @@
-"""
-Part of the BlackStar filesystem (bsfs) module.
-A copy of the license is provided with the project.
-Author: Matthias Baumgartner, 2022
-"""
# standard imports
import typing
@@ -127,11 +122,12 @@ class Query():
"""Return an executable sparql query."""
select = ' '.join(f'({head} as ?{name})' for head, name in self.select)
return f'''
- SELECT {self.root_head} {select}
+ SELECT DISTINCT {self.root_head} {select}
WHERE {{
{self.root_head} <{ns.rdf.type}>/<{ns.rdfs.subClassOf}>* <{self.root_type}> .
{self.where}
}}
+ ORDER BY str({self.root_head})
'''
def __call__(self, graph: rdflib.Graph) -> rdflib.query.Result: