public bool AddLiteral(Int64 subjectid, Int64 predicateid, Int64 objectid, XmlDocument PropertyListXML) { ActivityLog(PropertyListXML, subjectid); bool error = false; try { StoreTripleRequest str = new StoreTripleRequest(); str.Subject = new StoreTripleParam(); str.Subject.Value = subjectid; str.Subject.ParamOrdinal = 0; str.Predicate = new StoreTripleParam(); str.Predicate.Value = predicateid; str.Predicate.ParamOrdinal = 1; str.Object = new StoreTripleParam(); str.Object.Value = objectid; str.Object.ParamOrdinal = 2; error = this.GetStoreTriple(str); } catch (Exception e) { Framework.Utilities.DebugLogging.Log(e.Message + e.StackTrace); throw new Exception(e.Message); } return error; }
public bool AddExistingEntity(Int64 subjectid, Int64 predicateid, Int64 objectid) { bool error = false; try { StoreTripleRequest str = new StoreTripleRequest(); str.Subject = new StoreTripleParam(); str.Subject.Value = subjectid; str.Subject.ParamOrdinal = 0; str.Predicate = new StoreTripleParam(); str.Predicate.Value = predicateid; str.Predicate.ParamOrdinal = 1; str.Object = new StoreTripleParam(); str.Object.Value = objectid; str.Object.ParamOrdinal = 2; str.StoreInverse = new StoreTripleParam(); str.StoreInverse.Value = 1; str.StoreInverse.ParamOrdinal = 3; error = this.GetStoreTriple(str); } catch (Exception e) { Framework.Utilities.DebugLogging.Log(e.Message + e.StackTrace); throw new Exception(e.Message); } return error; }
public bool MoveTripleUp(Int64 subjectid, Int64 predicateid, Int64 objectid) { EditActivityLog(subjectid, predicateid, null); bool error = false; try { StoreTripleRequest str = new StoreTripleRequest(); str.Subject = new StoreTripleParam(); str.Subject.Value = subjectid; str.Subject.ParamOrdinal = 0; str.Predicate = new StoreTripleParam(); str.Predicate.Value = predicateid; str.Predicate.ParamOrdinal = 1; str.Object = new StoreTripleParam(); str.Object.Value = objectid; str.Object.ParamOrdinal = 2; str.MoveUpOne = new StoreTripleParam(); str.MoveUpOne.Value = 1; str.MoveUpOne.ParamOrdinal = 3; error = this.GetStoreTriple(str); } catch (Exception e) { Framework.Utilities.DebugLogging.Log(e.Message + e.StackTrace); throw new Exception(e.Message); } return error; }
private bool GetStoreTriple(StoreTripleRequest str) { SessionManagement sm = new SessionManagement(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); SqlParameter[] param = new SqlParameter[str.Length]; bool error = false; try { dbconnection.Open(); if (str.Subject != null) param[str.Subject.ParamOrdinal] = new SqlParameter("@subjectid", Convert.ToInt64(str.Subject.Value)); if (str.Predicate != null) param[str.Predicate.ParamOrdinal] = new SqlParameter("@predicateid", Convert.ToInt64(str.Predicate.Value)); if (str.Object != null) param[str.Object.ParamOrdinal] = new SqlParameter("@objectid", Convert.ToInt64(str.Object.Value)); if (str.OldObject != null) param[str.OldObject.ParamOrdinal] = new SqlParameter("@oldobjectid", Convert.ToInt64(str.OldObject.Value)); if (str.MoveUpOne != null) param[str.MoveUpOne.ParamOrdinal] = new SqlParameter("@MoveUpOne", Convert.ToInt16(str.MoveUpOne.Value)); if (str.MoveDownOne != null) param[str.MoveDownOne.ParamOrdinal] = new SqlParameter("@MoveDownOne", Convert.ToInt16(str.MoveDownOne.Value)); if (str.StoreInverse != null) param[str.StoreInverse.ParamOrdinal] = new SqlParameter("@StoreInverse", Convert.ToInt16(str.StoreInverse.Value)); param[str.Length - 2] = new SqlParameter("@sessionID", sm.Session().SessionID); param[str.Length - 1] = new SqlParameter("@error", null); param[str.Length - 1].DbType = DbType.Boolean; param[str.Length - 1].Direction = ParameterDirection.Output; using (var cmd = GetDBCommand("", "[RDF.].GetStoreTriple", CommandType.StoredProcedure, CommandBehavior.CloseConnection, param)) { //For Output Parameters you need to pass a connection object to the framework so you can close it before reading the output params value. ExecuteSQLDataCommand(cmd); cmd.Connection.Close(); } error = Convert.ToBoolean(param[str.Length - 1].Value); Framework.Utilities.Cache.AlterDependency(str.Subject.Value.ToString()); } catch (Exception e) { Framework.Utilities.DebugLogging.Log(e.Message + e.StackTrace); throw new Exception(e.Message); } return error; }
public bool UpdateLiteral(Int64 subjectid, Int64 predicateid, Int64 oldobjectid, Int64 newobjectid) { SessionManagement sm = new SessionManagement(); bool error = false; try { StoreTripleRequest str = new StoreTripleRequest(); str.Subject = new StoreTripleParam(); str.Subject.Value = subjectid; str.Subject.ParamOrdinal = 0; str.Predicate = new StoreTripleParam(); str.Predicate.Value = predicateid; str.Predicate.ParamOrdinal = 1; str.Object = new StoreTripleParam(); str.Object.Value = newobjectid; str.Object.ParamOrdinal = 2; str.OldObject = new StoreTripleParam(); str.OldObject.Value = oldobjectid; str.OldObject.ParamOrdinal = 3; error = this.GetStoreTriple(str); } catch (Exception e) { Framework.Utilities.DebugLogging.Log(e.Message + e.StackTrace); throw new Exception(e.Message); } return error; }