diff --git a/query-by-graph/src/App.vue b/query-by-graph/src/App.vue index 14a499c..c155627 100644 --- a/query-by-graph/src/App.vue +++ b/query-by-graph/src/App.vue @@ -13,7 +13,7 @@ import ConnectionInterfaceType from "./lib/types/ConnectionInterfaceType.ts"; import ClipboardButton from "./components/ClipboardButton.vue"; import QueryButton from './components/QueryButton.vue'; import WikibaseDataService from './lib/wikidata/WikibaseDataService.ts'; -import {selectedDataSource, dataSources, setSelectedDataSource} from './store.ts'; +import {selectedDataSource, dataSources, setSelectedDataSource, globalDistinct} from './store.ts'; import {WikibaseDataSource} from "./lib/types/WikibaseDataSource.ts"; import {debounce} from "./lib/utils"; import DataSourcesPopover from "./components/DataSourcesPopover.vue"; @@ -225,6 +225,19 @@ const deselectAllVariablesForProjection = () => { } }; +const toggleDistinct = () => { + globalDistinct.value = !globalDistinct.value; + // Sync entity.distinct on every node so the Rust backend export picks it up + if (editor.value) { + editor.value.getNodes().forEach((node: any) => { + if (node.entity) { + node.entity.distinct = globalDistinct.value; + editor.value?.updateNode(node.id); + } + }); + } +}; + const gotoLink = (url?: string) => { const link = url || window.location.href; @@ -383,6 +396,20 @@ const gotoLink = (url?: string) => {

+
+

Distinct Query

+
+ +
+

+ Hint: + When Distinct is enabled, the SELECT DISTINCT modifier is applied globally to the entire query. + Toggling this on any node's "Distinct?" checkbox has the same effect. +

+
+

Arrangement

diff --git a/query-by-graph/src/components/EntitySelectorInputControl.vue b/query-by-graph/src/components/EntitySelectorInputControl.vue index 6969d96..e94cd8a 100644 --- a/query-by-graph/src/components/EntitySelectorInputControl.vue +++ b/query-by-graph/src/components/EntitySelectorInputControl.vue @@ -16,12 +16,22 @@ container-classes="px-2" label-classes="text-white" /> +