Beispiel #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         try
         {
             //Initialising Neo4j connection
             GraphDBReader.InitNeo4JConnection("DB_URL", "Username", "Password");
             //Retrieving graph nodes
             string nodes = GraphDBReader.RetrieveNodes();
             //Retrieving graph links
             string links = GraphDBReader.RetrieveRelationships();
             //txtJson will contain the full JSON string to be read the VivaGraph JS library
             txtJson.Value = "{" + "\"nodes\":[" + nodes + "]," + "\"links\":[" + links + "]" + "}";
             //Displaying graph summary
             lblNodesCount.Text = GraphDBReader.GetNodesCount().ToString();
             lblLinksCount.Text = GraphDBReader.GetLinksCount().ToString();
             //Filling the dropdown used for search and filtering purposes
             FillDropdown();
         }
         catch
         {
             //In case that the connection to the Neo4j database fails
             ScriptManager.RegisterStartupScript(this, typeof(Page), "UpdateMsg", "alert('Connection to Neo4j database failed.\\n Please check database connection settings.');", true);
         }
     }
 }
Beispiel #2
0
        //Filtering by selecting a particular Freebase Type from the dropdown list
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string nodes = GraphDBReader.FindNode(dropdownTypes.SelectedValue);
            string links = GraphDBReader.RetrieveRelationships(dropdownTypes.SelectedValue);

            txtJson.Value      = "{" + "\"nodes\":[" + nodes + "]," + "\"links\":[" + links + "]" + "}";
            lblNodesCount.Text = GraphDBReader.GetNodesCount().ToString();
            lblLinksCount.Text = GraphDBReader.GetLinksCount().ToString();
            ScriptManager.RegisterStartupScript(this, typeof(Page), "UpdateMsg", "clearGraph();onLoad();", true);
        }
Beispiel #3
0
        //Filtering by Freebase categories checkboxes
        protected void chkb_CheckedChanged(object sender, EventArgs e)
        {
            string selectedCategories = GetSelectedCats();
            string nodes = GraphDBReader.RetrieveNodes(selectedCategories);
            string links = GraphDBReader.RetrieveRelationships();

            txtJson.Value      = "{" + "\"nodes\":[" + nodes + "]," + "\"links\":[" + links + "]" + "}";
            lblNodesCount.Text = GraphDBReader.GetNodesCount().ToString();
            lblLinksCount.Text = GraphDBReader.GetLinksCount().ToString();
            ScriptManager.RegisterStartupScript(this, typeof(Page), "UpdateMsg", "clearGraph();onLoad();", true);
        }