public System.Xml.Linq.XDocument GetConceptMeshInfo(RDFTriple request) { SessionManagement sm = new SessionManagement(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; using (var db = new SqlConnection(connstr)) { SqlCommand dbcommand = new SqlCommand("[Profile.Data].[Concept.Mesh.GetDescriptorXML]", db); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); dbcommand.Parameters.Add(new SqlParameter("@NodeId", request.Subject)); db.Open(); XmlReader xreader = dbcommand.ExecuteXmlReader(); System.Xml.Linq.XDocument xDoc = null; if (xreader.Read()) { xDoc = System.Xml.Linq.XDocument.Load(xreader); } xreader.Close(); db.Close(); return(xDoc); } }
public void Initialize(XmlDocument basedata, XmlNamespaceManager namespaces, RDFTriple rdftriple) { BaseData = basedata; Namespaces = namespaces; RDFTriple = rdftriple; UploadInfoToORCID1.Initialize(basedata, namespaces, rdftriple); }
public XmlDocument GetSameDepartment(RDFTriple request) { string xmlstr = string.Empty; XmlDocument xmlrtn = new XmlDocument(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); SqlCommand dbcommand = new SqlCommand("[Profile.Module].[CustomViewPersonSameDepartment.GetList]"); SqlDataReader dbreader; dbconnection.Open(); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); dbcommand.Parameters.Add(new SqlParameter("@nodeid", request.Subject)); dbcommand.Parameters.Add(new SqlParameter("@sessionid", request.Session.SessionID)); dbcommand.Connection = dbconnection; dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection); while (dbreader.Read()) { xmlstr += dbreader[0].ToString(); } xmlrtn.LoadXml(xmlstr); if (!dbreader.IsClosed) { dbreader.Close(); } return(xmlrtn); }
public string GetNetworkCategory(RDFTriple request) { SessionManagement sm = new SessionManagement(); string xml = string.Empty; string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); SqlCommand dbcommand = new SqlCommand("[Profile.Module].[NetworkCategory.Person.HasResearchArea.GetXML]"); SqlDataReader dbreader; dbconnection.Open(); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); dbcommand.Parameters.Add(new SqlParameter("@nodeid", request.Subject)); dbcommand.Connection = dbconnection; dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection); while (dbreader.Read()) { xml += dbreader[0].ToString(); } if (!dbreader.IsClosed) { dbreader.Close(); } return(xml); }
public XmlDocument GetGroupNetworkForBrowserXML(RDFTriple request) { string xmlstr = string.Empty; XmlDocument xmlrtn = new XmlDocument(); if (Framework.Utilities.Cache.Fetch(request.Key + "GetGroupNetworkForBrowserXML") == null) { try { string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); SqlCommand dbcommand = new SqlCommand("[Profile.Module].[NetworkRadial.Group.GetCoAuthors]"); SqlDataReader dbreader; dbconnection.Open(); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); dbcommand.Parameters.Add(new SqlParameter("@nodeid", request.Subject)); dbcommand.Parameters.Add(new SqlParameter("@sessionid", request.Session.SessionID)); dbcommand.Parameters.Add(new SqlParameter("@OutputFormat", "XML")); dbcommand.Connection = dbconnection; dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection); while (dbreader.Read()) { xmlstr += dbreader[0].ToString(); } Framework.Utilities.DebugLogging.Log(xmlstr); if (!dbreader.IsClosed) { dbreader.Close(); } xmlstr = xmlstr.Replace(" id=", " lid="); xmlstr = xmlstr.Replace(" nodeid=", " id="); xmlstr = xmlstr.Replace(" id1=", " lid1="); xmlstr = xmlstr.Replace(" id2=", " lid2="); xmlstr = xmlstr.Replace(" nodeid1=", " id1="); xmlstr = xmlstr.Replace(" nodeid2=", " id2="); xmlrtn.LoadXml(xmlstr); Framework.Utilities.Cache.Set(request.Key + "GetGroupNetworkForBrowserXML", xmlrtn); } catch (Exception ex) { Framework.Utilities.DebugLogging.Log(ex.Message + " ++ " + ex.StackTrace); } } else { xmlrtn = Framework.Utilities.Cache.Fetch(request.Key + "GetGroupNetworkForBrowserXML"); } return(xmlrtn); }
public SqlDataReader GetPublications(RDFTriple request, ClassType type) { SessionManagement sm = new SessionManagement(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); SqlCommand dbcommand; if (type == ClassType.Grant) { dbcommand = new SqlCommand("[Profile.Module].[CustomViewAuthorInAuthorship.GetGroupList]"); } else { dbcommand = new SqlCommand("[Profile.Module].[CustomViewAuthorInAuthorship.GetList]"); } SqlDataReader dbreader; dbconnection.Open(); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); dbcommand.Parameters.Add(new SqlParameter("@nodeid", request.Subject)); dbcommand.Parameters.Add(new SqlParameter("@sessionid", sm.Session().SessionID)); dbcommand.Connection = dbconnection; dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection); return(dbreader); }
public VisualizationImageLink GetGoogleTimelineCOVID(RDFTriple request, string storedproc) { VisualizationImageLink vil; if (Framework.Utilities.Cache.FetchObject(request.Key + "GetGoogleTimelineCOVID" + storedproc) == null) { SessionManagement sm = new SessionManagement(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; var db = new SqlConnection(connstr); db.Open(); SqlCommand dbcommand = new SqlCommand(storedproc, db); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); // Add parameters dbcommand.Parameters.Add(new SqlParameter("@NodeId", request.Subject)); dbcommand.Parameters.Add(new SqlParameter("@GraphType", "COVID")); using (SqlDataReader reader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection)) { reader.Read(); vil = new VisualizationImageLink(reader["gc"].ToString(), reader["alt"].ToString(), reader["asText"].ToString()); Framework.Utilities.Cache.Set(request.Key + "GetGoogleTimelineCOVID" + storedproc, vil); reader.Close(); } } else { vil = (VisualizationImageLink)Framework.Utilities.Cache.FetchObject(request.Key + "GetGoogleTimelineCOVID" + storedproc); } return(vil); }
/// <summary> /// Updates the metadata of the graph with the info carried by the given triple /// </summary> internal void UpdateMetadata(RDFTriple triple) { if (triple != null){ this.CollectContainers(triple); this.CollectCollections(triple); } }
protected void Page_Load(object sender, EventArgs e) { Profiles.Profile.Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); Profiles.Framework.Utilities.RDFTriple request = new RDFTriple(Convert.ToInt32(Request.QueryString["p"])); Response.ContentType = "application/xml; charset=utf-8"; Response.Write(data.GetProfileNetworkForBrowser(request).InnerXml); }
protected void Page_Load(object sender, EventArgs e) { Profiles.Profile.Modules.CustomViewAuthorInAuthorship.DataIO data = new Profiles.Profile.Modules.CustomViewAuthorInAuthorship.DataIO(); Profiles.Framework.Utilities.RDFTriple request = new RDFTriple(Convert.ToInt32(Request.QueryString["p"])); Response.ContentType = "application/json; charset=utf-8"; Response.AppendHeader("Access-Control-Allow-Origin", "*"); Response.Write(data.GetJournalHeadingsForProfile(request)); }
protected void Page_Load(object sender, EventArgs e) { Profiles.Profile.Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); Profiles.Framework.Utilities.RDFTriple request = new RDFTriple(Convert.ToInt32(Request.QueryString["p"])); Response.ContentType = "application/json; charset=utf-8"; Response.AppendHeader("Access-Control-Allow-Origin", "*"); Response.Write(data.GetProfileNetworkForBrowser(request)); }
public XmlDocument GetPresentationData(RDFTriple request) { string xmlstr = string.Empty; XmlDocument xmlrtn = new XmlDocument(); try { xmlrtn = new XmlDocument(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); SqlCommand dbcommand = new SqlCommand("[rdf.].[GetPresentationXML]"); SqlDataReader dbreader; dbconnection.Open(); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); dbcommand.Parameters.Add(new SqlParameter("@subject", request.Subject)); if (request.Predicate > 0) { dbcommand.Parameters.Add(new SqlParameter("@predicate", request.Predicate)); } if (request.Object > 0) { dbcommand.Parameters.Add(new SqlParameter("@object", request.Object)); } dbcommand.Parameters.Add(new SqlParameter("@EditMode", request.Edit ? 1 : 0)); dbcommand.Parameters.Add(new SqlParameter("@sessionid", request.Session.SessionID)); dbcommand.Connection = dbconnection; dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection); while (dbreader.Read()) { xmlstr += dbreader[0].ToString(); } xmlrtn.LoadXml(xmlstr); xmlstr = string.Empty; if (!dbreader.IsClosed) { dbreader.Close(); } } catch (Exception ex) { } return(xmlrtn); }
public RDFSharpBenchmark() { this.monaLisa = new RDFResource("http://www.wikidata.org/entity/Q12418"); this.creator = new RDFResource("http://purl.org/dc/terms/creator"); this.title = new RDFResource("http://purl.org/dc/terms/title"); this.leonardoDaVinci = new RDFResource("http://dbpedia.org/resource/Leonardo_da_Vinci"); FileStream fs = File.OpenRead(@"../../../../../../..//TestData/szepmuveszeti.n3"); this.museumGraph = RDFGraph.FromStream(RDFModelEnums.RDFFormats.Turtle, fs); this.monaLisaCreator = new RDFTriple(this.monaLisa, this.creator, this.leonardoDaVinci); this.monaLisaTitle = new RDFPlainLiteral("Mona Lisa"); }
public string GetNetworkCoauthorList(RDFTriple request) { string str = string.Empty; if (Framework.Utilities.Cache.FetchObject(request.Key + "GetNetworkCoauthorList") == null) { try { string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); SqlCommand dbcommand = new SqlCommand("[Profile.Module].[NetworkCoauthorList.GetCoauthors]"); SqlDataReader dbreader; dbconnection.Open(); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); dbcommand.Parameters.Add(new SqlParameter("@nodeid", request.Subject)); //dbcommand.Parameters.Add(new SqlParameter("@sessionid", request.Session.SessionID)); dbcommand.Connection = dbconnection; dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection); str = "<table class=\"NetworkList\" ><tbody><tr><td style=\"padding - right:25px; width: 320px\"><ul style=\"columns: 2; -webkit-columns: 2; -moz-columns: 2; list - style - type:disc\">"; while (dbreader.Read()) { str += "<li><a href=\"" + dbreader[1].ToString() + "\">" + dbreader[0].ToString() + "</a></li>"; } str = str + "</ul></td></tr></tbody></table>"; Framework.Utilities.DebugLogging.Log(str); if (!dbreader.IsClosed) { dbreader.Close(); } Framework.Utilities.Cache.Set(request.Key + "GetNetworkCoauthorList", str); } catch (Exception ex) { Framework.Utilities.DebugLogging.Log(ex.Message + " ++ " + ex.StackTrace); } } else { str = (string)Framework.Utilities.Cache.FetchObject(request.Key + "GetNetworkCoauthorList"); } return(str); }
/// <summary> /// Adds the given triple to the SPOL index /// </summary> internal RDFGraphIndex AddIndex(RDFTriple triple) { if (triple != null) { //Subject if (!this.Subjects.ContainsKey(triple.Subject.PatternMemberID)) { this.Subjects.Add(triple.Subject.PatternMemberID, new Dictionary<Int64, Object>() { {triple.TripleID, null} }); } else { if (!this.Subjects[triple.Subject.PatternMemberID].ContainsKey(triple.TripleID)) { this.Subjects[triple.Subject.PatternMemberID].Add(triple.TripleID, null); } } //Predicate if (!this.Predicates.ContainsKey(triple.Predicate.PatternMemberID)) { this.Predicates.Add(triple.Predicate.PatternMemberID, new Dictionary<Int64, Object>() { {triple.TripleID, null} }); } else { if (!this.Predicates[triple.Predicate.PatternMemberID].ContainsKey(triple.TripleID)) { this.Predicates[triple.Predicate.PatternMemberID].Add(triple.TripleID, null); } } //Object if (triple.TripleFlavor == RDFModelEnums.RDFTripleFlavors.SPO) { if (!this.Objects.ContainsKey(triple.Object.PatternMemberID)) { this.Objects.Add(triple.Object.PatternMemberID, new Dictionary<Int64, Object>() { {triple.TripleID, null} }); } else { if (!this.Objects[triple.Object.PatternMemberID].ContainsKey(triple.TripleID)) { this.Objects[triple.Object.PatternMemberID].Add(triple.TripleID, null); } } } //Literal else { if (!this.Literals.ContainsKey(triple.Object.PatternMemberID)) { this.Literals.Add(triple.Object.PatternMemberID, new Dictionary<Int64, Object>() { {triple.TripleID, null} }); } else { if (!this.Literals[triple.Object.PatternMemberID].ContainsKey(triple.TripleID)) { this.Literals[triple.Object.PatternMemberID].Add(triple.TripleID, null); } } } } return this; }
public string GetGroupNetworkForBrowser(RDFTriple request) { string str = string.Empty; if (Framework.Utilities.Cache.FetchObject(request.Key + "GetGroupNetworkForBrowser") == null) { try { string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); SqlCommand dbcommand = new SqlCommand("[Profile.Module].[NetworkRadial.Group.GetCoAuthors]"); SqlDataReader dbreader; dbconnection.Open(); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); dbcommand.Parameters.Add(new SqlParameter("@nodeid", request.Subject)); dbcommand.Parameters.Add(new SqlParameter("@sessionid", request.Session.SessionID)); dbcommand.Connection = dbconnection; dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection); while (dbreader.Read()) { str += dbreader[0].ToString(); } Framework.Utilities.DebugLogging.Log(str); if (!dbreader.IsClosed) { dbreader.Close(); } Framework.Utilities.Cache.Set(request.Key + "GetProfileNetworkForBrowser", str); } catch (Exception ex) { Framework.Utilities.DebugLogging.Log(ex.Message + " ++ " + ex.StackTrace); } } else { str = (string)Framework.Utilities.Cache.FetchObject(request.Key + "GetGroupNetworkForBrowser"); } return(str); }
public void Initialize() { RDFTriple = new RDFTriple(Convert.ToInt64(sm.Session().NodeID.ToString())); RDFTriple.Expand = true; RDFTriple.ShowDetails = true; LoadPresentationXML(); LoadRDFData(); masterpage.RDFData = RDFData; masterpage.RDFNamespaces = RDFNamespaces; masterpage.PresentationXML = PresentationXML; this.LoadAssets(); masterpage.PresentationXML = this.PresentationXML; }
public SqlDataReader GetConceptTopJournal(RDFTriple request) { SessionManagement sm = new SessionManagement(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; var db = new SqlConnection(connstr); db.Open(); SqlCommand dbcommand = new SqlCommand("[Profile.Data].[Concept.Mesh.GetJournals]", db); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); // Add parameters dbcommand.Parameters.Add(new SqlParameter("@NodeId", request.Subject)); // Return reader return(dbcommand.ExecuteReader(CommandBehavior.CloseConnection)); }
public SqlDataReader GetProfileConnection(RDFTriple request, string storedproc) { SessionManagement sm = new SessionManagement(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; var db = new SqlConnection(connstr); db.Open(); SqlCommand dbcommand = new SqlCommand(storedproc, db); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); // Add parameters dbcommand.Parameters.Add(new SqlParameter("@subject", request.Subject)); dbcommand.Parameters.Add(new SqlParameter("@object", request.Object)); // Return reader return(dbcommand.ExecuteReader(CommandBehavior.CloseConnection)); }
public void DrawProfilesCloud() { XmlDocument document = new XmlDocument(); string xml = string.Empty; Profiles.Profile.Utilities.DataIO pdata = new Profiles.Profile.Utilities.DataIO(); RDFTriple request = new RDFTriple(Convert.ToInt64(Request.QueryString["subject"])); document.LoadXml(pdata.GetNetworkCloud(request).ToString().Replace("&", "&")); XslCompiledTransform xslt = new XslCompiledTransform(); XsltArgumentList args = new XsltArgumentList(); args.AddParam("root", "", Root.Domain); litListView.Text = XslHelper.TransformInMemory(Server.MapPath("~/Profile/Modules/NetworkList/NetworkList.xslt"), args, document.OuterXml); }
public SqlDataReader GetPublicationSupportHtml(RDFTriple request, bool editMode) { SessionManagement sm = new SessionManagement(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; var db = new SqlConnection(connstr); db.Open(); SqlCommand dbcommand = new SqlCommand("[Profile.Module].[Support.GetHTML]", db); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); // Add parameters dbcommand.Parameters.Add(new SqlParameter("@NodeId", request.Subject)); dbcommand.Parameters.Add(new SqlParameter("@EditMode", (editMode) ? 1 : 0)); // Return reader return(dbcommand.ExecuteReader(CommandBehavior.CloseConnection)); }
public void DrawProfilesModule() { XmlDocument document = new XmlDocument(); string xml = string.Empty; Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); RDFTriple request = new RDFTriple(Convert.ToInt64(Request.QueryString["subject"])); document.LoadXml(data.GetNetworkCategory(request).ToString()); XslCompiledTransform xslt = new XslCompiledTransform(); XsltArgumentList args = new XsltArgumentList(); args.AddParam("root", "", Root.Domain); litCategoryList.Text = Framework.Utilities.XslHelper.TransformInMemory(Server.MapPath("~/Profile/modules/NetworkCategories/NetworkCategories.xslt"), args, document.OuterXml); }
public DataView GetNetworkTimeline(RDFTriple request, string storedproc) { SessionManagement sm = new SessionManagement(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlDataAdapter dataAdapter = null; DataSet dataSet = null; DataView dataView = null; var db = new SqlConnection(connstr); dataAdapter = new SqlDataAdapter(storedproc + " " + request.Subject, db); dataSet = new DataSet(); dataAdapter.Fill(dataSet); dataView = new DataView(dataSet.Tables[0]); db.Close(); return(dataView); }
/// <summary> /// Collects the namespaces used by the given triple /// </summary> private void CollectNamespaces(RDFTriple triple) { RDFNamespaceRegister.Instance.Value.Register.ForEach(ns => { String nSpace = ns.ToString(); //Resolve subj Uri String subj = triple.Subject.ToString(); if (subj.Contains(nSpace) || subj.StartsWith(ns.Prefix + ":")) { if (!this.Namespaces.Contains(ns)) { this.Namespaces.Add(ns); } } //Resolve pred Uri String pred = triple.Predicate.ToString(); if (pred.Contains(nSpace) || pred.StartsWith(ns.Prefix + ":")) { if (!this.Namespaces.Contains(ns)) { this.Namespaces.Add(ns); } } //Resolve object Uri if (triple.TripleFlavor == RDFModelEnums.RDFTripleFlavors.SPO) { String obj = triple.Object.ToString(); if (obj.Contains(nSpace) || obj.StartsWith(ns.Prefix + ":")) { if (!this.Namespaces.Contains(ns)) { this.Namespaces.Add(ns); } } } else { //Resolve typed literal Uri if (triple.Object is RDFTypedLiteral) { String tLit = ((RDFTypedLiteral)triple.Object).Datatype.ToString(); if (tLit.Contains(nSpace) || tLit.StartsWith(ns.Prefix + ":")) { if (!this.Namespaces.Contains(ns)) { this.Namespaces.Add(ns); } } } } }); }
public static RDFGraph WaltDisneyGraphBuild() { RDFResource donaldduck = new RDFResource("http://www.waltdisney.com/donald_duck"); RDFPlainLiteral donaldduck_name = new RDFPlainLiteral("Donald Duck"); //create typed literal // "85"^^xsd:integer RDFTypedLiteral mickeymouse_age = new RDFTypedLiteral("85", RDFModelEnums.RDFDatatypes.XSD_INTEGER); RDFTypedLiteral donaldduck_age = new RDFTypedLiteral("85", RDFModelEnums.RDFDatatypes.XSD_INTEGER); //create triples // "Mickey Mouse is 85 years old" RDFTriple mickeymouse_is85yr = new RDFTriple(new RDFResource("http://www.waltdisney.com/mickey_mouse"), RDFVocabulary.FOAF.AGE, mickeymouse_age); // "Donald Duck has English-US name "Donald Duck"" RDFTriple donaldduck_name_enus_triple = new RDFTriple(donaldduck, RDFVocabulary.FOAF.NAME, donaldduck_name); // "Donald Duck is 85 years old" RDFTriple donaldduck_is85yr = new RDFTriple(donaldduck, RDFVocabulary.FOAF.AGE, donaldduck_age); List <RDFTriple> triples = new List <RDFTriple> { mickeymouse_is85yr, donaldduck_name_enus_triple, donaldduck_is85yr }; RDFGraph waltdisney = new RDFGraph(triples); waltdisney.SetContext(new Uri("http://waltdisney.com/")); return(waltdisney); }
private void WorkingWithRdfModels() { // CREATE RESOURCE var donaldduck = new RDFResource("http://www.waltdisney.com/donald_duck"); // CREATE BLANK RESOURCE var disney_group = new RDFResource(); // CREATE PLAIN LITERAL // "Donald Duck" var donaldduck_name = new RDFPlainLiteral("Donald Duck"); // CREATE PLAIN LITERAL WITH LANGUAGE TAG // "Donald Duck"@en-US var donaldduck_name_enusLiteral = new RDFPlainLiteral("Donald Duck", "en-US"); // CREATE TYPED LITERAL // "85"^^xsd:integer var mickeymouse_age = new RDFTypedLiteral("85", RDFModelEnums.RDFDatatypes.XSD_INTEGER); // CREATE TRIPLES // "Mickey Mouse is 85 years old" RDFTriple mickeymouse_is85yr = new RDFTriple( new RDFResource("http://www.waltdisney.com/mickey_mouse"), new RDFResource("http://xmlns.com/foaf/0.1/age"), new RDFTypedLiteral("85", RDFModelEnums.RDFDatatypes.XSD_INTEGER)); // "Donald Duck has english (US) name "Donald Duck"" RDFTriple donaldduck_name_enus = new RDFTriple( new RDFResource("http://www.waltdisney.com/donald_duck"), new RDFResource("http://xmlns.com/foaf/0.1/name"), new RDFPlainLiteral("Donald Duck", "en-US")); // CREATE EMPTY GRAPH var another_graph = new RDFGraph(); var waltdisney_filled = new RDFGraph(); // CREATE GRAPH FROM A LIST OF TRIPLES var triples = new List <RDFTriple> { mickeymouse_is85yr, donaldduck_name_enus }; var waltdisney = new RDFGraph(triples); // SET CONTEXT OF A GRAPH waltdisney.SetContext(new Uri("http://waltdisney.com/")); // GET A DATATABLE FROM A GRAPH var waltdisney_table = waltdisney.ToDataTable(); // GET A GRAPH FROM A DATATABLE var waltdisney_newgraph = RDFGraph.FromDataTable(waltdisney_table); // ITERATE TRIPLES OF A GRAPH WITH FOREACH foreach (var t in waltdisney) { Console.WriteLine("Triple: " + t); Console.WriteLine(" Subject: " + t.Subject); Console.WriteLine(" Predicate: " + t.Predicate); Console.WriteLine(" Object: " + t.Object); } // ITERATE TRIPLES OF A GRAPH WITH ENUMERATOR var triplesEnum = waltdisney.TriplesEnumerator; while (triplesEnum.MoveNext()) { Console.WriteLine("Triple: " + triplesEnum.Current); Console.WriteLine(" Subject: " + triplesEnum.Current.Subject); Console.WriteLine(" Predicate: " + triplesEnum.Current.Predicate); Console.WriteLine(" Object: " + triplesEnum.Current.Object); } // GET COUNT OF TRIPLES CONTAINED IN A GRAPH var triplesCount = waltdisney.TriplesCount; // MULTIPLE SELECTIONS var multiple_selections_graph = waltdisney.SelectTriplesBySubject(new RDFResource("http://www.waltdisney.com/donald_duck")) .SelectTriplesByPredicate(new RDFResource("http://xmlns.com/foaf/0.1/name")); // SET OPERATIONS var set_operations_graph = waltdisney.IntersectWith(waltdisney_filled).UnionWith(another_graph); /* * var ntriplesFormat = RDFModelEnums.RDFFormats.NTriples; * // READ N-TRIPLES FILE * var graph = RDFGraph.FromFile(ntriplesFormat, "C:\\file.nt"); * // READ N-TRIPLES STREAM * var graph = RDFGraph.FromStream(ntriplesFormat, inStream); * // WRITE N-TRIPLES FILE * graph.ToFile(ntriplesFormat, "C:\\newfile.nt"); * // WRITE N-TRIPLES STREAM * graph.ToStream(ntriplesFormat, outStream); */ /* * var turtleFormat = RDFModelEnums.RDFFormats.Turtle; * // READ TURTLE FILE * var graph = RDFGraph.FromFile(turtleFormat, "C:\\file.ttl"); * // READ TURTLE STREAM * var graph = RDFGraph.FromStream(turtleFormat, inStream); * // WRITE TURTLE FILE * graph.ToFile(turtleFormat, "C:\\newfile.ttl"); * // WRITE TURTLE STREAM * graph.ToStream(turtleFormat, outStream); */ /* * var xmlFormat = RDFModelEnums.RDFFormats.RdfXml; * // READ RDF/XML FILE * var graph = RDFGraph.FromFile(xmlFormat, "C:\\file.rdf"); * // READ RDF/XML STREAM * var graph = RDFGraph.FromStream(xmlFormat, inStream); * // WRITE RDF/XML FILE * graph.ToFile(xmlFormat, "C:\\newfile.rdf"); * // WRITE RDF/XML STREAM * graph.ToStream(xmlFormat, outStream); */ // CREATE NAMESPACE var waltdisney_ns = new RDFNamespace("wd", "http://www.waltdisney.com/"); // USE NAMESPACE IN RESOURCE CREATION var duckburg = new RDFResource(waltdisney_ns + "duckburg"); var mouseton = new RDFResource(waltdisney_ns + "mouseton"); RDFNamespaceRegister.AddNamespace(waltdisney_ns); // Retrieves a namespace by seeking presence of its prefix (null if not found). Supports prefix.cc var ns1 = RDFNamespaceRegister.GetByPrefix("dbpedia", false); //local search var ns2 = RDFNamespaceRegister.GetByPrefix("dbpedia", true); //search prefix.cc service if no result // GET DEFAULT NAMESPACE var nSpace = RDFNamespaceRegister.DefaultNamespace; // SET DEFAULT NAMESPACE RDFNamespaceRegister.SetDefaultNamespace(waltdisney_ns); //new graphs will default to this context // ITERATE NAMESPACES OF REGISTER WITH FOREACH foreach (var ns in RDFNamespaceRegister.Instance) { Console.WriteLine("Prefix: " + ns.NamespacePrefix); Console.WriteLine("Namespace: " + ns.NamespaceUri); } // ITERATE NAMESPACES OF REGISTER WITH ENUMERATOR var nspacesEnum = RDFNamespaceRegister.NamespacesEnumerator; while (nspacesEnum.MoveNext()) { Console.WriteLine("Prefix: " + nspacesEnum.Current.NamespacePrefix); Console.WriteLine("Namespace: " + nspacesEnum.Current.NamespaceUri); } // CREATE TRIPLES WITH VOCABULARY FACILITIES // "Goofy Goof is 82 years old" RDFTriple goofygoof_is82yr = new RDFTriple( new RDFResource(new Uri("http://www.waltdisney.com/goofy_goof").ToString()), RDFVocabulary.FOAF.AGE, new RDFPlainLiteral("82") ); // "Donald Duck knows Goofy Goof" RDFTriple donaldduck_knows_goofygoof = new RDFTriple( new RDFResource(new Uri("http://www.waltdisney.com/donald_duck").ToString()), RDFVocabulary.FOAF.KNOWS, new RDFResource(new Uri("http://www.waltdisney.com/goofy_goof").ToString()) ); // CREATE TYPED LITERALS var myAge = new RDFTypedLiteral("34", RDFModelEnums.RDFDatatypes.XSD_INT); var myDate = new RDFTypedLiteral("2017-01-07", RDFModelEnums.RDFDatatypes.XSD_DATE); var myDateTime = new RDFTypedLiteral("2017-01-07T23:11:05", RDFModelEnums.RDFDatatypes.XSD_DATETIME); var myXml = new RDFTypedLiteral("<book>title</book>", RDFModelEnums.RDFDatatypes.RDF_XMLLITERAL); var myLiteral = new RDFTypedLiteral("generic literal", RDFModelEnums.RDFDatatypes.RDFS_LITERAL); /* * The given list of items may be incomplete. * A container is semantically opened to the possibility of having further elements * * Alt: unordered semantic, duplicates not allowed; * Bag: unordered semantic, duplicates allowed; * Seq: ordered semantic, duplicates allowed; */ // CREATE CONTAINER AND ADD ITEMS RDFContainer beatles_cont = new RDFContainer(RDFModelEnums.RDFContainerTypes.Bag, RDFModelEnums.RDFItemTypes.Resource); beatles_cont.AddItem(new RDFResource("http://beatles.com/ringo_starr")); beatles_cont.AddItem(new RDFResource("http://beatles.com/john_lennon")); beatles_cont.AddItem(new RDFResource("http://beatles.com/paul_mc_cartney")); beatles_cont.AddItem(new RDFResource("http://beatles.com/george_harrison")); /* * The given list of items may not be incomplete. * A collection is semantically closed to the possibility of having further elements */ // CREATE COLLECTION AND ADD ITEMS RDFCollection beatles_coll = new RDFCollection(RDFModelEnums.RDFItemTypes.Resource); beatles_coll.AddItem(new RDFResource("http://beatles.com/ringo_starr")); beatles_coll.AddItem(new RDFResource("http://beatles.com/john_lennon")); beatles_coll.AddItem(new RDFResource("http://beatles.com/paul_mc_cartney")); beatles_coll.AddItem(new RDFResource("http://beatles.com/george_harrison")); // ADD CONTAINER/COLLECTION TO GRAPH waltdisney.AddContainer(beatles_cont); waltdisney.AddCollection(beatles_coll); // REIFY TRIPLE AND MERGE IT INTO A GRAPH RDFGraph reifGraph = goofygoof_is82yr.ReifyTriple(); waltdisney = waltdisney.UnionWith(reifGraph); // ASSERT SOMETHING ABOUT REIFIED TRIPLE waltdisney.AddTriple(new RDFTriple( new RDFResource("http://www.wikipedia.com/"), new RDFResource("http://example.org/verb_state"), goofygoof_is82yr.ReificationSubject )); var existingGraph = new RDFGraph(); // REIFY CONTAINER existingGraph.AddContainer(beatles_cont); existingGraph.AddTriple(new RDFTriple( new RDFResource("http://www.thebeatles.com/"), RDFVocabulary.FOAF.GROUP, beatles_cont.ReificationSubject )); // REIFY COLLECTION existingGraph.AddCollection(beatles_coll); existingGraph.AddTriple(new RDFTriple( new RDFResource("http://www.thebeatles.com/"), RDFVocabulary.FOAF.GROUP, beatles_coll.ReificationSubject )); // WORKING WITH RDF STORES // CREATE CONTEXT FROM STRING var wdisney_ctx = new RDFContext("http://www.waltdisney.com/"); // CREATE CONTEXT FROM URI var wdisney_ctx_uri = new RDFContext(new Uri("http://www.waltdisney.com/")); // CREATE DEFAULT CONTEXT (DEFAULT NAMESPACE) var wdisney_ctx_default = new RDFContext(); // CREATE QUADRUPLES // "From Wikipedia.com: Mickey Mouse is 85 years old" RDFQuadruple wk_mickeymouse_is85yr = new RDFQuadruple( new RDFContext("http://www.wikipedia.com/"), new RDFResource("http://www.waltdisney.com/mickey_mouse"), RDFVocabulary.FOAF.AGE, new RDFTypedLiteral("85", RDFModelEnums.RDFDatatypes.XSD_INTEGER) ); // "From WaltDisney.com: Mickey Mouse is 85 years old" RDFQuadruple wd_mickeymouse_is85yr = new RDFQuadruple( new RDFContext("http://www.waltdisney.com/"), new RDFResource("http://www.waltdisney.com/mickey_mouse"), RDFVocabulary.FOAF.AGE, new RDFTypedLiteral("85", RDFModelEnums.RDFDatatypes.XSD_INTEGER) ); // "From Wikipedia.com: Donald Duck has english name "Donald Duck"" RDFQuadruple wk_donald_duck_name_enus = new RDFQuadruple( new RDFContext("http://www.wikipedia.com/"), new RDFResource("http://www.waltdisney.com/donald_duck"), RDFVocabulary.FOAF.NAME, new RDFPlainLiteral("Donald Duck", "en") ); // CREATE EMPTY MEMORY STORE var wdStore = new RDFMemoryStore(); // CREATE MEMORY STORE FROM A LIST OF QUADRUPLES var quadruples = new List <RDFQuadruple> { wk_mickeymouse_is85yr, wk_mickeymouse_is85yr }; var wdStoreFilled = new RDFMemoryStore(); foreach (var q in quadruples) { wdStoreFilled.AddQuadruple(q); } // GET A DATATABLE FROM A MEMORY STORE (any kind of store can be exported to datatable) var wdStore_table = wdStoreFilled.ToDataTable(); // GET A MEMORY STORE FROM A DATATABLE var wdStore_new = RDFMemoryStore.FromDataTable(wdStore_table); // ITERATE QUADRUPLES OF A MEMORY STORE WITH FOREACH foreach (var q in wdStore) { Console.WriteLine("Quadruple: " + q); Console.WriteLine(" Context: " + q.Context); Console.WriteLine(" Subject: " + q.Subject); Console.WriteLine(" Predicate: " + q.Predicate); Console.WriteLine(" Object: " + q.Object); } // ITERATE QUADRUPLES OF A MEMORY STORE WITH ENUMERATOR var quadruplesEnum = wdStore.QuadruplesEnumerator; while (quadruplesEnum.MoveNext()) { Console.WriteLine("Quadruple: " + quadruplesEnum.Current); Console.WriteLine(" Context: " + quadruplesEnum.Current.Context); Console.WriteLine(" Subject: " + quadruplesEnum.Current.Subject); Console.WriteLine(" Predicate: " + quadruplesEnum.Current.Predicate); Console.WriteLine(" Object: " + quadruplesEnum.Current.Object); } var nquadsFormat = RDFStoreEnums.RDFFormats.NQuads; // READ N-QUADS FILE //var myStore = RDFMemoryStore.FromFile(nquadsFormat, "C:\\file.nq"); // READ N-QUADS STREAM //var myStore = RDFMemoryStore.FromStream(nquadsFormat, inStream); // WRITE N-QUADS FILE wdStoreFilled.ToFile(nquadsFormat, @"C:\TEMP\newfile.nq"); // WRITE N-QUADS STREAM //myStore.ToStream(nquadsFormat, outStream); var trixFormat = RDFStoreEnums.RDFFormats.TriX; // READ TRIX FILE //var memStore = RDFMemoryStore.FromFile(trixFormat, "C:\\file.trix"); // READ TRIX STREAM //var memStore = RDFMemoryStore.FromStream(trixFormat, inStream); // WRITE TRIX FILE wdStoreFilled.ToFile(trixFormat, @"C:\TEMP\newfile.trix"); // WRITE TRIX STREAM //myStore.ToStream(trixFormat, outStream); // CONNECT TO SQLSERVER STORE WITH CONNECTION STRING //var sqlServer = new RDFSQLServerStore(sqlServerConnectionString); // CREATE EMPTY FEDERATION var fed = new RDFFederation(); /* * // CREATE FEDERATION FROM A LIST OF STORES * var stores = new List<RDFStore>{ waltDisneyStore, waltDisneyStoreFilled }; * var fedFilled = new RDFFederation(); * foreach(var store in stores) * { * fedFilled.AddStore(store); * } */ // ITERATE STORES OF A FEDERATION foreach (var s in fed) { Console.WriteLine("Store: " + s); Console.WriteLine(" Type: " + s.StoreType); } }
protected void InitAssets() { System.Web.UI.HtmlControls.HtmlLink NetworkBrowsercss = new System.Web.UI.HtmlControls.HtmlLink(); NetworkBrowsercss.Href = Root.Domain + "/Profile/CSS/NetworkBrowser.css"; NetworkBrowsercss.Attributes["rel"] = "stylesheet"; NetworkBrowsercss.Attributes["type"] = "text/css"; NetworkBrowsercss.Attributes["media"] = "all"; Page.Header.Controls.Add(NetworkBrowsercss); HtmlGenericControl jsscript0 = new HtmlGenericControl("script"); jsscript0.Attributes.Add("type", "text/javascript"); jsscript0.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkRadial/JavaScript/watchdog.js"); Page.Header.Controls.Add(jsscript0); HtmlGenericControl jsscript1 = new HtmlGenericControl("script"); jsscript1.Attributes.Add("type", "text/javascript"); jsscript1.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkCluster/scriptaculous/lib/prototype.js"); Page.Header.Controls.Add(jsscript1); HtmlGenericControl jsscript2 = new HtmlGenericControl("script"); jsscript2.Attributes.Add("type", "text/javascript"); jsscript2.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkCluster/scriptaculous/src/scriptaculous.js"); Page.Header.Controls.Add(jsscript2); HtmlGenericControl jsscript3 = new HtmlGenericControl("script"); jsscript3.Attributes.Add("type", "text/javascript"); jsscript3.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkClusterGroup/JavaScript/networkBrowserClass.js"); Page.Header.Controls.Add(jsscript3); HtmlGenericControl jsscript4 = new HtmlGenericControl("script"); jsscript4.Attributes.Add("type", "text/javascript"); jsscript4.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkClusterGroup/JavaScript/networkClusterLayoutEngine.js"); Page.Header.Controls.Add(jsscript4); HtmlGenericControl jsscript5 = new HtmlGenericControl("script"); jsscript5.Attributes.Add("type", "text/javascript"); jsscript5.Attributes.Add("src", "//cdnjs.cloudflare.com/ajax/libs/d3/3.4.13/d3.min.js"); Page.Header.Controls.Add(jsscript5); HtmlGenericControl script = new HtmlGenericControl("script"); script.Attributes.Add("type", "text/javascript"); script.InnerHtml = "function loadClusterView() {" + " network_browser.Init('" + Root.Domain + "/profile/modules/NetworkClusterGroup/NetworkClusterGroupSvc.aspx?p='); " + " network_browser.loadNetwork('" + Request.QueryString["Subject"].ToString() + "'); " + "};"; Page.Header.Controls.Add(script); Profiles.Profile.Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); RDFTriple request = new RDFTriple(Convert.ToInt64(Request.QueryString["subject"])); XmlDocument x = data.GetGroupNetworkForBrowserXML(request); System.Xml.Xsl.XsltArgumentList args = new System.Xml.Xsl.XsltArgumentList(); args.AddParam("root", "", Root.Domain); DateTime d = DateTime.Now; System.Xml.Xsl.XslCompiledTransform xslt = new System.Xml.Xsl.XslCompiledTransform(); litNetworkText.Text = Profiles.Framework.Utilities.XslHelper.TransformInMemory(Server.MapPath("~/profile/XSLT/NetworkTableGroup.xslt"), args, x.InnerXml); }
public void Initialize(XmlDocument basedata, XmlNamespaceManager namespaces, RDFTriple rdftriple) { BaseData = basedata; Namespaces = namespaces; RDFTriple = rdftriple; }
// add smart caching of all of these ID lookups! protected void Page_Load(object sender, EventArgs e) { string PersonId = Request["Person"]; string EmployeeID = Request["EmployeeID"]; string FNO = Request["FNO"]; string Subject = Request["Subject"]; string PrettyURL = Request["PrettyURL"]; string Expand = Request["Expand"]; string ShowDetails = Request["ShowDetails"]; string callback = Request["callback"]; Int64 nodeid = -1; if (Subject != null) { nodeid = Convert.ToInt64(Subject); } else if (PrettyURL != null) { nodeid = Framework.Utilities.UCSFIDSet.ByPrettyURL[PrettyURL.ToLower()].NodeId; } else { Profiles.CustomAPI.Utilities.DataIO data = new Profiles.CustomAPI.Utilities.DataIO(); int personid = -1; if (PersonId != null) { personid = Convert.ToInt32(PersonId); } else if (FNO != null) { personid = (int)Profiles.Framework.Utilities.UCSFIDSet.ByFNO[FNO.ToLower()].PersonId; } else if (EmployeeID != null) { personid = (int)Profiles.Framework.Utilities.UCSFIDSet.ByEmployeeID[EmployeeID].PersonId; } nodeid = Framework.Utilities.UCSFIDSet.ByPersonId[personid].NodeId; } RDFTriple request = new RDFTriple(nodeid); //The system default is True and True for showdetails and expand, but if its an external page call to this page, //then its set to false for expand. if (Expand != null) { request.Expand = Convert.ToBoolean(Expand); } else { request.Expand = false; } if (ShowDetails != null) { request.ShowDetails = Convert.ToBoolean(ShowDetails); } else { request.ShowDetails = false; } Response.Clear(); Response.Charset = "charset=UTF-8"; Response.StatusCode = Convert.ToInt16("200"); if ("JSON-LD".Equals(Request["Format"])) { string URL = ConfigurationManager.AppSettings["OpenSocial.ShindigURL"] + "/rest/rdf?userId=" + HttpUtility.UrlEncode(Root.Domain + "/CustomAPI/v2/Default.aspx?Subject=" + nodeid + "&Expand=" + request.Expand + "&ShowDetails=" + request.ShowDetails); WebClient client = new WebClient(); String jsonProfiles = client.DownloadString(URL); if (callback != null && callback.Length > 0) { Response.ContentType = "application/javascript"; Response.Write(callback + "(" + jsonProfiles + ");"); } else { Response.ContentType = "application/json"; Response.Write(jsonProfiles); } } else { Response.ContentType = "text/xml";//"application/rdf+xml"; Response.Write(new Profiles.Profile.Utilities.DataIO().GetRDFData(request).InnerXml); } }
/// <summary> /// Verifies if the given triple carries a container subj and, if so, collects it /// </summary> private void CollectContainers(RDFTriple triple) { if (triple != null && triple.TripleFlavor == RDFModelEnums.RDFTripleFlavors.SPO) { //SUBJECT -> rdf:type -> rdf:[Bag|Seq|Alt] if (triple.Predicate.Equals(RDFVocabulary.RDF.TYPE)) { //rdf:Bag if (triple.Object.Equals(RDFVocabulary.RDF.BAG)) { if (!this.Containers.ContainsKey((RDFResource)triple.Subject)) { this.Containers.Add((RDFResource)triple.Subject, RDFModelEnums.RDFContainerTypes.Bag); } } //rdf:Seq else if (triple.Object.Equals(RDFVocabulary.RDF.SEQ)) { if (!this.Containers.ContainsKey((RDFResource)triple.Subject)) { this.Containers.Add((RDFResource)triple.Subject, RDFModelEnums.RDFContainerTypes.Seq); } } //rdf:Alt else if (triple.Object.Equals(RDFVocabulary.RDF.ALT)) { if (!this.Containers.ContainsKey((RDFResource)triple.Subject)) { this.Containers.Add((RDFResource)triple.Subject, RDFModelEnums.RDFContainerTypes.Alt); } } } } }
public void CreateRDFTripleWithRDFLiteral() { RDFTriple monaLisaCreator = new RDFTriple(this.monaLisa, this.title, this.monaLisaTitle); }
public void CreateRDFTriple() { RDFTriple monaLisaCreator = new RDFTriple(this.monaLisa, this.creator, this.leonardoDaVinci); }
public void DrawProfilesModule() { Profiles.Profile.Modules.NetworkDetails.DataIO data = new Profiles.Profile.Modules.NetworkDetails.DataIO(); string baseuri = Root.Domain + "/profile/"; if (Request.QueryString["Subject"] == null || Request.QueryString["Predicate"] == null) { return; } Int64 subject = Convert.ToInt64(Request.QueryString["Subject"]); Int64 predicate = Convert.ToInt64(Request.QueryString["Predicate"]); RDFTriple request = new RDFTriple(subject, predicate); string str = ""; if (Framework.Utilities.Cache.FetchObject(request.Key + "NetworkDetailsTableData") == null) { List <Profiles.Profile.Modules.NetworkDetails.DataIO.NetworkDetailsRow> rows = data.GetPersonConceptDetails(subject); int position = 0; /* * foreach (Profiles.Profile.Modules.NetworkDetails.DataIO.NetworkDetailsRow row in rows) * { * str += "<tr class=\"" + (position == 0 ? "evenRow" : "oddRow") + "\" onclick=\"doURL('" + basepath + "/profile/" + row.NodeID + "')\" onkeypress=\"if (event.keyCode == 13) doURL('" + basepath + "/profile/" + row.NodeID + "')\" onmouseover=\"doListTableRowOver(this)\" onfocus=\"doListTableRowOver(this)\" " + * "onmouseout=\"doListTableRowOut(this," + position + ")\" onblur=\"doListTableRowOut(this," + position + ")\" tabindex=\"0\"" + * ">" + * "<td><a href=\"" + basepath + "/profile/" + row.NodeID + "\">" + row.Name + "</a></td>" + * "<td>" + row.NumPubsThis + "</td>" + * "<td>" + row.LastPublicationYear + "</td>" + * "<td>" + row.NumPubsAll + "</td>" + * "<td>" + String.Format("{0:0.00}", row.Weight) + "</td>" + * "<td><a class=\"listTableLink\" href=\"" + basepath + "/profile/" + subject + "/" + predicate + "/" + row.NodeID + "\" style=\"cursor: pointer; color: rgb(51, 102, 204);\">Why?</a></td></tr>"; * * if (position == 0) position = 1; else position = 0; * } */ StringBuilder sb = new StringBuilder(); foreach (Profiles.Profile.Modules.NetworkDetails.DataIO.NetworkDetailsRow row in rows) { sb.Append("<tr class=\""); sb.Append(position == 0 ? "evenRow" : "oddRow"); sb.Append("\" onclick=\"doURL('"); sb.Append(baseuri); sb.Append(row.NodeID); sb.Append("')\" onkeypress=\"if (event.keyCode == 13) doURL('"); sb.Append(baseuri); sb.Append(row.NodeID); sb.Append("')\" onmouseover=\"doListTableRowOver(this)\" onfocus=\"doListTableRowOver(this)\" onmouseout=\"doListTableRowOut(this,"); sb.Append(position); sb.Append(")\" onblur=\"doListTableRowOut(this,"); sb.Append(position); sb.Append(")\" tabindex=\"0\"><td><a href=\""); sb.Append(baseuri); sb.Append(row.NodeID); sb.Append("\">"); sb.Append(row.Name); sb.Append("</a></td><td>"); sb.Append(row.NumPubsThis); sb.Append("</td><td>"); sb.Append(row.LastPublicationYear); sb.Append("</td><td>"); sb.Append(row.NumPubsAll); sb.Append("</td><td>"); sb.Append(String.Format("{0:0.00}", row.Weight)); sb.Append("</td><td><a class=\"listTableLink\" href=\""); sb.Append(baseuri); sb.Append(subject); sb.Append("/"); sb.Append(predicate); sb.Append("/"); sb.Append(row.NodeID); sb.Append("\" style=\"cursor: pointer; color: rgb(51, 102, 204);\">Why?</a></td></tr>"); if (position == 0) { position = 1; } else { position = 0; } } str = sb.ToString(); Framework.Utilities.Cache.Set(request.Key + "NetworkDetailsTableData", str); } else { str = (string)Framework.Utilities.Cache.FetchObject(request.Key + "NetworkDetailsTableData"); } litDetailsTableData.Text = str; /* * if (base.GetModuleParamString("MapType") == "CoAuthor") * { * * //reader = data.GetGMapUserCoAuthors(base.RDFTriple.Subject, 0, session.Session().SessionID); * //reader2 = data.GetGMapUserCoAuthors(base.RDFTriple.Subject, 1, session.Session().SessionID); * * } * * if (base.GetModuleParamString("MapType") == "SimilarTo") * { * //reader = data.GetGMapUserSimilarPeople(base.RDFTriple.Subject, false, session.Session().SessionID); * //reader2 = data.GetGMapUserSimilarPeople(base.RDFTriple.Subject, true, session.Session().SessionID); * } * * if (base.GetModuleParamString("MapType") == "Group") * { * //litCoauthorGroup.Text = "group members"; * //reader = data.GetGMapUserGroup(base.RDFTriple.Subject, 0, session.Session().SessionID); * //reader2 = data.GetGMapUserGroup(base.RDFTriple.Subject, 1, session.Session().SessionID); * } */ }
/// <summary> /// Verifies if the given triple carries a collection subj and, if so, collects it /// </summary> private void CollectCollections(RDFTriple triple) { if (triple != null) { //SUBJECT -> rdf:type -> rdf:list if (triple.TripleFlavor == RDFModelEnums.RDFTripleFlavors.SPO && triple.Predicate.Equals(RDFVocabulary.RDF.TYPE)) { if (triple.Object.Equals(RDFVocabulary.RDF.LIST)) { if (!this.Collections.ContainsKey((RDFResource)triple.Subject)) { this.Collections.Add((RDFResource)triple.Subject, new RDFCollectionItem(RDFModelEnums.RDFItemTypes.Resource, null, null)); } } } //SUBJECT -> rdf:first -> [OBJECT|LITERAL] else if (triple.Predicate.Equals(RDFVocabulary.RDF.FIRST)) { if (this.Collections.ContainsKey((RDFResource)triple.Subject)) { if (triple.TripleFlavor == RDFModelEnums.RDFTripleFlavors.SPO) { this.Collections[(RDFResource)triple.Subject] = new RDFCollectionItem(RDFModelEnums.RDFItemTypes.Resource, (RDFResource)triple.Object, null); } else { this.Collections[(RDFResource)triple.Subject] = new RDFCollectionItem(RDFModelEnums.RDFItemTypes.Literal, (RDFLiteral)triple.Object, null); } } } //SUBJECT -> rdf:rest -> [BNODE|RDF:NIL] else if (triple.TripleFlavor == RDFModelEnums.RDFTripleFlavors.SPO && triple.Predicate.Equals(RDFVocabulary.RDF.REST)) { if (this.Collections.ContainsKey((RDFResource)triple.Subject)) { this.Collections[(RDFResource)triple.Subject] = new RDFCollectionItem(this.Collections[(RDFResource)triple.Subject].ItemType, this.Collections[(RDFResource)triple.Subject].ItemValue, triple.Object); } } } }
/// <summary> /// Removes the given triple from the SPOL index /// </summary> internal RDFGraphIndex RemoveIndex(RDFTriple triple) { if (triple != null) { //Subject if (this.Subjects.ContainsKey(triple.Subject.PatternMemberID)) { if (this.Subjects[triple.Subject.PatternMemberID].ContainsKey(triple.TripleID)) { this.Subjects[triple.Subject.PatternMemberID].Remove(triple.TripleID); if (this.Subjects[triple.Subject.PatternMemberID].Count == 0) { this.Subjects.Remove(triple.Subject.PatternMemberID); } } } //Predicate if (this.Predicates.ContainsKey(triple.Predicate.PatternMemberID)) { if (this.Predicates[triple.Predicate.PatternMemberID].ContainsKey(triple.TripleID)) { this.Predicates[triple.Predicate.PatternMemberID].Remove(triple.TripleID); if (this.Predicates[triple.Predicate.PatternMemberID].Count == 0) { this.Predicates.Remove(triple.Predicate.PatternMemberID); } } } //Object if (triple.TripleFlavor == RDFModelEnums.RDFTripleFlavors.SPO) { if (this.Objects.ContainsKey(triple.Object.PatternMemberID)) { if (this.Objects[triple.Object.PatternMemberID].ContainsKey(triple.TripleID)) { this.Objects[triple.Object.PatternMemberID].Remove(triple.TripleID); if (this.Objects[triple.Object.PatternMemberID].Count == 0) { this.Objects.Remove(triple.Object.PatternMemberID); } } } } //Literal else { if (this.Literals.ContainsKey(triple.Object.PatternMemberID)) { if (this.Literals[triple.Object.PatternMemberID].ContainsKey(triple.TripleID)) { this.Literals[triple.Object.PatternMemberID].Remove(triple.TripleID); if (this.Literals[triple.Object.PatternMemberID].Count == 0) { this.Literals.Remove(triple.Object.PatternMemberID); } } } } } return this; }
protected void LoadRDF() { // First we set some core RDF resources // agent refers to artist(s) RDFResource type = RDFVocabulary.RDF.TYPE; RDFResource name = RDFVocabulary.FOAF.NAME; RDFResource agent = RDFVocabulary.FOAF.AGENT; // TGN is a Getty vocabulary for locations // TGN added to RDFSharp vocabularies manually. TGN ID is stored in TMSThes (or equivalent in TMS 2014+) RDFResource tgn = new RDFResource(RDFVocabulary.TGN.BASE_URI); // The predicates below are often part of ULAN (which we don't have) // unsure if using bio events this way is acceptable... RDFResource livedIn = new RDFResource("http://purl.org/vocab/bio/0.1/event/livedIn"); RDFResource activeIn = new RDFResource("http://purl.org/vocab/bio/0.1/event/activeIn"); RDFResource educatedIn = new RDFResource("http://purl.org/vocab/bio/0.1/event/educatedIn"); RDFResource bornIn = new RDFResource("http://purl.org/vocab/bio/0.1/event/bornIn"); RDFResource diedIn = new RDFResource("http://purl.org/vocab/bio/0.1/event/diedIn"); RDFResource anUri = new RDFResource("http://example.org/uris#anUri"); // The following entries are all generated from SQL queries which you can find in the file SQL.txt Technically we could load them into the database directly, // but this allows us to see how a resource is "built" and it creates the correct RDF format files (NTriples, RdfXml, TriX), as well as inserts into the db. // Once in the db, we do not need to run LoadRDF() except to refresh data. #region Artists (agents) // Ideally this would reference the Getty vocabulary for ULAN but we don't have the ULAN ID stored in the db RDFResource raimundabraham = new RDFResource("http://example.org/artists/47"); RDFResource emilioambasz = new RDFResource("http://example.org/artists/141"); RDFResource mariobotta = new RDFResource("http://example.org/artists/696"); RDFResource louisikahn = new RDFResource("http://example.org/artists/2964"); RDFResource frederickkiesler = new RDFResource("http://example.org/artists/3091"); RDFResource leonkrier = new RDFResource("http://example.org/artists/3250"); RDFResource masayukikurokawa = new RDFResource("http://example.org/artists/3308"); RDFResource ernestobrunolapadula = new RDFResource("http://example.org/artists/3381"); RDFResource richardmeier = new RDFResource("http://example.org/artists/3910"); RDFResource eerosaarinen = new RDFResource("http://example.org/artists/5103"); RDFResource franklloydwright = new RDFResource("http://example.org/artists/6459"); RDFResource evazeisel = new RDFResource("http://example.org/artists/6556"); RDFResource zahahadid = new RDFResource("http://example.org/artists/6953"); RDFResource santiagocalatrava = new RDFResource("http://example.org/artists/6968"); RDFResource tadaoando = new RDFResource("http://example.org/artists/7055"); RDFResource ludwigmiesvanderrohe = new RDFResource("http://example.org/artists/7166"); RDFResource rafaelviñoly = new RDFResource("http://example.org/artists/7229"); RDFResource aldorossi = new RDFResource("http://example.org/artists/7661"); RDFResource simonungers = new RDFResource("http://example.org/artists/7992"); RDFResource giovanniguerrini = new RDFResource("http://example.org/artists/8157"); RDFResource marioromano = new RDFResource("http://example.org/artists/8158"); RDFResource thommayne = new RDFResource("http://example.org/artists/8218"); RDFResource thomaskinslow = new RDFResource("http://example.org/artists/8248"); RDFResource fusogomuindcoltdtokyo = new RDFResource("http://example.org/artists/9029"); RDFResource hallchinacoeastliverpooloh = new RDFResource("http://example.org/artists/10013"); RDFResource andrewzago = new RDFResource("http://example.org/artists/22884"); RDFResource morphosissantamonicaca = new RDFResource("http://example.org/artists/29711"); // Artists(agents): plain literal name RDFPlainLiteral aldorossiName = new RDFPlainLiteral("Aldo Rossi"); RDFPlainLiteral andrewzagoName = new RDFPlainLiteral("Andrew Zago"); RDFPlainLiteral eerosaarinenName = new RDFPlainLiteral("Eero Saarinen"); RDFPlainLiteral emilioambaszName = new RDFPlainLiteral("Emilio Ambasz"); RDFPlainLiteral ernestobrunolapadulaName = new RDFPlainLiteral("Ernesto Bruno La Padula"); RDFPlainLiteral evazeiselName = new RDFPlainLiteral("Eva Zeisel"); RDFPlainLiteral franklloydwrightName = new RDFPlainLiteral("Frank Lloyd Wright"); RDFPlainLiteral frederickkieslerName = new RDFPlainLiteral("Frederick Kiesler"); RDFPlainLiteral fusogomuindcoltdtokyoName = new RDFPlainLiteral("Fuso Gomu Ind. Co., Ltd., Tokyo"); RDFPlainLiteral giovanniguerriniName = new RDFPlainLiteral("Giovanni Guerrini"); RDFPlainLiteral hallchinacoeastliverpoolohName = new RDFPlainLiteral("Hall China Co., East Liverpool, OH"); RDFPlainLiteral leonkrierName = new RDFPlainLiteral("Leon Krier"); RDFPlainLiteral louisikahnName = new RDFPlainLiteral("Louis I. Kahn"); RDFPlainLiteral ludwigmiesvanderroheName = new RDFPlainLiteral("Ludwig Mies van der Rohe"); RDFPlainLiteral mariobottaName = new RDFPlainLiteral("Mario Botta"); RDFPlainLiteral marioromanoName = new RDFPlainLiteral("Mario Romano"); RDFPlainLiteral masayukikurokawaName = new RDFPlainLiteral("Masayuki Kurokawa"); RDFPlainLiteral morphosissantamonicacaName = new RDFPlainLiteral("Morphosis, Santa Monica, CA"); RDFPlainLiteral rafaelviñolyName = new RDFPlainLiteral("Rafael Viñoly"); RDFPlainLiteral raimundabrahamName = new RDFPlainLiteral("Raimund Abraham"); RDFPlainLiteral richardmeierName = new RDFPlainLiteral("Richard Meier"); RDFPlainLiteral santiagocalatravaName = new RDFPlainLiteral("Santiago Calatrava"); RDFPlainLiteral simonungersName = new RDFPlainLiteral("Simon Ungers"); RDFPlainLiteral tadaoandoName = new RDFPlainLiteral("Tadao Ando"); RDFPlainLiteral thommayneName = new RDFPlainLiteral("Thom Mayne"); RDFPlainLiteral thomaskinslowName = new RDFPlainLiteral("Thomas Kinslow"); RDFPlainLiteral zahahadidName = new RDFPlainLiteral("Zaha Hadid"); #endregion #region Locations (tgn) RDFResource northwales = new RDFResource("http://vocab.getty.edu/tgn/2091433-place"); RDFResource wales = new RDFResource("http://vocab.getty.edu/tgn/7002443-place"); RDFResource berlin = new RDFResource("http://vocab.getty.edu/tgn/7003712-place"); RDFResource newyork = new RDFResource("http://vocab.getty.edu/tgn/7007567-place"); RDFResource edinburgh = new RDFResource("http://vocab.getty.edu/tgn/7009546-place"); RDFResource kiyev = new RDFResource("http://vocab.getty.edu/tgn/7010171-place"); RDFResource london = new RDFResource("http://vocab.getty.edu/tgn/7011781-place"); RDFResource moskva = new RDFResource("http://vocab.getty.edu/tgn/7012974-place"); RDFResource boston = new RDFResource("http://vocab.getty.edu/tgn/7013445-place"); RDFResource detroit = new RDFResource("http://vocab.getty.edu/tgn/7013547-place"); RDFResource longbeach = new RDFResource("http://vocab.getty.edu/tgn/7013905-place"); RDFResource sanfrancisco = new RDFResource("http://vocab.getty.edu/tgn/7014456-place"); // Locations (tgn): plain literal name RDFPlainLiteral berlinName = new RDFPlainLiteral("Berlin"); RDFPlainLiteral bostonName = new RDFPlainLiteral("Boston"); RDFPlainLiteral detroitName = new RDFPlainLiteral("Detroit"); RDFPlainLiteral edinburghName = new RDFPlainLiteral("Edinburgh"); RDFPlainLiteral kiyevName = new RDFPlainLiteral("Kiyev"); RDFPlainLiteral londonName = new RDFPlainLiteral("London"); RDFPlainLiteral longbeachName = new RDFPlainLiteral("Long Beach"); RDFPlainLiteral moskvaName = new RDFPlainLiteral("Moskva"); RDFPlainLiteral newyorkName = new RDFPlainLiteral("New York"); RDFPlainLiteral northwalesName = new RDFPlainLiteral("North Wales"); RDFPlainLiteral sanfranciscoName = new RDFPlainLiteral("San Francisco"); RDFPlainLiteral walesName = new RDFPlainLiteral("Wales"); #endregion #region Triples // Create triple resources RDFTriple aldorossi_type_agent = new RDFTriple(aldorossi, type, agent); RDFTriple andrewzago_type_agent = new RDFTriple(andrewzago, type, agent); RDFTriple eerosaarinen_type_agent = new RDFTriple(eerosaarinen, type, agent); RDFTriple emilioambasz_type_agent = new RDFTriple(emilioambasz, type, agent); RDFTriple ernestobrunolapadula_type_agent = new RDFTriple(ernestobrunolapadula, type, agent); RDFTriple evazeisel_type_agent = new RDFTriple(evazeisel, type, agent); RDFTriple franklloydwright_type_agent = new RDFTriple(franklloydwright, type, agent); RDFTriple frederickkiesler_type_agent = new RDFTriple(frederickkiesler, type, agent); RDFTriple fusogomuindcoltdtokyo_type_agent = new RDFTriple(fusogomuindcoltdtokyo, type, agent); RDFTriple giovanniguerrini_type_agent = new RDFTriple(giovanniguerrini, type, agent); RDFTriple hallchinacoeastliverpooloh_type_agent = new RDFTriple(hallchinacoeastliverpooloh, type, agent); RDFTriple leonkrier_type_agent = new RDFTriple(leonkrier, type, agent); RDFTriple louisikahn_type_agent = new RDFTriple(louisikahn, type, agent); RDFTriple ludwigmiesvanderrohe_type_agent = new RDFTriple(ludwigmiesvanderrohe, type, agent); RDFTriple mariobotta_type_agent = new RDFTriple(mariobotta, type, agent); RDFTriple marioromano_type_agent = new RDFTriple(marioromano, type, agent); RDFTriple masayukikurokawa_type_agent = new RDFTriple(masayukikurokawa, type, agent); RDFTriple morphosissantamonicaca_type_agent = new RDFTriple(morphosissantamonicaca, type, agent); RDFTriple rafaelviñoly_type_agent = new RDFTriple(rafaelviñoly, type, agent); RDFTriple raimundabraham_type_agent = new RDFTriple(raimundabraham, type, agent); RDFTriple richardmeier_type_agent = new RDFTriple(richardmeier, type, agent); RDFTriple santiagocalatrava_type_agent = new RDFTriple(santiagocalatrava, type, agent); RDFTriple simonungers_type_agent = new RDFTriple(simonungers, type, agent); RDFTriple tadaoando_type_agent = new RDFTriple(tadaoando, type, agent); RDFTriple thommayne_type_agent = new RDFTriple(thommayne, type, agent); RDFTriple thomaskinslow_type_agent = new RDFTriple(thomaskinslow, type, agent); RDFTriple zahahadid_type_agent = new RDFTriple(zahahadid, type, agent); RDFTriple berlin_type_tgn = new RDFTriple(berlin, type, tgn); RDFTriple boston_type_tgn = new RDFTriple(boston, type, tgn); RDFTriple detroit_type_tgn = new RDFTriple(detroit, type, tgn); RDFTriple edinburgh_type_tgn = new RDFTriple(edinburgh, type, tgn); RDFTriple kiyev_type_tgn = new RDFTriple(kiyev, type, tgn); RDFTriple london_type_tgn = new RDFTriple(london, type, tgn); RDFTriple longbeach_type_tgn = new RDFTriple(longbeach, type, tgn); RDFTriple moskva_type_tgn = new RDFTriple(moskva, type, tgn); RDFTriple newyork_type_tgn = new RDFTriple(newyork, type, tgn); RDFTriple northwales_type_tgn = new RDFTriple(northwales, type, tgn); RDFTriple sanfrancisco_type_tgn = new RDFTriple(sanfrancisco, type, tgn); RDFTriple wales_type_tgn = new RDFTriple(wales, type, tgn); RDFTriple aldorossi_name_aldorossiName = new RDFTriple(aldorossi, name, aldorossiName); RDFTriple andrewzago_name_andrewzagoName = new RDFTriple(andrewzago, name, andrewzagoName); RDFTriple eerosaarinen_name_eerosaarinenName = new RDFTriple(eerosaarinen, name, eerosaarinenName); RDFTriple emilioambasz_name_emilioambaszName = new RDFTriple(emilioambasz, name, emilioambaszName); RDFTriple ernestobrunolapadula_name_ernestobrunolapadulaName = new RDFTriple(ernestobrunolapadula, name, ernestobrunolapadulaName); RDFTriple evazeisel_name_evazeiselName = new RDFTriple(evazeisel, name, evazeiselName); RDFTriple franklloydwright_name_franklloydwrightName = new RDFTriple(franklloydwright, name, franklloydwrightName); RDFTriple frederickkiesler_name_frederickkieslerName = new RDFTriple(frederickkiesler, name, frederickkieslerName); RDFTriple fusogomuindcoltdtokyo_name_fusogomuindcoltdtokyoName = new RDFTriple(fusogomuindcoltdtokyo, name, fusogomuindcoltdtokyoName); RDFTriple giovanniguerrini_name_giovanniguerriniName = new RDFTriple(giovanniguerrini, name, giovanniguerriniName); RDFTriple hallchinacoeastliverpooloh_name_hallchinacoeastliverpoolohName = new RDFTriple(hallchinacoeastliverpooloh, name, hallchinacoeastliverpoolohName); RDFTriple leonkrier_name_leonkrierName = new RDFTriple(leonkrier, name, leonkrierName); RDFTriple louisikahn_name_louisikahnName = new RDFTriple(louisikahn, name, louisikahnName); RDFTriple ludwigmiesvanderrohe_name_ludwigmiesvanderroheName = new RDFTriple(ludwigmiesvanderrohe, name, ludwigmiesvanderroheName); RDFTriple mariobotta_name_mariobottaName = new RDFTriple(mariobotta, name, mariobottaName); RDFTriple marioromano_name_marioromanoName = new RDFTriple(marioromano, name, marioromanoName); RDFTriple masayukikurokawa_name_masayukikurokawaName = new RDFTriple(masayukikurokawa, name, masayukikurokawaName); RDFTriple morphosissantamonicaca_name_morphosissantamonicacaName = new RDFTriple(morphosissantamonicaca, name, morphosissantamonicacaName); RDFTriple rafaelviñoly_name_rafaelviñolyName = new RDFTriple(rafaelviñoly, name, rafaelviñolyName); RDFTriple raimundabraham_name_raimundabrahamName = new RDFTriple(raimundabraham, name, raimundabrahamName); RDFTriple richardmeier_name_richardmeierName = new RDFTriple(richardmeier, name, richardmeierName); RDFTriple santiagocalatrava_name_santiagocalatravaName = new RDFTriple(santiagocalatrava, name, santiagocalatravaName); RDFTriple simonungers_name_simonungersName = new RDFTriple(simonungers, name, simonungersName); RDFTriple tadaoando_name_tadaoandoName = new RDFTriple(tadaoando, name, tadaoandoName); RDFTriple thommayne_name_thommayneName = new RDFTriple(thommayne, name, thommayneName); RDFTriple thomaskinslow_name_thomaskinslowName = new RDFTriple(thomaskinslow, name, thomaskinslowName); RDFTriple zahahadid_name_zahahadidName = new RDFTriple(zahahadid, name, zahahadidName); RDFTriple berlin_name_berlinName = new RDFTriple(berlin, name, berlinName); RDFTriple boston_name_bostonName = new RDFTriple(boston, name, bostonName); RDFTriple detroit_name_detroitName = new RDFTriple(detroit, name, detroitName); RDFTriple edinburgh_name_edinburghName = new RDFTriple(edinburgh, name, edinburghName); RDFTriple kiyev_name_kiyevName = new RDFTriple(kiyev, name, kiyevName); RDFTriple london_name_londonName = new RDFTriple(london, name, londonName); RDFTriple longbeach_name_longbeachName = new RDFTriple(longbeach, name, longbeachName); RDFTriple moskva_name_moskvaName = new RDFTriple(moskva, name, moskvaName); RDFTriple newyork_name_newyorkName = new RDFTriple(newyork, name, newyorkName); RDFTriple northwales_name_northwalesName = new RDFTriple(northwales, name, northwalesName); RDFTriple sanfrancisco_name_sanfranciscoName = new RDFTriple(sanfrancisco, name, sanfranciscoName); RDFTriple wales_name_walesName = new RDFTriple(wales, name, walesName); RDFTriple aldorossi_activeIn_moskva = new RDFTriple(aldorossi, activeIn, moskva); RDFTriple andrewzago_activeIn_moskva = new RDFTriple(andrewzago, activeIn, moskva); RDFTriple eerosaarinen_activeIn_newyork = new RDFTriple(eerosaarinen, activeIn, newyork); RDFTriple emilioambasz_activeIn_newyork = new RDFTriple(emilioambasz, activeIn, newyork); RDFTriple ernestobrunolapadula_activeIn_newyork = new RDFTriple(ernestobrunolapadula, activeIn, newyork); RDFTriple evazeisel_educatedIn_berlin = new RDFTriple(evazeisel, educatedIn, berlin); RDFTriple franklloydwright_activeIn_detroit = new RDFTriple(franklloydwright, activeIn, detroit); RDFTriple franklloydwright_livedIn_moskva = new RDFTriple(franklloydwright, livedIn, moskva); RDFTriple frederickkiesler_livedIn_longbeach = new RDFTriple(frederickkiesler, livedIn, longbeach); RDFTriple fusogomuindcoltdtokyo_livedIn_london = new RDFTriple(fusogomuindcoltdtokyo, livedIn, london); RDFTriple giovanniguerrini_activeIn_newyork = new RDFTriple(giovanniguerrini, activeIn, newyork); RDFTriple hallchinacoeastliverpooloh_educatedIn_berlin = new RDFTriple(hallchinacoeastliverpooloh, educatedIn, berlin); RDFTriple leonkrier_activeIn_newyork = new RDFTriple(leonkrier, activeIn, newyork); RDFTriple leonkrier_educatedIn_london = new RDFTriple(leonkrier, educatedIn, london); RDFTriple louisikahn_livedIn_longbeach = new RDFTriple(louisikahn, livedIn, longbeach); RDFTriple louisikahn_livedIn_newyork = new RDFTriple(louisikahn, livedIn, newyork); RDFTriple ludwigmiesvanderrohe_activeIn_moskva = new RDFTriple(ludwigmiesvanderrohe, activeIn, moskva); RDFTriple ludwigmiesvanderrohe_livedIn_moskva = new RDFTriple(ludwigmiesvanderrohe, livedIn, moskva); RDFTriple mariobotta_activeIn_kiyev = new RDFTriple(mariobotta, activeIn, kiyev); RDFTriple mariobotta_activeIn_moskva = new RDFTriple(mariobotta, activeIn, moskva); RDFTriple mariobotta_livedIn_moskva = new RDFTriple(mariobotta, livedIn, moskva); RDFTriple marioromano_activeIn_newyork = new RDFTriple(marioromano, activeIn, newyork); RDFTriple masayukikurokawa_livedIn_london = new RDFTriple(masayukikurokawa, livedIn, london); RDFTriple morphosissantamonicaca_activeIn_moskva = new RDFTriple(morphosissantamonicaca, activeIn, moskva); RDFTriple rafaelviñoly_activeIn_newyork = new RDFTriple(rafaelviñoly, activeIn, newyork); RDFTriple raimundabraham_livedIn_moskva = new RDFTriple(raimundabraham, livedIn, moskva); RDFTriple richardmeier_activeIn_edinburgh = new RDFTriple(richardmeier, activeIn, edinburgh); RDFTriple richardmeier_activeIn_london = new RDFTriple(richardmeier, activeIn, london); RDFTriple richardmeier_educatedIn_london = new RDFTriple(richardmeier, educatedIn, london); RDFTriple santiagocalatrava_livedIn_newyork = new RDFTriple(santiagocalatrava, livedIn, newyork); RDFTriple simonungers_livedIn_boston = new RDFTriple(simonungers, livedIn, boston); RDFTriple simonungers_livedIn_newyork = new RDFTriple(simonungers, livedIn, newyork); RDFTriple tadaoando_activeIn_newyork = new RDFTriple(tadaoando, activeIn, newyork); RDFTriple tadaoando_livedIn_northwales = new RDFTriple(tadaoando, livedIn, northwales); RDFTriple tadaoando_livedIn_wales = new RDFTriple(tadaoando, livedIn, wales); RDFTriple thommayne_activeIn_moskva = new RDFTriple(thommayne, activeIn, moskva); RDFTriple thomaskinslow_livedIn_boston = new RDFTriple(thomaskinslow, livedIn, boston); RDFTriple thomaskinslow_livedIn_newyork = new RDFTriple(thomaskinslow, livedIn, newyork); RDFTriple zahahadid_activeIn_sanfrancisco = new RDFTriple(zahahadid, activeIn, sanfrancisco); #endregion #region Add triples to graph RDFGraph m_graph = new RDFGraph(); m_graph.AddTriple(aldorossi_activeIn_moskva); m_graph.AddTriple(aldorossi_name_aldorossiName); m_graph.AddTriple(aldorossi_type_agent); m_graph.AddTriple(andrewzago_activeIn_moskva); m_graph.AddTriple(andrewzago_name_andrewzagoName); m_graph.AddTriple(andrewzago_type_agent); m_graph.AddTriple(berlin_name_berlinName); m_graph.AddTriple(berlin_type_tgn); m_graph.AddTriple(boston_name_bostonName); m_graph.AddTriple(boston_type_tgn); m_graph.AddTriple(detroit_name_detroitName); m_graph.AddTriple(detroit_type_tgn); m_graph.AddTriple(edinburgh_name_edinburghName); m_graph.AddTriple(edinburgh_type_tgn); m_graph.AddTriple(eerosaarinen_activeIn_newyork); m_graph.AddTriple(eerosaarinen_name_eerosaarinenName); m_graph.AddTriple(eerosaarinen_type_agent); m_graph.AddTriple(emilioambasz_activeIn_newyork); m_graph.AddTriple(emilioambasz_name_emilioambaszName); m_graph.AddTriple(emilioambasz_type_agent); m_graph.AddTriple(ernestobrunolapadula_activeIn_newyork); m_graph.AddTriple(ernestobrunolapadula_name_ernestobrunolapadulaName); m_graph.AddTriple(ernestobrunolapadula_type_agent); m_graph.AddTriple(evazeisel_educatedIn_berlin); m_graph.AddTriple(evazeisel_name_evazeiselName); m_graph.AddTriple(evazeisel_type_agent); m_graph.AddTriple(franklloydwright_activeIn_detroit); m_graph.AddTriple(franklloydwright_livedIn_moskva); m_graph.AddTriple(franklloydwright_name_franklloydwrightName); m_graph.AddTriple(franklloydwright_type_agent); m_graph.AddTriple(frederickkiesler_livedIn_longbeach); m_graph.AddTriple(frederickkiesler_name_frederickkieslerName); m_graph.AddTriple(frederickkiesler_type_agent); m_graph.AddTriple(fusogomuindcoltdtokyo_livedIn_london); m_graph.AddTriple(fusogomuindcoltdtokyo_name_fusogomuindcoltdtokyoName); m_graph.AddTriple(fusogomuindcoltdtokyo_type_agent); m_graph.AddTriple(giovanniguerrini_activeIn_newyork); m_graph.AddTriple(giovanniguerrini_name_giovanniguerriniName); m_graph.AddTriple(giovanniguerrini_type_agent); m_graph.AddTriple(hallchinacoeastliverpooloh_educatedIn_berlin); m_graph.AddTriple(hallchinacoeastliverpooloh_name_hallchinacoeastliverpoolohName); m_graph.AddTriple(hallchinacoeastliverpooloh_type_agent); m_graph.AddTriple(kiyev_name_kiyevName); m_graph.AddTriple(kiyev_type_tgn); m_graph.AddTriple(leonkrier_activeIn_newyork); m_graph.AddTriple(leonkrier_educatedIn_london); m_graph.AddTriple(leonkrier_name_leonkrierName); m_graph.AddTriple(leonkrier_type_agent); m_graph.AddTriple(london_name_londonName); m_graph.AddTriple(london_type_tgn); m_graph.AddTriple(longbeach_name_longbeachName); m_graph.AddTriple(longbeach_type_tgn); m_graph.AddTriple(louisikahn_livedIn_longbeach); m_graph.AddTriple(louisikahn_livedIn_newyork); m_graph.AddTriple(louisikahn_name_louisikahnName); m_graph.AddTriple(louisikahn_type_agent); m_graph.AddTriple(ludwigmiesvanderrohe_activeIn_moskva); m_graph.AddTriple(ludwigmiesvanderrohe_livedIn_moskva); m_graph.AddTriple(ludwigmiesvanderrohe_name_ludwigmiesvanderroheName); m_graph.AddTriple(ludwigmiesvanderrohe_type_agent); m_graph.AddTriple(mariobotta_activeIn_kiyev); m_graph.AddTriple(mariobotta_activeIn_moskva); m_graph.AddTriple(mariobotta_livedIn_moskva); m_graph.AddTriple(mariobotta_name_mariobottaName); m_graph.AddTriple(mariobotta_type_agent); m_graph.AddTriple(marioromano_activeIn_newyork); m_graph.AddTriple(marioromano_name_marioromanoName); m_graph.AddTriple(marioromano_type_agent); m_graph.AddTriple(masayukikurokawa_livedIn_london); m_graph.AddTriple(masayukikurokawa_name_masayukikurokawaName); m_graph.AddTriple(masayukikurokawa_type_agent); m_graph.AddTriple(morphosissantamonicaca_activeIn_moskva); m_graph.AddTriple(morphosissantamonicaca_name_morphosissantamonicacaName); m_graph.AddTriple(morphosissantamonicaca_type_agent); m_graph.AddTriple(moskva_name_moskvaName); m_graph.AddTriple(moskva_type_tgn); m_graph.AddTriple(newyork_name_newyorkName); m_graph.AddTriple(newyork_type_tgn); m_graph.AddTriple(northwales_name_northwalesName); m_graph.AddTriple(northwales_type_tgn); m_graph.AddTriple(rafaelviñoly_activeIn_newyork); m_graph.AddTriple(rafaelviñoly_name_rafaelviñolyName); m_graph.AddTriple(rafaelviñoly_type_agent); m_graph.AddTriple(raimundabraham_livedIn_moskva); m_graph.AddTriple(raimundabraham_name_raimundabrahamName); m_graph.AddTriple(raimundabraham_type_agent); m_graph.AddTriple(richardmeier_activeIn_edinburgh); m_graph.AddTriple(richardmeier_activeIn_london); m_graph.AddTriple(richardmeier_educatedIn_london); m_graph.AddTriple(richardmeier_name_richardmeierName); m_graph.AddTriple(richardmeier_type_agent); m_graph.AddTriple(sanfrancisco_name_sanfranciscoName); m_graph.AddTriple(sanfrancisco_type_tgn); m_graph.AddTriple(santiagocalatrava_livedIn_newyork); m_graph.AddTriple(santiagocalatrava_name_santiagocalatravaName); m_graph.AddTriple(santiagocalatrava_type_agent); m_graph.AddTriple(simonungers_livedIn_boston); m_graph.AddTriple(simonungers_livedIn_newyork); m_graph.AddTriple(simonungers_name_simonungersName); m_graph.AddTriple(simonungers_type_agent); m_graph.AddTriple(tadaoando_activeIn_newyork); m_graph.AddTriple(tadaoando_livedIn_northwales); m_graph.AddTriple(tadaoando_livedIn_wales); m_graph.AddTriple(tadaoando_name_tadaoandoName); m_graph.AddTriple(tadaoando_type_agent); m_graph.AddTriple(thomaskinslow_livedIn_boston); m_graph.AddTriple(thomaskinslow_livedIn_newyork); m_graph.AddTriple(thomaskinslow_name_thomaskinslowName); m_graph.AddTriple(thomaskinslow_type_agent); m_graph.AddTriple(thommayne_activeIn_moskva); m_graph.AddTriple(thommayne_name_thommayneName); m_graph.AddTriple(thommayne_type_agent); m_graph.AddTriple(wales_name_walesName); m_graph.AddTriple(wales_type_tgn); m_graph.AddTriple(zahahadid_activeIn_sanfrancisco); m_graph.AddTriple(zahahadid_name_zahahadidName); m_graph.AddTriple(zahahadid_type_agent); #endregion // Only using RdfXml for this example so no need to write/read all files // Write RDF RDFSerializer.WriteRDF(RDFModelEnums.RDFFormats.RdfXml, m_graph, Server.MapPath("~/").ToString() + "\\" + "tms.rdf"); //RDFSerializer.WriteRDF(RDFModelEnums.RDFFormats.Turtle, m_graph, Server.MapPath("~/").ToString() + "\\" + "\\tms.ttl"); //RDFSerializer.WriteRDF(RDFModelEnums.RDFFormats.TriX, m_graph, Server.MapPath("~/").ToString() + "\\" + "\\tms.trix"); //RDFSerializer.WriteRDF(RDFModelEnums.RDFFormats.NTriples, m_graph, Server.MapPath("~/").ToString() + "\\" + "\\tms.nt"); // Read RDF RDFGraph tmsRDF = RDFSerializer.ReadRDF(RDFModelEnums.RDFFormats.RdfXml, Server.MapPath("~/").ToString() + "\\tms.rdf"); //RDFGraph tmsTURTLE = RDFSerializer.ReadRDF(RDFModelEnums.RDFFormats.Turtle, Environment.CurrentDirectory + "\\tms.ttl"); //RDFGraph tmsTRIX = RDFSerializer.ReadRDF(RDFModelEnums.RDFFormats.TriX, Environment.CurrentDirectory + "\\tms.trix"); //RDFGraph tmsNT = RDFSerializer.ReadRDF(RDFModelEnums.RDFFormats.NTriples, Environment.CurrentDirectory + "\\tms.nt"); // Write the RDF into SQL Server. You have other choices with RDFSharp including RDFMemoryStore string m_conn = ConfigurationManager.ConnectionStrings["RDFConnectionString"].ConnectionString; RDFSQLServerStore rdf_mssql = new RDFSQLServerStore(m_conn); rdf_mssql.MergeGraph(tmsRDF); // At this point you can open SQL Server and see a new table called Quadruples with all of the data in the correct format. // The first time you run this (successfully), the RdfViewer.aspx page will be empty. // Uncomment GetRDF() above and comment LoadRDF() and you should see a datagrid with RDF data. }
protected void InitAssets() { System.Web.UI.HtmlControls.HtmlLink NetworkBrowsercss = new System.Web.UI.HtmlControls.HtmlLink(); NetworkBrowsercss.Href = Root.Domain + "/Profile/CSS/NetworkBrowser.css"; NetworkBrowsercss.Attributes["rel"] = "stylesheet"; NetworkBrowsercss.Attributes["type"] = "text/css"; NetworkBrowsercss.Attributes["media"] = "all"; Page.Header.Controls.Add(NetworkBrowsercss); HtmlGenericControl jsscript1 = new HtmlGenericControl("script"); jsscript1.Attributes.Add("type", "text/javascript"); jsscript1.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkRadial/scriptaculous/lib/prototype.js"); Page.Header.Controls.Add(jsscript1); HtmlGenericControl jsscript2 = new HtmlGenericControl("script"); jsscript2.Attributes.Add("type", "text/javascript"); jsscript2.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkRadial/scriptaculous/src/scriptaculous.js"); Page.Header.Controls.Add(jsscript2); HtmlGenericControl jsscript3 = new HtmlGenericControl("script"); jsscript3.Attributes.Add("type", "text/javascript"); jsscript3.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkRadial/javascript/networkBrowserClass.js"); Page.Header.Controls.Add(jsscript3); divSwfScript.InnerHtml = "<script language=\"JavaScript\" type=\"text/javascript\"> " + "AC_FL_RunContent(" + "'codebase', '//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0'," + "'width', '600'," + "'height', '600'," + "'src', '" + Root.Domain + "/profile/Modules/NetworkRadial/network_browser.swf'," + "'movie', '" + Root.Domain + "/profile/Modules/NetworkRadial/network_browser'," + "'quality', 'high'," + "'pluginspage', '//www.adobe.com/go/getflashplayer'," + "'align', 'middle'," + "'play', 'true'," + "'loop', 'true'," + "'scale', 'showall'," + "'wmode', 'transparent'," + "'devicefont', 'false'," + "'id', 'network_browserFLASH'," + "'bgcolor', '#ffffff'," + "'name', 'network_browserFLASH'," + "'menu', 'true'," + "'allowFullScreen', 'false'," + "'allowScriptAccess', 'always'," + "'salign', ''" + "); //end AC code" + "</script>"; HtmlGenericControl script = new HtmlGenericControl("script"); script.Attributes.Add("type", "text/javascript"); script.InnerHtml = "window.onload = function() {" + " network_browser._cfg.profile_network_path = '/" + Request.QueryString["Predicate"].ToString() + "/radial'; " + " network_browser.Init('" + Root.Domain + "/profile/modules/NetworkRadial/NetworkRadialSvc.aspx?p='); " + " network_browser.loadNetwork('" + Request.QueryString["Subject"].ToString() + "'); " + "}"; Page.Header.Controls.Add(script); Profiles.Profile.Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); RDFTriple request = new RDFTriple(Convert.ToInt64(Request.QueryString["subject"])); XmlDocument x = data.GetProfileNetworkForBrowser(request); System.Xml.Xsl.XsltArgumentList args = new System.Xml.Xsl.XsltArgumentList(); args.AddParam("root", "", Root.Domain); System.Xml.Xsl.XslCompiledTransform xslt = new System.Xml.Xsl.XslCompiledTransform(); lblProfileName.Text = x.SelectSingleNode("LocalNetwork/NetworkPeople/NetworkPerson[@d='0']").Attributes["fn"].Value + " " + x.SelectSingleNode("LocalNetwork/NetworkPeople/NetworkPerson[@d='0']").Attributes["ln"].Value; litNetworkText.Text = Profiles.Framework.Utilities.XslHelper.TransformInMemory(Server.MapPath("~/profile/XSLT/NetworkTable.xslt"), args, x.InnerXml); }