Changeset 2049


Ignore:
Timestamp:
06/16/09 09:51:33 (12 years ago)
Author:
gkronber
Message:

Fixed a bug that is triggered when the results DB is still empty. #656

File:
1 edited

Legend:

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

    r2047 r2049  
    9898
    9999    private void PopulateFinishedRuns() {
    100       var datasetEntity = store
     100      var datasetBindings = store
    101101        .Query(
    102102        "?Dataset <" + Ontology.InstanceOf + "> <" + Ontology.TypeDataSet + "> .", 0, 1)
    103         .Select(x => (Entity)x.Get("Dataset")).ElementAt(0);
    104       DataSet ds = new DataSet(store, datasetEntity);
     103        .Select(x => (Entity)x.Get("Dataset"));
    105104
    106       var result = store
    107         .Query(
    108         "?Model <" + Ontology.TargetVariable + "> ?TargetVariable ." + Environment.NewLine +
    109         "?Model <" + Ontology.Name + "> ?AlgoName .",
    110         0, 1000)
    111         .Select(x => new Resource[] { (Literal)x.Get("TargetVariable"), (Literal)x.Get("AlgoName") });
     105      if (datasetBindings.Count() > 0) {
     106        var datasetEntity = datasetBindings.ElementAt(0);
    112107
    113       foreach (Resource[] row in result) {
    114         string targetVariable = (string)((Literal)row[0]).Value;
    115         string algoName = (string)((Literal)row[1]).Value;
     108        DataSet ds = new DataSet(store, datasetEntity);
     109        var result = store
     110          .Query(
     111          "?Model <" + Ontology.TargetVariable + "> ?TargetVariable ." + Environment.NewLine +
     112          "?Model <" + Ontology.Name + "> ?AlgoName .",
     113          0, 1000)
     114          .Select(x => new Resource[] { (Literal)x.Get("TargetVariable"), (Literal)x.Get("AlgoName") });
    116115
    117         int targetVariableIndex = ds.Problem.Dataset.GetVariableIndex(targetVariable);
    118         if (!AlgorithmFinishedOrDispatched(targetVariableIndex, algoName))
    119           AddDispatchedRun(targetVariableIndex, algoName);
     116        foreach (Resource[] row in result) {
     117          string targetVariable = (string)((Literal)row[0]).Value;
     118          string algoName = (string)((Literal)row[1]).Value;
     119
     120          int targetVariableIndex = ds.Problem.Dataset.GetVariableIndex(targetVariable);
     121          if (!AlgorithmFinishedOrDispatched(targetVariableIndex, algoName))
     122            AddDispatchedRun(targetVariableIndex, algoName);
     123        }
    120124      }
    121125    }
Note: See TracChangeset for help on using the changeset viewer.