Skip to content

Commit dd6c505

Browse files
committed
Filter out present method in related methods SPAQRL query
1 parent 9d8225d commit dd6c505

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

astro/src/pages/method/[slug].astro

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,20 @@ async function getSharedOutput() {
4343
},
4444
// Narrow this to the present method? Or at least limit return.
4545
body: `
46-
PREFIX : <https://uxmethods.org/>
47-
PREFIX uxmo: <https://uxmethods.org/ontology/>
48-
46+
PREFIX uxm: <https://uxmethods.org/ontologies/uxmethods-core#>
47+
4948
SELECT ?origin ?destination (COUNT(?output) AS ?sharedOutputCount)
5049
(GROUP_CONCAT(DISTINCT ?output; SEPARATOR=",") AS ?sharedOutput)
5150
WHERE {
52-
?origin uxmo:hasOutput ?output.
53-
?destination uxmo:hasInput ?output.
51+
GRAPH <https://uxmethods.org/graph/methods> {
52+
?origin uxm:producesOutput ?output .
53+
?destination uxm:usesInput ?output .
54+
FILTER(?origin != ?destination)
5455
}
55-
GROUP BY ?origin ?destination
56-
ORDER BY DESC(?sharedOutputCount)
57-
`,
56+
}
57+
GROUP BY ?origin ?destination
58+
ORDER BY DESC(?sharedOutputCount)
59+
`,
5860
});
5961
6062
if (!kgData.ok) {
@@ -93,6 +95,10 @@ function mapMethods(method: any, methodPreviews: any, kgData: any): any {
9395
// const preparedMethods = methods.map((method) => {
9496
// Filter and assign methods preview list to previous methods
9597
// ☑️ TODO: verify that mapping is weighted to prioritize strongest connections
98+
// ☑️ TODO: when a method qualifies as both upstream and downstream (semantically
99+
// honest — they share concepts in both directions), decide how to display it.
100+
// Options: show only in the heavier-weighted list, mark as bidirectional, or
101+
// surface as a distinct "related" category. Today both lists include it unmarked.
96102
const previousMethods = methodPreviews.filter((methodPreview: any) => {
97103
return kgData.some((relationship: any) => {
98104
return (

0 commit comments

Comments
 (0)