Free cookie consent management tool by TermsFeed Policy Generator

Changeset 539 for trunk


Ignore:
Timestamp:
09/03/08 20:39:12 (16 years ago)
Author:
gkronber
Message:

added a method that creates a number of default items and statements (we could call it ontology) this is necessary so that we have a list of fixed items that will later allow selection of specific items based on statements.
#261 (Items are stored multiple times in the result entries in the CEDMA DB).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CEDMA.Server/ServerForm.cs

    r492 r539  
    3737using System.Threading;
    3838using HeuristicLab.Grid;
     39using HeuristicLab.Data;
     40using HeuristicLab.Core;
    3941
    4042namespace HeuristicLab.CEDMA.Server {
     
    6870        database = new Database(connectionString);
    6971        database.CreateNew();
     72        InitDefaultOntology();
    7073      } else {
    7174        database = new Database(connectionString);
     75        if(database.GetOntologyItems().Count==0) InitDefaultOntology();
    7276      }
     77    }
     78
     79    private void InitDefaultOntology() {
     80      // init default ontology
     81      StringData cedmaOntology = new StringData("CedmaOntology");
     82      StringData definesEntity = new StringData("definesEntity");
     83      StringData classGpFunctionTree = new StringData("class:GpFunctionTree");
     84      StringData classDataset = new StringData("class:Dataset");
     85      StringData instanceOf = new StringData("instanceOf");
     86      StringData hasModel = new StringData("hasModel");
     87      StringData modelOf = new StringData("modelOf");
     88      StringData targetVariable = new StringData("targetVariable");
     89      StringData trainingMse = new StringData("trainingMSE");
     90      StringData validationMse = new StringData("validationMSE");
     91
     92      LinkItems(cedmaOntology, definesEntity, cedmaOntology);
     93      LinkItems(cedmaOntology, definesEntity, definesEntity);
     94      LinkItems(cedmaOntology, definesEntity, classGpFunctionTree);
     95      LinkItems(cedmaOntology, definesEntity, classDataset);
     96      LinkItems(cedmaOntology, definesEntity, instanceOf);
     97      LinkItems(cedmaOntology, definesEntity, hasModel);
     98      LinkItems(cedmaOntology, definesEntity, modelOf);
     99      LinkItems(cedmaOntology, definesEntity, targetVariable);
     100      LinkItems(cedmaOntology, definesEntity, trainingMse);
     101      LinkItems(cedmaOntology, definesEntity, validationMse);
     102    }
     103
     104    private void LinkItems(StringData subj, StringData pred, StringData prop) {
     105      ItemEntry subjEntry = new ItemEntry();
     106      ItemEntry predEntry = new ItemEntry();
     107      ItemEntry propEntry = new ItemEntry();
     108      subjEntry.Guid = subj.Guid;
     109      subjEntry.RawData = PersistenceManager.SaveToGZip(subj);
     110      predEntry.Guid = pred.Guid;
     111      predEntry.RawData = PersistenceManager.SaveToGZip(pred);
     112      propEntry.Guid = prop.Guid;
     113      propEntry.RawData = PersistenceManager.SaveToGZip(prop);
     114
     115      database.LinkItems(subjEntry, predEntry, propEntry);
    73116    }
    74117
Note: See TracChangeset for help on using the changeset viewer.