public IEnumerable<RDFOStatement> GetOStatementsForObjs(IEnumerable<int> objs, DbCommand runcommand) { List<RDFOStatement> ostatements = new List<RDFOStatement>(); sema2012m.BufferredProcessing<int> buff = new sema2012m.BufferredProcessing<int>(200, obj_set => { string sql = "SELECT osubject,opredicate,oobj FROM rdf_ostatements WHERE " + obj_set.Select(su => "oobj=" + su).Aggregate((sum, s) => sum + " OR " + s); ostatements.AddRange(RunQuery(sql, runcommand).Select(r => new RDFOStatement() { osubject = (int)r[0], opredicate = (int)r[1], oobj = (int)r[2], })); }); foreach (var obj in objs) buff.Add(obj); buff.Flush(); return ostatements; }
private IEnumerable<RDFDStatement> GetDStatementsForSubjects(IEnumerable<int> subjects, DbCommand runcommand) { List<RDFDStatement> dstatements = new List<RDFDStatement>(); sema2012m.BufferredProcessing<int> buff = new sema2012m.BufferredProcessing<int>(200, subj_set => { string sql = "SELECT dsubject,dpredicate,data FROM rdf_dstatements WHERE " + subj_set.Select(su => "dsubject=" + su).Aggregate((sum, s) => sum + " OR " + s); dstatements.AddRange(RunQuery(sql, runcommand).Select(r => new RDFDStatement() { dsubject = (int)r[0], dpredicate = (int)r[1], data = (int)r[2], })); }); foreach (var subj in subjects) buff.Add(subj); buff.Flush(); return dstatements; }
private static IEnumerable<RDFOStatement> GetOStatementsForSubjects(IEnumerable<int> subjects) { List<RDFOStatement> ostatements = new List<RDFOStatement>(); sema2012m.BufferredProcessing<int> buff = new sema2012m.BufferredProcessing<int>(200, subj_set => { string sql = "SELECT osubject,opredicate,oobj FROM rdf_ostatements WHERE " + subj_set.Select(su => "osubject=" + su).Aggregate((sum, s) => sum + " OR " + s); ostatements.AddRange(Queries.RunQuery(sql).Select(r => new RDFOStatement() { osubject = (int)r[0], opredicate = (int)r[1], oobj = (int)r[2], })); }); foreach (var subj in subjects) buff.Add(subj); buff.Flush(); return ostatements; }