void PrepareConstants() { if (isFirstCall) { isFirstCall = false; ObjectVariants temp = null; if (sVariableNode == null) { var sAsStr = Subject as OV_iri; if (sAsStr != null) { if (!q.Store.NodeGenerator.TryGetUri(sAsStr, out temp)) { isAny = false; } Subject = temp; } } if (pVariableNode == null) { var predicateAsString = Predicate as OV_iri; if (predicateAsString != null) { if (!q.Store.NodeGenerator.TryGetUri(predicateAsString, out temp)) { isAny = false; } Predicate = temp; } } if (oVariableNode == null) { if (Object.Variant == ObjectVariantEnum.Iri) { if (!q.Store.NodeGenerator.TryGetUri((OV_iri)Object, out temp)) { isAny = false; } Object = temp; } } if (!isDefaultGraph && graphs.Any()) { //todo filter not existing graphs } } }
private IEnumerable<IGrouping<ObjectVariants, ObjectVariants>> sPoCacheGraphs(ObjectVariants subjectNode, ObjectVariants objectNode, DataSet variableDataSet) { if (variableDataSet.Any()) //search in all named graphs if (sPoGCache.Contains(subjectNode, objectNode)) return sPoGCache.Get(subjectNode, objectNode); else { var result = store.NamedGraphs.GetTriplesWithSubjectObjectFromGraphs(subjectNode, objectNode, variableDataSet).ToList(); sPoGCache.Add(subjectNode, objectNode, result); foreach (var grouping in result) { sPogCache.Add(subjectNode, objectNode, grouping.Key, grouping); foreach (var p in grouping) spoGCache.Get(subjectNode, p, objectNode).Add(grouping.Key); } return result; } var res = new List<IGrouping<ObjectVariants, ObjectVariants>>(); var gList = new DataSet(); foreach (var g in variableDataSet) if (sPogCache.Contains(subjectNode, objectNode, g)) res.Add(sPogCache.Get(subjectNode, objectNode, g)); else gList.Add(g); foreach (var gRes in store.NamedGraphs.GetTriplesWithSubjectObjectFromGraphs(subjectNode, objectNode, gList)) { sPogCache.Add(subjectNode, objectNode, gRes.Key, gRes); foreach (var p in gRes) spoGCache.Get(subjectNode, p, objectNode).Add(gRes.Key); res.Add(gRes); } return res; }
public async Task JobEntry(string name, int interval, ISource source, IEnumerable <IIntermedia> intermedias, ISink sink, CancellationToken ct) { try { while (true) { //Read data set from source filter DataSet dataset = await source.Read(ct); if (dataset == null || !dataset.Any()) { //Skip current loop if no data read, or filter is in status "stopping" goto loop; } //Process data set by intermedia filters foreach (var intermedia in intermedias) { //dataset = await intermedia.Process(dataset, ct); dataset = await intermedia.Process(dataset, ct, DeviceId);//Chris Han add DeviceId to Json if (dataset == null || !dataset.Any()) { //Skip current loop if no data read, or filter is in status "stopping" goto loop; } } //Individually sink each data, to help down-stream Job in aggregating foreach (var data in dataset) { await sink.Write(data, ct); } loop: await Task.Delay(interval, ct); } } catch (OperationCanceledException) { Trace.TraceInformation(string.Format(CultureInfo.InvariantCulture, "Job {0}.{1} finished", DeviceId, name)); } catch (Exception ex) { Trace.TraceError(string.Format(CultureInfo.InvariantCulture, "Job {0}.{1} stopped due to exception {2}", DeviceId, name, ex.ToString())); } }
public IEnumerable <SparqlResult> spoGraphs(ObjectVariants subjectNode, ObjectVariants predicateNode, ObjectVariants objectNode, SparqlResult variablesBindings, DataSet graphs) { if (graphs.Any(g => store.NamedGraphs.Contains(subjectNode, predicateNode, objectNode, g))) { yield return(variablesBindings); } }
public virtual Guid AddNegativeValue(DateTime dt, Pecuniam amount, IVoca note = null, ITransactionId trace = null) { if (amount == null) { return(Guid.Empty); } if (amount == Pecuniam.Zero) { return(Guid.Empty); } while (DataSet.Any(x => DateTime.Compare(x.AtTime, dt) == 0)) { dt = dt.AddTicks(1L); } return(Transaction.AddTransaction(DataSet, dt, amount.GetNeg(), note, trace)); }
private IEnumerable <ListData> FormData() { dpMain.Visible = DataSet.Any(); IsDataEmpty = !DataSet.Any(); SetPageColSpan(); IEnumerable <ListData> data = Enumerable.Empty <ListData>(); if (CanOrder) { data = DataSet.OrderBy(d => ((CRM.Code.Utils.Ordering.ListOrderItem)d).OrderNo).Select(a => new ListData(a)); } else { data = DataSet.Select(a => new ListData(a)); } return(data); }
public bool Any(Expression <Func <T, bool> > expression) { return(DataSet.Any(expression)); }
public bool Exists(int id) { return(DataSet.Any(e => e.Id == id)); }
private IEnumerable<IGrouping<ObjectVariants, Triple<ObjectVariants,ObjectVariants,ObjectVariants>>> SPoCacheGraphs(ObjectVariants objectNode, DataSet variableDataSet) { if (variableDataSet.Any()) if (SPoGCache.Contains(objectNode)) return SPoGCache.Get(objectNode); else { var result = store.NamedGraphs.GetTriplesWithObjectFromGraphs(objectNode, variableDataSet).ToList(); SPoGCache.Add(objectNode, result); foreach (var grouping in result) { SPogCache.Add(objectNode, grouping.Key, grouping); foreach (var tripleGroup in grouping.GroupBy(triple => triple.Subject)) { var pGroup = new Grouping<ObjectVariants, ObjectVariants>(grouping.Key, tripleGroup.Select(triple => triple.Predicate)); sPogCache.Add(tripleGroup.Key, objectNode, grouping.Key, pGroup); sPoGCache.Get(tripleGroup.Key, objectNode).Add(pGroup); foreach (var p in pGroup) { spoGCache.Get(tripleGroup.Key, p, objectNode).Add(grouping.Key); spogCache.Add(tripleGroup.Key, p, objectNode, grouping.Key, true); } } foreach (var tripleGroup in grouping.GroupBy(triple => triple.Predicate)) { var sGroup = new Grouping<ObjectVariants, ObjectVariants>(grouping.Key, tripleGroup.Select(triple => triple.Subject)); SpogCache.Add(tripleGroup.Key, objectNode, grouping.Key, sGroup); SpoGCache.Get(tripleGroup.Key, objectNode).Add(sGroup); } } return result; } var res = new List<IGrouping<ObjectVariants, Triple<ObjectVariants,ObjectVariants,ObjectVariants>>>(); var gList = new DataSet(); foreach (var g in variableDataSet) if (SPogCache.Contains(objectNode, g)) res.Add(SPogCache.Get(objectNode, g)); else gList.Add(g); foreach (var gRes in store.NamedGraphs.GetTriplesWithObjectFromGraphs(objectNode, gList)) { SPogCache.Add(objectNode, gRes.Key, gRes); res.Add(gRes); foreach (var tripleGroup in gRes.GroupBy(triple => triple.Subject)) { var pGroup = new Grouping<ObjectVariants, ObjectVariants>(gRes.Key, tripleGroup.Select(triple => triple.Predicate)); sPogCache.Add(tripleGroup.Key, objectNode, gRes.Key, pGroup); sPoGCache.Get(tripleGroup.Key, objectNode).Add(pGroup); foreach (var p in pGroup) { spoGCache.Get(tripleGroup.Key, p, objectNode).Add(gRes.Key); spogCache.Add(tripleGroup.Key, p, objectNode, gRes.Key, true); } } foreach (var tripleGroup in gRes.GroupBy(triple => triple.Predicate)) { var sGroup = new Grouping<ObjectVariants, ObjectVariants>(gRes.Key, tripleGroup.Select(triple => triple.Subject)); SpogCache.Add(tripleGroup.Key, objectNode, gRes.Key, sGroup); SpoGCache.Get(tripleGroup.Key, objectNode).Add(sGroup); } } return res; }