Skip to content

Commit

Permalink
Deprioritises Alternates Profile
Browse files Browse the repository at this point in the history
  • Loading branch information
recalcitrantsupplant committed Oct 15, 2024
1 parent c71af11 commit d7fa084
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions prez/services/connegp_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def _compose_select_query(self) -> str:
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX sh: <http://www.w3.org/ns/shacl#>
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)}}}
Expand All @@ -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=<http://www.w3.org/ns/dx/connegp/altr-ext#alt-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
Expand Down Expand Up @@ -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]
]
Expand All @@ -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
Expand Down

0 comments on commit d7fa084

Please sign in to comment.