private void HandleNodeGroupNodeAdditions(Node nd) { // basic case where the node group is empty... if (this.queryNodeGroup.GetNodeCount() == 0) { Debug.WriteLine("Adding a single node to an empty nodeGroup. the URI was " + nd.GetFullUriName()); this.queryNodeGroup.AddOneNode(nd, null, null, null); this.nodegroupCanvas.CheckNodeAdded(); } else { // add it as needed. // get all of the fullUris for the potential targets: List <String> targetUris = new List <String>(); foreach (Node n in this.queryNodeGroup.GetNodeList()) { targetUris.Add(n.GetFullUriName()); } List <OntologyPath> availablePaths = this.oInfo.FindAllPaths(nd.GetFullUriName(), targetUris, "http://"); // build the path that captures this connection of the start class to the new one. Dictionary <String, ListViewPathAnchorEntry> precursorPaths = new Dictionary <string, ListViewPathAnchorEntry>(); // add an empty precursor path. these things are useful... ListViewPathAnchorEntry baseEntry = new ListViewPathAnchorEntry(null); precursorPaths.Add("disconnected", baseEntry); foreach (OntologyPath op in availablePaths) { String acn = op.GetAnchorClassName(); foreach (Node matchingNode in this.queryNodeGroup.GetNodeByURI(acn)) { String sId = matchingNode.GetSparqlID(); if (precursorPaths.ContainsKey(sId)) { precursorPaths[sId].AddNewPath(op); } else { ListViewPathAnchorEntry curr = new ListViewPathAnchorEntry(matchingNode); curr.AddNewPath(op); precursorPaths.Add(sId, curr); } } } // add to the listview. this.connectionPositionView.ItemsSource = precursorPaths.Values; FlyoutBase.ShowAttachedFlyout(this.ontologyBoxControl); } }
private void connectionPositionView_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (connectionPositionView.SelectedIndex == -1) { return; } else if (connectionPositionView.SelectedIndex == 0) { // we are using the disconnected base Node nodeAdded = this.queryNodeGroup.AddNode(((ListViewOntologyInfoEntry)this.oInfoView.SelectedItem).OClass.GetNameString(false), this.oInfo); this.nodegroupCanvas.CheckNodeAdded(); this.AnchorFlyout.Hide(); } else { List <OntologyPath> pathCollection = null; List <ListViewPathEntry> displayCollection = new List <ListViewPathEntry>(); ListViewPathAnchorEntry lvpae = (ListViewPathAnchorEntry)this.connectionPositionView.SelectedItem; foreach (ListViewPathAnchorEntry curr in this.connectionPositionView.Items) { // find the proper one. if (connectionPositionView.SelectedItem.Equals(curr)) { pathCollection = curr.PathList; foreach (OntologyPath pt in pathCollection) { ListViewPathEntry lvpe = new ListViewPathEntry(pt, lvpae.Anchor); displayCollection.Add(lvpe); } break; } } if (pathCollection != null) { this.connectionSelectionView.ItemsSource = displayCollection; Flyout.ShowAttachedFlyout(this.AnchorGrid); } } }