private void button_find_Click(object sender, EventArgs e) { if (Locked) { return; } if (panel_reasoner.BackColor == Color.Red) { MessageBox.Show("You can do the search only after applying the reasoner", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else if (textBox_search.Text.Count() == 0) { MessageBox.Show("Can you write a real word?", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } var query = "SELECT Distinct ?type WHERE { <" + OwlOntology.Ontology.BaseUri + "#" + textBox_search.Text + "> rdf:type ?type.}"; var queryResylt = OwlManager.RunQueryDataTable(query); DataTable dataTable = new DataTable(); dataTable.Columns.Add("Word"); dataTable.Columns.Add("Type"); foreach (var match in queryResylt.Results) { var test = getLastId(match.ToString()); if (isApproved(getLastId(match.ToString()))) { var row = dataTable.NewRow(); row["Word"] = textBox_search.Text; row["Type"] = getLastId(match.ToString()); dataTable.Rows.Add(row); } } bindingSource_result.DataSource = dataTable; dataGridView_results.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; dataGridView_results.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView_results.AutoResizeColumns(); }
private void button_runQuery_Click(object sender, EventArgs e) { if (Locked) { return; } if (panel_reasoner.BackColor == Color.Red) { MessageBox.Show("You can do the search only after applying the reasoner", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else if (textBox_search.Text.Count() == 0) { MessageBox.Show("Can you write a real word?", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { bindingSource_result.DataSource = OwlManager.RunQueryDataTable(textBox_query.Text); } }