diff --git a/prez/services/connegp_service.py b/prez/services/connegp_service.py index 5e35c91..cb89567 100755 --- a/prez/services/connegp_service.py +++ b/prez/services/connegp_service.py @@ -273,7 +273,7 @@ def _compose_select_query(self) -> str: PREFIX skos: PREFIX sh: - SELECT ?profile ?title ?class (count(?mid) as ?distance) ?req_profile ?def_profile ?format ?req_format ?def_format + SELECT ?profile ?title ?class (count(?mid) as ?distance) ?req_profile ?def_profile ?format ?req_format ?def_format ?alt_prof WHERE {{ VALUES ?class {{{" ".join('<' + str(klass) + '>' for klass in self.classes)}}} @@ -291,9 +291,10 @@ def _compose_select_query(self) -> str: altr-ext:hasDefaultProfile ?profile }} AS ?def_profile) {self._generate_mediatype_if_statements()} BIND(EXISTS {{ ?profile altr-ext:hasDefaultResourceFormat ?format }} AS ?def_format) + BIND(?profile= AS ?alt_prof) }} - GROUP BY ?class ?profile ?req_profile ?def_profile ?format ?req_format ?def_format ?title - ORDER BY DESC(?req_profile) DESC(?distance) DESC(?def_profile) DESC(?req_format) DESC(?def_format) + GROUP BY ?class ?profile ?req_profile ?def_profile ?format ?req_format ?def_format ?title ?alt_prof + ORDER BY DESC(?req_profile) DESC(?distance) DESC(?def_profile) DESC(?req_format) DESC(?def_format) ASC(?alt_prof) """ ) return query @@ -336,6 +337,7 @@ async def _do_query(self, query: str) -> tuple[Graph, list]: item["format"]["value"], item["req_format"]["value"], item["def_format"]["value"], + item["alt_prof"]["value"], ] for item in response[1][0][1] ] @@ -350,6 +352,7 @@ async def _do_query(self, query: str) -> tuple[Graph, list]: "Format", "Requested Format", "Default Format", + "Alternate Profile" ] # Render as a table