Explorar o código

✨ make default schema configurable

jmacura %!s(int64=4) %!d(string=hai) anos
pai
achega
af9a0ca5a9
Modificáronse 2 ficheiros con 5 adicións e 1 borrados
  1. 4 1
      src/adjuster/adjuster-presets.service.ts
  2. 1 0
      src/attractiveness.config.json

+ 4 - 1
src/adjuster/adjuster-presets.service.ts

@@ -1,6 +1,7 @@
 import {Injectable} from '@angular/core';
 import {Subject} from 'rxjs';
 
+import attractivenessConfig from '../attractiveness.config.json';
 import {AdjusterEventService} from './adjuster-event.service';
 import {RDFSubject} from './ontology.model';
 
@@ -9,6 +10,7 @@ export class AdjusterPresetsService {
   activeProblem: Problem;
   activeRole: Role;
   activeSchema: Schema;
+  defaultSchemaId: string;
 
   schemaChanges: Subject<Schema> = new Subject();
   problemChanges: Subject<Problem> = new Subject();
@@ -18,6 +20,7 @@ export class AdjusterPresetsService {
   schemas: Schema[] = [];
 
   constructor(public adjusterEventService: AdjusterEventService) {
+    this.defaultSchemaId = attractivenessConfig?.defaultClassificationSchema;
     this.adjusterEventService.ontologyLoads.subscribe((ontology) => {
       this.ontology = ontology;
       this.loadRoles();
@@ -102,7 +105,7 @@ export class AdjusterPresetsService {
           )
         }
       });
-    this.activeSchema = this.schemas[0];
+    this.activeSchema = this.schemas.find((schema) => schema.id == this.defaultSchemaId) ?? this.schemas[0];
     this.schemaChanges.next(this.activeSchema);
   }
 

+ 1 - 0
src/attractiveness.config.json

@@ -3,6 +3,7 @@
     "haclustwd2",
     "km50l.cluster"
   ],
+  "defaultClassificationSchema": "http://www.semanticweb.org/attractiveness/UNSDG",
   "initialWeights": {
     "http://www.semanticweb.org/attractiveness/poverty": 0.1,
     "http://www.semanticweb.org/attractiveness/wellbeing": 0.25,