public void SelectVariable(SparqlVariable v) { if (SelectBuilder != null) { if (v != null && !SelectedVariables.Any(x => x.Name == v.Name)) { SelectedVariables.Add(v); } } else { string msg = "Cannot select variables with non-SELECT query type."; throw new Exception(msg); } }
public void DeselectVariable(SparqlVariable v) { if (SelectBuilder != null) { if (v != null && SelectedVariables.Contains(v)) { SelectedVariables.Remove(v); } } else { string msg = "Cannot deselect variables with non-SELECT query type."; throw new Exception(msg); } }
public override void OnSelectClauseVisited(Expression selector) { base.OnSelectClauseVisited(selector); // If we are in the root query generator and have not yet selected the // subject variable, set it from the given selector. if (IsRoot && !SelectedVariables.Any()) { SparqlVariable o = VariableGenerator.TryGetObjectVariable(selector); if (o != null && !IsSelectedVariable(o)) { SelectVariable(o); } } }
private void dataGridViewVariables_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.N: if (e.Control) { _newRequested.OnNext(Unit.Default); } break; case Keys.Delete: _deleteRequested.OnNext(SelectedVariables); break; case Keys.Enter: _editRequested.OnNext(SelectedVariables.Single()); break; } }
public void BindSelectVariables() { IsBound = true; if (SelectBuilder != null) { bool hasAggregate = SelectedVariables.Any(v => v.IsAggregate); foreach (SparqlVariable v in SelectedVariables) { if (CoalescedVariables.ContainsKey(v)) { SparqlExpression defaultValue = CoalescedVariables[v]; SelectBuilder.And(e => e.Coalesce(e.Variable(v.Name), defaultValue)).As(v.Name + '_'); } else { SelectBuilder.And(v); } if (hasAggregate && !v.IsAggregate) { #if !NET35 SelectBuilder.GroupBy(v.Name); #else QueryBuilder.GroupBy(v.Name); #endif } } if (hasAggregate && !IsRoot) { #if !NET35 SelectBuilder.Distinct(); #else QueryBuilder.Distinct(); #endif } } }
public override string[] ExportData() { DataTable dtNew = DataTable.CopyForExport(); //Get the response, treatment and covariate columns by removing all other columns from the new datatable foreach (string columnName in dtNew.GetVariableNames()) { if (!Responses.Contains(columnName) && !SelectedVariables.Contains(columnName)) { dtNew.Columns.Remove(columnName); } } string[] csvArray = dtNew.GetCSVArray(); //fix any columns with illegal chars here (at the end) ArgumentFormatter argFormatter = new ArgumentFormatter(); csvArray[0] = argFormatter.ConvertIllegalCharacters(csvArray[0]); return(csvArray); }
public bool IsSelectedVariable(SparqlVariable v) { return(v != null && SelectBuilder != null && SelectedVariables.Contains(v)); }
private void toolStripMenuItemEdit_Click(object sender, EventArgs e) { _editRequested.OnNext(SelectedVariables.Single()); }
public override string[] ExportData() { DataTable dtNew = DataTable.CopyForExport(); //Get the response, treatment and covariate columns by removing all other columns from the new datatable if (!IncludeAllVariables) //ONLY if "include all variables" is not selected { foreach (string columnName in dtNew.GetVariableNames()) { if (Response != columnName && SubjectFactor != columnName && TimeFactor != columnName && (Responses == null || !Responses.Contains(columnName)) && (SelectedVariables == null || !SelectedVariables.Contains(columnName))) { dtNew.Columns.Remove(columnName); } } } string[] csvArray = dtNew.GetCSVArray(); //fix any columns with illegal chars here (at the end) ArgumentFormatter argFormatter = new ArgumentFormatter(); csvArray[0] = argFormatter.ConvertIllegalCharacters(csvArray[0]); return(csvArray); }