private async void Button_Click(object sender, RoutedEventArgs e) { // attempt to use the connection details to request and Oinfo. String connectionText = this.connectionTextBox.Text; // check that it is not empty: if (connectionText == null || connectionText.Length == 0) { // panic in some way. tell the user, i guess FlyoutBase.ShowAttachedFlyout(this.connectionTextBox); return; } else { // try to get the oInfo from the connection. if (this.oisc != null) { Debug.WriteLine("about to try to get oInfo..."); SparqlConnection conn = new SparqlConnection(connectionText); this.myConnection = conn; Debug.WriteLine("have gotten a connection"); Debug.WriteLine("about to get the oInfo from service: " + oisc.GetConfig().GetServiceUrl()); this.oInfo = await this.GetMyOInfo(conn); Debug.WriteLine("probably got the oInfo from service "); Debug.WriteLine(oInfo.ToJson().ToString()); this.LoadListView(); this.queryNodeGroup = new NodeGroup(); this.nodegroupCanvas = new NodeGroupCanvas(this.queryNodeGroup, this.NodeGroupCanvasControl); } else { // send the flyout. FlyoutBase.ShowAttachedFlyout(this.loadConnectionButton); } } }
private async void Button_Click_2(object sender, RoutedEventArgs e) { if (this.queryNodeGroup.GetNodeCount() == 0) { return; } // try to set all the URIs to returned. foreach (Node nd in this.queryNodeGroup.GetNodeList()) { nd.SetIsReturned(true); } // get a query? String query = await this.ngc.ExecuteGetConstructForInstanceManipulation(this.queryNodeGroup); Debug.WriteLine("requested query:"); Debug.WriteLine(query); // run a job: Debug.WriteLine("about to run query:"); JsonObject jOb = await ngec.ExecuteDispatchConstructForInstanceManipulationFromNodeGroupToJsonLd(this.queryNodeGroup, this.myConnection.ToJson(), null, null); JsonObject graphObj = jOb.GetNamedObject("NodeGroup"); NodeGroup returnedNg = NodeGroup.FromConstructJson(graphObj); Debug.WriteLine("Returned results Json was: "); Debug.WriteLine(jOb.ToString()); Debug.WriteLine("Some stats on the return:"); Debug.WriteLine("node group contains " + returnedNg.GetNodeCount() + " nodes."); Debug.WriteLine("up to the first five node instances found had the Id of ______________ and the Type of ______________"); int i = 0; foreach (Node nd in returnedNg.GetNodeList()) { if (i == 5) { break; } Debug.WriteLine("Id: " + nd.GetInstanceValue() + " Type: " + nd.GetFullUriName()); // increment i i++; } var style = new Style(typeof(FlyoutPresenter)); style.Setters.Add(new Setter(FlyoutPresenter.MinWidthProperty, Window.Current.CoreWindow.Bounds.Width)); fly.SetValue(Flyout.FlyoutPresenterStyleProperty, style); Flyout.ShowAttachedFlyout(this.Rect); this.resultsCanvas = new NodeGroupCanvas(returnedNg, this.NodeGroupResults); this.resultsCanvas.RenderCanvas(); planer = new NodeGroupPlaner(this.queryNodeGroup, this.resultsCanvas.QueryNodeGroup, this.oInfo); // fill in the sparqlID view List <SparqlIDViewEntry> sIds = new List <SparqlIDViewEntry>(); foreach (String s in this.planer.GetQuerySparqlIds()) { SparqlIDViewEntry sNeo = new SparqlIDViewEntry(s); sIds.Add(sNeo); } this.sparqlID_view.ItemsSource = sIds; this.PlaneTest.IsEnabled = true; }