Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tfrancart committed Jul 13, 2024
1 parent 270ddb2 commit 5ff4e42
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class WidgetWrapper extends HTMLComponent {
widgetType == Config.NON_SELECTABLE_PROPERTY
? (htmlString = lineSpan + selectAnySpan)
// if there is a value, do not propose the "Any" selection option
: (this.widgetComponent.getwidgetValues().length > 0)
: (this.widgetComponent.getWidgetValues().length > 0)
?(htmlString = lineSpan + endLabelSpan)
:(htmlString = lineSpan + selectAnySpan + orSpan + endLabelSpan);

Expand Down
11 changes: 1 addition & 10 deletions src/sparnatural/components/widgets/AbstractWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,13 @@ export abstract class AbstractWidget extends HTMLComponent {

// Is used to parse the inputs from the ISparnaturalJson e.g "preloaded" queries
abstract parseInput(value:WidgetValue["value"]):WidgetValue

getSparnaturalRepresentation() {
let vals = this.widgetValues.map((v) => v.value);
return JSON.stringify(vals);
}

addWidgetValue(widgetValue: WidgetValue) {
this.widgetValues.push(widgetValue);
}

getLastValue() {
return this.widgetValues[this.widgetValues.length - 1];
}

// returns null if valueObject has not been set before
getwidgetValues(): WidgetValue[] {
getWidgetValues(): WidgetValue[] {
return this.widgetValues;
}

Expand Down
4 changes: 4 additions & 0 deletions src/sparnatural/generators/sparql/ValueBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import { LatLng } from "leaflet";

const factory = new DataFactory();

/**
* A factory for creating ValueBuilders from the widgetType. This is the association between the widget type
* and the corresponding ValueBuilder
*/
export class ValueBuilderFactory {

buildValueBuilder(
Expand Down
4 changes: 2 additions & 2 deletions src/sparnatural/generators/sparql/WhereBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default class WhereBuilder{
this.#grpWrapper.CriteriaGroup.ObjectPropertyGroup.objectPropVal,
this.#grpWrapper.CriteriaGroup.EndClassGroup.endClassVal,
this.#grpWrapper.CriteriaGroup.EndClassGroup.isVarSelected(),
this.#grpWrapper.CriteriaGroup.EndClassGroup?.editComponents?.widgetWrapper?.widgetComponent.getwidgetValues()
this.#grpWrapper.CriteriaGroup.EndClassGroup?.editComponents?.widgetWrapper?.widgetComponent.getWidgetValues()
);
}
}
Expand Down Expand Up @@ -114,7 +114,7 @@ export default class WhereBuilder{

#buildRdfPtrn(){
let widgetComponent = this.#grpWrapper.CriteriaGroup.EndClassGroup?.editComponents?.widgetWrapper?.widgetComponent
if (widgetComponent?.getwidgetValues()?.length > 0 ) {
if (widgetComponent?.getWidgetValues()?.length > 0 ) {
this.#rdfPtrns = this.#valueBuilder.build();
}

Expand Down

0 comments on commit 5ff4e42

Please sign in to comment.