public ImportViewModel(Store store) : base(store) { LocalImportCheckedCommand = new RelayCommand(HandleLocalImportChecked); RemoteImportCheckedCommand = new RelayCommand(HandleRemoteImportChecked); StartClickCommand = new RelayCommand<RoutedEventArgs>(HandleStartClick); QueuedJobs = new ObservableCollection<ImportJobViewModel>(); }
public ExportViewModel(Store store) : base(store) { StartClickCommand = new RelayCommand<RoutedEventArgs>(HandleStartClick); ExportFileName = string.Format(store.Location + "_" + DateTime.Now.ToString("yyyyMMdd_HHmmss")); ExportFileFormats = RdfFormat.AllFormats.Select(x=>new RdfFormatViewModel(x)).OrderBy(x=>x.DisplayName).ToArray(); ExportFileFormat = ExportFileFormats.FirstOrDefault(x => x.Format.DefaultExtension.Equals("nt")); }
public SparqlUpdateViewModel(Store store, IEnumerable<PrefixConfiguration> prefixes) : base(store) { ExecuteCommand = new RelayCommand(ExecuteSparql); KeyUpCommand = new RelayCommand<KeyEventArgs>(HandleKeyUp); SparqlUpdateString = String.Join("\n", prefixes.Select(p => String.Format("PREFIX {0}: <{1}>", p.Prefix, p.Uri))); if (!String.IsNullOrEmpty(SparqlUpdateString)) SparqlUpdateString += "\n"; }
public StoreHistoryViewModel(Store store, IEnumerable<PrefixConfiguration> prefixes) : base(store) { CommitPoints = new ObservableCollection<CommitPointViewModel>(store.GetCommitPoints(0, 20)); HasMoreCommitPoints = CommitPoints.Count == 20; HistoricalQueryViewModel = new SparqlQueryViewModel(store, prefixes); ExecuteCommand = HistoricalQueryViewModel.ExecuteCommand; RefreshCommand = new RelayCommand(Refresh); RevertCommand = new RelayCommand(Revert); MoreCommitPointsCommand = new RelayCommand(MoreCommitPoints); }
public SparqlQueryViewModel(Store store, IEnumerable<PrefixConfiguration> prefixes) : base(store) { ExecuteCommand = new RelayCommand(ExecuteSparql); KeyUpCommand = new RelayCommand<KeyEventArgs>(HandleKeyUp); LoadCommand = new RelayCommand(LoadQuery); SaveCommand = new RelayCommand(SaveQuery); ResultColumnNames = new ObservableCollection<string>(); SparqlQueryString = String.Join("\n", prefixes.Select(p => String.Format("PREFIX {0}: <{1}>", p.Prefix, p.Uri))); if (!String.IsNullOrEmpty(SparqlQueryString)) SparqlQueryString += "\n"; }
private void HandleShowWindowMessage(ShowWindowMessage msg) { switch (msg.Name) { case "NewConnection": { var connectionModel = new Connection(); var newConnectionDialog = new ConnectionPropertiesDialog {DataContext = connectionModel}; var dlgResult = newConnectionDialog.ShowDialog(); if (dlgResult.HasValue && dlgResult.Value) { var model = DataContext as MainViewModel; if (model != null) { model.StoreSources.Add(connectionModel); model.AddConnectionConfiguration(connectionModel.Name, connectionModel.ConnectionString, connectionModel.RequiresAuthentication); } } break; } case "EditConnection": { var connectionModel = msg.ViewModel as Connection; if (connectionModel != null) { var editModel = connectionModel.Clone(); var dlg = new ConnectionPropertiesDialog {DataContext = editModel}; var dlgResult = dlg.ShowDialog(); if (dlgResult.HasValue && dlgResult.Value) { var oldName = connectionModel.Name; connectionModel.CopyFrom(editModel); var mvm = DataContext as MainViewModel; if (mvm != null) { mvm.ServerRefresh(connectionModel); } // Update configuration var model = DataContext as MainViewModel; if (model != null) { model.UpdateConnectionConfiguration(oldName, connectionModel.Name, connectionModel.ConnectionString, connectionModel.RequiresAuthentication); } } } break; } case "PrefixesDialog": { var configuration = msg.ViewModel as PolarisConfigurationModel; if (configuration != null) { var oldPrefixes = new List<PrefixConfiguration>(configuration.Prefixes); var dlg = new PrefixesDialog { DataContext = configuration }; var dlgResult = dlg.ShowDialog(); if (dlgResult.HasValue && dlgResult.Value) { configuration.Save(); } else { configuration.Prefixes = oldPrefixes; } } break; } case "CreateStore": { var connection = msg.ViewModel as Connection; if (connection != null) { var storeModel = new Store(connection, Guid.NewGuid().ToString()); var storePropertiesDialog = new StorePropertiesDialog {DataContext = storeModel, Title = "New Store Properties"}; var dlgResult = storePropertiesDialog.ShowDialog(); if (dlgResult.HasValue && dlgResult.Value && msg.Continuation != null) { msg.Continuation(storePropertiesDialog.DataContext); } } break; } case "AboutDialog": { var dlg = new AboutDialog {DataContext = msg.ViewModel}; dlg.ShowDialog(); break; } } }
public StoreStatisticsViewModel(Store store) : base(store) { UpdateStatsCommand = new RelayCommand<RoutedEventArgs>(UpdateStats); Refresh(); }
// Not currently supported for the b-plus tree store /* public object AnalyzeStore(Store s) { var analyzerViewModel = new StoreAnalyzerViewModel(s); var analyzerView = new StoreAnalyzerView {DataContext = analyzerViewModel}; var tabItemViewModel = new TabItemViewModel("Store Analysis", analyzerView); TabItems.Add(tabItemViewModel); Messenger.Default.Send(new SelectTabMessage(tabItemViewModel)); return null; } */ public void StoreDelete(Store storeToDelete) { try { var msg = String.Format(Strings.DeleteStoreDialogContent, storeToDelete.Location); Messenger.Default.Send( new ShowDialogMessage( Strings.DeleteStoreDialogTitle, msg, MessageBoxImage.Question, MessageBoxButton.YesNo, result => ContinueStoreDelete(storeToDelete, result)), "MainWindow" ); } catch (Exception ex) { HandleCommandException("Error deleting store.", ex); } }
public void NewHistoryView(Store s) { var viewModel = new StoreHistoryViewModel(s, Configuration.Prefixes); var historyView = new StoreHistoryView {DataContext = viewModel}; var tabItemViewModel = new TabItemViewModel(String.Format(Strings.HistoryTabDefaultTitle, s.Location), historyView); tabItemViewModel.Toolbars.Add("SparqlQueryToolbar"); tabItemViewModel.Toolbars.Add("HistoryToolbar"); TabItems.Add(tabItemViewModel); Messenger.Default.Send(new SelectTabMessage(tabItemViewModel)); }
public object NewExportJob(Store s) { var viewModel = new ExportViewModel(s); var exportView = new ExportView { DataContext = viewModel }; var tabItemModel = new TabItemViewModel(String.Format(Strings.ExportTabDefaultTitle, s.Location), exportView); TabItems.Add(tabItemModel); Messenger.Default.Send(new SelectTabMessage(tabItemModel)); return null; }
public void ExecuteUpdate(Store store, string sparqlUpdateString) { try { var client = BrightstarService.GetClient(_connectionString); var jobInfo = client.ExecuteUpdate(store.Location, sparqlUpdateString); if (!jobInfo.JobCompletedOk) { if (jobInfo.ExceptionInfo != null) { ExtractSyntaxError(jobInfo.ExceptionInfo); throw new SparqlUpdateException(jobInfo.ExceptionInfo); } throw new SparqlUpdateException(jobInfo.StatusMessage); } } catch (Exception ex) { throw new SparqlUpdateException(ex); } }
public XDocument ExecuteQuery(Store store, string sparqlQueryString, CommitPointViewModel targetCommitPoint) { var client = BrightstarService.GetClient(_connectionString); try { if (targetCommitPoint == null) { using (var resultsStream = client.ExecuteQuery(store.Location, sparqlQueryString)) { XDocument result = XDocument.Load(resultsStream); return result; } } else { var commitPoint = client.GetCommitPoint(store.Location, targetCommitPoint.CommitTime); if (commitPoint == null) { throw new Exception("Could not retrieve specified commit point from store."); } using(var resultsStream = client.ExecuteQuery(commitPoint, sparqlQueryString)) { XDocument result = XDocument.Load(resultsStream); return result; } } } catch (BrightstarClientException brightstarClientException) { ExtractSyntaxError(brightstarClientException.InnerException); throw new SparqlQueryException(brightstarClientException); } catch (Exception ex) { throw new SparqlQueryException(ex); } }
public void CreateStore(Store store) { var client = BrightstarService.GetClient(_connectionString); client.CreateStore(store.Location); Stores.Add(store); }
public static long MaxRecommendedImportSize = 50*1024*1024; // 50MB public ImportViewModel(Store store) : base(store) { LocalImportCheckedCommand = new RelayCommand(HandleLocalImportChecked); RemoteImportCheckedCommand = new RelayCommand(HandleRemoteImportChecked); StartClickCommand = new RelayCommand<RoutedEventArgs>(HandleStartClick); }
public TransactionViewModel(Store store, IEnumerable<PrefixConfiguration> prefixes) : base(store) { ValidationMessages = new ObservableCollection<string>(); ExecuteCommand = new RelayCommand<RoutedEventArgs>(Execute); _prefixes = prefixes; }
public void RevertToCommitPoint(Store store, CommitPointViewModel targetCommitPoint) { if (targetCommitPoint == null) return; var client = BrightstarService.GetClient(ConnectionString); var commitPoint = client.GetCommitPoint(store.Location, targetCommitPoint.CommitTime); if (commitPoint == null) { throw new ApplicationException(String.Format("Could not find commit point for {0} (ID: {1})", targetCommitPoint.CommitTime, targetCommitPoint.Id)); } client.RevertToCommitPoint(store.Location, commitPoint); }
public IEnumerable<CommitPointViewModel> GetCommitPoints(Store store, DateTime latest, DateTime earliest, int skip, int take) { var client = BrightstarService.GetClient(ConnectionString); return client.GetCommitPoints(store.Location, latest, earliest, skip, take).Select( x => new CommitPointViewModel(x)); }
public object NewSparqlUpdate(Store s) { var viewModel = new SparqlUpdateViewModel(s, Configuration.Prefixes); var sparqlUpdateView = new SparqlUpdateView {DataContext = viewModel}; var tabItemModel = new TabItemViewModel("SPARQL Update", sparqlUpdateView); tabItemModel.Toolbars.Add("StoreSelectorToolbar"); tabItemModel.Toolbars.Add("SparqlUpdateToolbar"); TabItems.Add(tabItemModel); Messenger.Default.Send(new SelectTabMessage(tabItemModel)); return null; }
public StatisticsViewModel GetStatistics(Store store) { var client = BrightstarService.GetClient(ConnectionString); var stats = client.GetStatistics(store.Location); return stats == null ? null : new StatisticsViewModel(stats); }
public object NewTransaction(Store s) { var viewModel = new TransactionViewModel(s, Configuration.Prefixes); var transactionView = new TransactionView{DataContext = viewModel}; var tabItemViewModel = new TabItemViewModel(Strings.TransactionTabDefaultTitle, transactionView); tabItemViewModel.Toolbars.Add("StoreSelectorToolbar"); tabItemViewModel.Toolbars.Add("TransactionToolbar"); TabItems.Add(tabItemViewModel); Messenger.Default.Send(new SelectTabMessage(tabItemViewModel)); return null; }
protected StoreOperationViewModel(Store store) { Server = store.Source; Store = store; }
public void NewStatisticsView(Store s) { var viewModel = new StoreStatisticsViewModel(s); var statisticsView = new StoreStatisticsView {DataContext = viewModel}; var tabItemViewModel = new TabItemViewModel(String.Format(Strings.StatisticsTabDefaultTitle, s.Location), statisticsView); TabItems.Add(tabItemViewModel); Messenger.Default.Send(new SelectTabMessage(tabItemViewModel)); }
public StoreAnalyzerViewModel(Store localStore) { _store = localStore; Reports = new ObservableCollection<AnalysisViewModel>(); }
private void ContinueStoreDelete(Store storeToDelete, MessageBoxResult result) { try { if (result == MessageBoxResult.Yes) { storeToDelete.Source.DeleteStore(storeToDelete.Location); } } catch (Exception ex) { HandleCommandException("Error deleting store.", ex); } }
public ExportViewModel(Store store) : base(store) { StartClickCommand = new RelayCommand<RoutedEventArgs>(HandleStartClick); ExportFileName = String.Format(store.Location + "_" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".nt"); }