예제 #1
0
 private static void Connect([NotNull] GraphIsDataProperty g1, [NotNull] GraphIsDataProperty g2)
 {
     if (g1.connected == null)
     {
         if (g2.connected == null)
         {
             g1.connected = g2.connected = new HashSet <GraphIsDataProperty> {
                 g1, g2
             }
         }
     }
     ;
예제 #2
0
        internal static Func <IEnumerable <RPack>, IEnumerable <RPack> > CreateTriplet(Variable s, Variable p, Variable o, Literal d)
        {
            GraphIsDataProperty.Sync(o.graph, p.graph);
            var triplet = s.isNew
                ? (p.isNew
                    ? (o.isNew
                        ? (o.graph.IsData == null
                            ? RPackComplexExtension.CallObjectOrData(p.graph,
                                                                     RPackComplexExtension.SPO(s.index, p.index, o.index),
                                                                     RPackComplexExtension.SPD(s.index, p.index, o.index))
                            : (o.graph.IsData.Value
                                ? RPackComplexExtension.SPD(s.index, p.index, o.index)
                                : RPackComplexExtension.SPO(s.index, p.index, o.index)))
                        : (o.graph.IsData == null
                            ? RPackComplexExtension.CallObjectOrData(p.graph,
                                                                     RPackComplexExtension.SPo(s.index, p.index, o.pacElement),
                                                                     RPackComplexExtension.SPd(s.index, p.index, d))
                            : (o.graph.IsData.Value
                                ? RPackComplexExtension.SPd(s.index, p.index, d)
                                : RPackComplexExtension.SPo(s.index, p.index, o.pacElement))))
                    : (o.isNew
                        ? (o.graph.IsData == null
                            ? RPackComplexExtension.CallObjectOrData(p.graph,
                                                                     RPackComplexExtension.SpO(s.index, p.pacElement, o.index),
                                                                     RPackComplexExtension.SpD(s.index, p.pacElement, o.index))
                            : (o.graph.IsData.Value
                                ? RPackComplexExtension.SpD(s.index, p.pacElement, o.index)
                                : RPackComplexExtension.SpO(s.index, p.pacElement, o.index)))
                        : (o.graph.IsData == null
                            ? RPackComplexExtension.CallObjectOrData(p.graph,
                                                                     RPackComplexExtension.Spo(s.index, p.pacElement, o.pacElement),
                                                                     RPackComplexExtension.Spd(s.index, p.pacElement, d))
                            : (o.graph.IsData.Value
                                ? RPackComplexExtension.Spd(s.index, p.pacElement, d)
                                : RPackComplexExtension.Spo(s.index, p.pacElement, o.pacElement)))))
                : (p.isNew
                    ? (o.isNew
                        ? (o.graph.IsData == null
                            ? RPackComplexExtension.CallObjectAndData(
                               RPackComplexExtension.sPO(s.pacElement, p.index, o.index, p.graph),
                               RPackComplexExtension.sPD(s.pacElement, p.index, o.index, p.graph))
                            : (o.graph.IsData.Value
                                ? RPackComplexExtension.sPD(s.pacElement, p.index, o.index, p.graph)
                                : RPackComplexExtension.sPO(s.pacElement, p.index, o.index, p.graph)))
                        : (o.graph.IsData == null
                            ? RPackComplexExtension.CallObjectOrData(p.graph,
                                                                     RPackComplexExtension.sPo(s.pacElement, p.index, o.index),
                                                                     RPackComplexExtension.sPd(s.pacElement, p.index, d))
                            : (o.graph.IsData.Value
                                ? RPackComplexExtension.sPd(s.pacElement, p.index, d)
                                : RPackComplexExtension.sPo(s.pacElement, p.index, o.pacElement))))
                    : (o.isNew
                        ? (o.graph.IsData == null
                            ? RPackComplexExtension.CallObjectOrData(p.graph,
                                                                     RPackComplexExtension.spO(s.pacElement, p.pacElement, o.index),
                                                                     RPackComplexExtension.spD(s.pacElement, p.pacElement, o.index))
                            : (o.graph.IsData.Value
                                ? RPackComplexExtension.spD(s.pacElement, p.pacElement, o.index)
                                : RPackComplexExtension.spO(s.pacElement, p.pacElement, o.index)))
                        : (o.graph.IsData == null
                            ? RPackComplexExtension.CallObjectOrData(p.graph,
                                                                     RPackComplexExtension.spo(s.pacElement, p.pacElement, o.pacElement),
                                                                     RPackComplexExtension.spd(s.pacElement, p.pacElement, d))
                            : (o.graph.IsData.Value
                                ? RPackComplexExtension.spd(s.pacElement, p.pacElement, d)
                                : RPackComplexExtension.spo(s.pacElement, p.pacElement, o.pacElement)))));

            s.isNew = p.isNew = o.isNew = false;
            return(triplet);
        }
 internal static Func <IEnumerable <RPack>, IEnumerable <RPack> > sPD(object sEntityCode, short pParamIndex, short oParamIndex, GraphIsDataProperty graph)
 {
     return(pack => pack.SelectMany(pk => pk.Store
                                    .GetDataBySubj(pk.GetE(sEntityCode))
                                    .Select(po =>
     {
         pk.Set(pParamIndex, po.Value);
         pk.Set(oParamIndex, po.Key);
         if (graph.IsData == null || !graph.IsData.Value)
         {
             graph.ReSet(po.Key.vid);
         }
         return new RPack(pk.row, pk.Store);
     })));
 }
 private static IEnumerable <RPack> CallObjectOrDataRunOnSingle(IEnumerable <RPack> before, GraphIsDataProperty pGraph, Func <IEnumerable <RPack>, IEnumerable <RPack> > oCall, Func <IEnumerable <RPack>, IEnumerable <RPack> > dCall)
 {
     foreach (var oCallRPac in oCall(before))
     {
         if (pGraph.IsData == null)
         {
             pGraph.Set(false);
         }
         yield return(oCallRPac);
     }
     if (pGraph.IsData != null && !pGraph.IsData.Value)
     {
         yield break;                                                // yield break;
     }
     foreach (var dCallRPac in dCall(before))
     {
         if (pGraph.IsData == null)
         {
             pGraph.Set(true);
         }
         yield return(dCallRPac);
     }
 }
 internal static Func <IEnumerable <RPack>, IEnumerable <RPack> > CallObjectOrData(GraphIsDataProperty pGraph, Func <IEnumerable <RPack>, IEnumerable <RPack> > oCall, Func <IEnumerable <RPack>, IEnumerable <RPack> > dCall)
 {
     return(pack => pGraph.IsData != null
         ? (pGraph.IsData.Value ? dCall(pack) : oCall(pack))
         : pack.Select(rPackInt => Enumerable.Repeat(rPackInt, 1))
            .SelectMany(before => CallObjectOrDataRunOnSingle(before, pGraph, oCall, dCall)));;
 }