Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/15/08 01:22:08 (15 years ago)
Author:
gkronber
Message:

worked on #419 (Refactor CEDMA plugins)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/DataSet.cs

    r957 r988  
    3232  public class DataSet {
    3333    public IStore Store { get; set; }
    34     public long Id { get; set; }
    35     public string Name { get; set; }
     34
     35    private Guid guid;
     36    public Guid Guid {
     37      get { return guid; }
     38    }
     39
     40    private string name;
     41    public string Name {
     42      get { return name; }
     43    }
     44
    3645    private Problem problem;
    37 
    3846    public Problem Problem {
    3947      get { return problem; }
     
    4250    public DataSet()
    4351      : base() {
     52      guid = Guid.NewGuid();
    4453      problem = new Problem();
    4554    }
    4655
    47     public DataSet(IStore store, long id)
     56    public DataSet(IStore store, Entity dataSetEntity)
    4857      : this() {
    4958      Store = store;
    50       Id = id;
    51     }
    52 
    53     public void Save() {
    54       throw new NotImplementedException();
     59      guid = new Guid(dataSetEntity.Uri.Remove(0, Ontology.CedmaNameSpace.Length));
     60      IList<Statement> names = store.Select(new Statement(dataSetEntity, Ontology.PredicateName, Ontology.AnyEntity));
     61      if (names.Count > 0) name = (string)((Literal)names[0].Property).Value;
     62      else name = guid.ToString();
    5563    }
    5664
    5765    public void Activate() {
    58       throw new NotImplementedException();
    59     }
    60 
    61     private void UpdateDataSet(long Id, byte[] p) {
    62       throw new NotImplementedException();
     66      Entity myEntity = new Entity (Ontology.CedmaNameSpace + Guid);
     67      Store.Add(new Statement(myEntity, Ontology.PredicateInstanceOf, Ontology.TypeDataSet));
     68      Store.Add(new Statement(myEntity, Ontology.PredicateSerializedData, new Literal(PersistenceManager.SaveToGZip(problem))));
     69      Store.Add(new Statement(myEntity, Ontology.PredicateName, new Literal(name)));
    6370    }
    6471
Note: See TracChangeset for help on using the changeset viewer.