Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
C# Linq Sublevel Filtering - Only return 1st-level with matching 2nd-level items, but resultset only contains matching 2nd-level items; more "practical" example with Order/LineItem relationship
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Playground.Tests {
public class OrderSubsetTests {
#region -------------- classes ----------------
public interface IItem {
long ID { get; set; }
string Name { get; set; }
string ReferenceKey { get; set; }
}
public class BasicItem : IItem {
public virtual long ID { get; set; }
public virtual string Name { get; set; }
public virtual string ReferenceKey { get; set; }
public string ToString(string typeName) {
return string.Format("{0}[I:{1}, N:{2}, Ref:{3}]"
, typeName // this.GetType().Name
, this.ID
, this.Name
, this.ReferenceKey
);
}
}
public class Order : BasicItem, IItem {
public Order() {
this.LineItems = new List<LineItem>();
}
public virtual Customer Customer { get; set; }
public virtual ICollection<LineItem> LineItems { get; set; }
public virtual Source Source { get; set; }
public string ToString(bool withChildren = true, bool withPropertyType = true, int depth = 0) {
return string.Format(@"({0}
{3}{4}
{3}{1}
{3}{2})"
, base.ToString(this.GetType().Name)
, withPropertyType ? this.Customer.ToString() : "<prop-ignored>"
, withChildren ? string.Join(@",
" + new string('\t', depth), this.LineItems.Select(o => o.ToString(withParent: false))) : "<children-ignored>"
, new string('\t', depth)
, this.Source
);
}
}
public class LineItem : BasicItem, IItem {
public void AttachTo(Order item) {
this.Order = item;
this.OrderID = item.ID;
// reverse attach
item.LineItems.Add(this);
}
public void AttachTo(Address item) {
this.Address = item;
this.AddressID = item.ID;
// reverse attach
item.LineItem = this;
item.LineItemID = this.ID;
}
public virtual Order Order { get; set; }
public long OrderID { get; set; }
public virtual Address Address { get; set; }
public long AddressID { get; set; }
public string ToString(bool withParent = false, bool withChildren = true) {
return string.Format(@"({0} {1})"
, base.ToString(this.GetType().Name)
, withChildren ? this.Address.ToString() : "<children-ignored>"
);
}
}
public class Customer : BasicItem, IItem {
public override string ToString() {
return base.ToString(this.GetType().Name);
}
}
public class Source {
public string Name { get; set; }
public override string ToString() {
return string.Format("Source[{0}]", this.Name);
}
}
private static Regex alphanumeric = new Regex("[^a-zA-Z0-9]*", RegexOptions.Compiled);
public class Address : BasicItem, IItem {
public override string Name { get { return this._Name; } set { this._Name = value; this._updateHash(); } }
public string City { get { return this.ReferenceKey; } set { this.ReferenceKey = value; this._updateHash(); } }
/// <summary>
/// Don't use this, use <see cref="City"/> instead
/// </summary>
private string _Name;
private void _updateHash() {
this.Hash = string.Format("{0}##{1}"
, alphanumeric.Replace(this.Name ?? string.Empty, string.Empty)
, alphanumeric.Replace(this.City ?? string.Empty, string.Empty)
);
}
public string Hash { get; private set; }
public virtual LineItem LineItem { get; set; }
public long LineItemID { get; set; }
public void AttachTo(LineItem item) {
this.LineItem = item;
this.LineItemID = item.ID;
// reverse attach
item.Address = this;
item.AddressID = this.ID;
}
public override string ToString() {
return string.Format("Addr[I:{0}, N:{1}, City:{2}]"
, this.ID
, this.Name
, this.ReferenceKey
);
}
}
protected static Random Rand = new Random();
protected const int MIN_VALUE = 1;
protected const int MAX_VALUE = 3;
#region -------------- container ----------------
public class WorkitemSessionTransport : BasicItem, IItem {
public virtual Customer Customer { get; set; }
public virtual ICollection<Order> Workitems { get; set; }
public override string ToString() {
return string.Format(@"-- WorkitemSession({0}
{1};
{2})"
, base.ToString(this.GetType().Name)
, this.Customer
, string.Join(@",
", this.Workitems.Select(o => o.ToString(withPropertyType: false, depth: 1)))
);
}
}
#endregion -------------- container ----------------
#endregion -------------- classes ----------------
/// <summary>
/// for calculating "guid"
/// </summary>
private static int guid_counter = 1;
/// <summary>
/// For reusing customers
/// </summary>
private static List<Customer> CustomerList;
/// <summary>
/// For reusing sources
/// </summary>
private static List<Source> SourceList;
/// <summary>
/// Randomized Foo list
/// </summary>
/// <param name="size"></param>
/// <returns></returns>
protected static List<Order> MakeOrderList(int size, bool reuseCustomers = true) {
var results = new List<Order>();
while (size-- > 0) {
var newitem = new Order {
ID = guid_counter++
, ReferenceKey = Rand.Next(MIN_VALUE, MAX_VALUE).ToString()
, Name = string.Format("Order_{0}", size)
, Customer = reuseCustomers ? GetRandomCustomer() : MakeCustomer()
, Source = reuseCustomers ? GetRandomSource() : MakeSource()
};
// recursive attach
MakeLineItemList(Rand.Next(2, 5), newitem);
results.Add(newitem);
}
return results;
}
/// <summary>
/// Randomized Bar list
/// </summary>
/// <param name="size"></param>
/// <returns></returns>
protected static List<LineItem> MakeLineItemList(int size, Order parent) {
var results = new List<LineItem>();
while (size-- > 0) {
var newitem = new LineItem {
ID = guid_counter++,
ReferenceKey = Rand.Next(MIN_VALUE, MAX_VALUE).ToString(),
Name = string.Format("LineItem_{0}", size)
};
// recursive attach
newitem.AttachTo(parent);
newitem.AttachTo(MakeAddress());
results.Add(newitem);
}
return results;
}
protected static Address MakeAddress() {
return new Address {
ID = guid_counter++,
City = Rand.Next(MIN_VALUE, MAX_VALUE).ToString(),
Name = string.Format("Address_{0}", Rand.Next(MIN_VALUE, MAX_VALUE))
};
}
protected static Customer MakeCustomer() {
return new Customer {
ID = guid_counter++,
ReferenceKey = Rand.Next(MIN_VALUE, MAX_VALUE).ToString(),
Name = string.Format("Customer_{0}", Rand.Next(MIN_VALUE, MAX_VALUE))
};
}
/// <summary>
/// Get a random customer from the existing list
/// </summary>
/// <returns></returns>
protected static Customer GetRandomCustomer() {
return CustomerList[Rand.Next(0, CustomerList.Count - 1)];
}
/// <summary>
/// Create list of random customers
/// </summary>
/// <param name="size"></param>
/// <returns></returns>
protected static int InitCustomerList(int size) {
// start with new bucket
if (null == CustomerList)
CustomerList = new List<Customer>();
else
CustomerList.Clear();
while (size-- > 0) {
CustomerList.Add( MakeCustomer() );
}
return CustomerList.Count;
}
protected static Source MakeSource() {
return new Source {
Name = new string((char)(Rand.Next(0, 25) + 65), Rand.Next(5, 10))
};
}
/// <summary>
/// Get a random customer from the existing list
/// </summary>
/// <returns></returns>
protected static Source GetRandomSource() {
return SourceList[Rand.Next(0, SourceList.Count - 1)];
}
/// <summary>
/// Create list of random sources
/// </summary>
/// <param name="size"></param>
/// <returns></returns>
protected static int InitSourceList(int size) {
// start with new bucket
if (null == SourceList)
SourceList = new List<Source>();
else
SourceList.Clear();
while (size-- > 0) {
SourceList.Add( MakeSource() );
}
return SourceList.Count;
}
/// <summary>
/// Filter on filterable column
/// </summary>
/// <param name="filter"></param>
public static void GetForSubset() {
var numCustomers = 3;
InitCustomerList(numCustomers);
InitSourceList(numCustomers*10);
var filter = Rand.Next(MIN_VALUE, MAX_VALUE).ToString();
var orders = MakeOrderList(numCustomers * 2); // more orders than customers will hopefully reuse at least one customer
// debug output to review
orders.ForEach(o => Program.Out(o.ToString()));
Program.Out("==== Filtering on {0} ====", filter);
var filtered1 = orders.Where(o => o.ReferenceKey == filter).ToList();
// debug output to review
Program.Out("==== Filtered on Order ====");
filtered1.ForEach(o => Program.Out(o.ToString()));
var filtered2 = orders.Where(o => o.LineItems.Any(o2 => o2.ReferenceKey == filter)).ToList();
// debug output to review
Program.Out("==== Filtered Order on LineItem ====");
filtered2.ForEach(o => Program.Out(o.ToString()));
FilterOrderForLineItems(filter, orders);
FilterWorkitemSessions(filter, orders);
}
private static void FilterOrderForLineItems(string filter, List<Order> orders) {
var filtered = orders
/* "table" of Order */.SelectMany(o => o.LineItems)
/* simulated table of LineItem */.Where(o => o.ReferenceKey == filter)
/* only matching items */.GroupBy(o => new { o.Order, o.Address.Hash })
/* grouped by top-level */.Select(o =>
// reconstruct top level
new Order {
ID = o.Key.Order.ID,
ReferenceKey = o.Key.Order.ReferenceKey,
Name = o.Key.Order.Name,
Customer = o.Key.Order.Customer,
// filter sublevel
LineItems = o.Where(o2 => o2.ReferenceKey == filter).ToList()
}).ToList();
// debug output to review
Program.Out("==== Filtered Order for LineItem ====");
filtered.ForEach(o => Program.Out(o.ToString()));
}
private static void FilterWorkitemSessions(string filter, List<Order> orders) {
var filtered = orders
/* "table" of Order */.SelectMany(o => o.LineItems)
/* simulated table of LineItem */.Where(o => o.ReferenceKey == filter)
/* only matching items */.GroupBy(o => o.Order.Customer)
/* grouped by arbitrary top-level property */.Select(g1 => new WorkitemSessionTransport {
Customer = g1.Key,
Name = string.Format("WorkitemSession_{0}", guid_counter),
ID = guid_counter++,
ReferenceKey = string.Join("-", g1.Select(o => o.Order.ReferenceKey)),
Workitems = g1.GroupBy(o => new { o.Order, o.Address.Hash })
/* grouped by top-level */.Select(o =>
// reconstruct top level
new Order {
ID = o.Key.Order.ID,
ReferenceKey = o.Key.Order.ReferenceKey,
Name = o.Key.Order.Name,
Customer = o.Key.Order.Customer,
Source = o.Key.Order.Source,
// filter sublevel
LineItems = o.Where(o2 => o2.ReferenceKey == filter).ToList()
}).ToList()
})
.ToList();
// debug output to review
Program.Out("==== Filtered WorkitemSessions for LineItem ====");
filtered.ForEach(o => Program.Out(o.ToString()));
}
}
}
============== SAMPLE RESULTS ====================
(Order[I:4, N:Order_5, Ref:2]
Customer[I:2, N:Customer_2, Ref:1]
(LineItem[I:5, N:LineItem_2, Ref:1] Addr[I:6, N:Address_1, City:1]),
(LineItem[I:7, N:LineItem_1, Ref:2] Addr[I:8, N:Address_1, City:2]),
(LineItem[I:9, N:LineItem_0, Ref:2] Addr[I:10, N:Address_1, City:2]))
(Order[I:11, N:Order_4, Ref:1]
Customer[I:1, N:Customer_2, Ref:2]
(LineItem[I:12, N:LineItem_2, Ref:1] Addr[I:13, N:Address_1, City:2]),
(LineItem[I:14, N:LineItem_1, Ref:1] Addr[I:15, N:Address_2, City:2]),
(LineItem[I:16, N:LineItem_0, Ref:2] Addr[I:17, N:Address_2, City:2]))
(Order[I:18, N:Order_3, Ref:2]
Customer[I:1, N:Customer_2, Ref:2]
(LineItem[I:19, N:LineItem_3, Ref:2] Addr[I:20, N:Address_1, City:1]),
(LineItem[I:21, N:LineItem_2, Ref:1] Addr[I:22, N:Address_1, City:2]),
(LineItem[I:23, N:LineItem_1, Ref:2] Addr[I:24, N:Address_2, City:2]),
(LineItem[I:25, N:LineItem_0, Ref:1] Addr[I:26, N:Address_2, City:1]))
(Order[I:27, N:Order_2, Ref:2]
Customer[I:1, N:Customer_2, Ref:2]
(LineItem[I:28, N:LineItem_3, Ref:1] Addr[I:29, N:Address_2, City:1]),
(LineItem[I:30, N:LineItem_2, Ref:1] Addr[I:31, N:Address_1, City:1]),
(LineItem[I:32, N:LineItem_1, Ref:1] Addr[I:33, N:Address_2, City:1]),
(LineItem[I:34, N:LineItem_0, Ref:1] Addr[I:35, N:Address_2, City:2]))
(Order[I:36, N:Order_1, Ref:2]
Customer[I:1, N:Customer_2, Ref:2]
(LineItem[I:37, N:LineItem_1, Ref:2] Addr[I:38, N:Address_2, City:2]),
(LineItem[I:39, N:LineItem_0, Ref:1] Addr[I:40, N:Address_1, City:1]))
(Order[I:41, N:Order_0, Ref:1]
Customer[I:1, N:Customer_2, Ref:2]
(LineItem[I:42, N:LineItem_1, Ref:1] Addr[I:43, N:Address_2, City:2]),
(LineItem[I:44, N:LineItem_0, Ref:2] Addr[I:45, N:Address_2, City:1]))
==== Filtering on 2 ====
==== Filtered on Order ====
(Order[I:4, N:Order_5, Ref:2]
Customer[I:2, N:Customer_2, Ref:1]
(LineItem[I:5, N:LineItem_2, Ref:1] Addr[I:6, N:Address_1, City:1]),
(LineItem[I:7, N:LineItem_1, Ref:2] Addr[I:8, N:Address_1, City:2]),
(LineItem[I:9, N:LineItem_0, Ref:2] Addr[I:10, N:Address_1, City:2]))
(Order[I:18, N:Order_3, Ref:2]
Customer[I:1, N:Customer_2, Ref:2]
(LineItem[I:19, N:LineItem_3, Ref:2] Addr[I:20, N:Address_1, City:1]),
(LineItem[I:21, N:LineItem_2, Ref:1] Addr[I:22, N:Address_1, City:2]),
(LineItem[I:23, N:LineItem_1, Ref:2] Addr[I:24, N:Address_2, City:2]),
(LineItem[I:25, N:LineItem_0, Ref:1] Addr[I:26, N:Address_2, City:1]))
(Order[I:27, N:Order_2, Ref:2]
Customer[I:1, N:Customer_2, Ref:2]
(LineItem[I:28, N:LineItem_3, Ref:1] Addr[I:29, N:Address_2, City:1]),
(LineItem[I:30, N:LineItem_2, Ref:1] Addr[I:31, N:Address_1, City:1]),
(LineItem[I:32, N:LineItem_1, Ref:1] Addr[I:33, N:Address_2, City:1]),
(LineItem[I:34, N:LineItem_0, Ref:1] Addr[I:35, N:Address_2, City:2]))
(Order[I:36, N:Order_1, Ref:2]
Customer[I:1, N:Customer_2, Ref:2]
(LineItem[I:37, N:LineItem_1, Ref:2] Addr[I:38, N:Address_2, City:2]),
(LineItem[I:39, N:LineItem_0, Ref:1] Addr[I:40, N:Address_1, City:1]))
==== Filtered Order on LineItem ====
(Order[I:4, N:Order_5, Ref:2]
Customer[I:2, N:Customer_2, Ref:1]
(LineItem[I:5, N:LineItem_2, Ref:1] Addr[I:6, N:Address_1, City:1]),
(LineItem[I:7, N:LineItem_1, Ref:2] Addr[I:8, N:Address_1, City:2]),
(LineItem[I:9, N:LineItem_0, Ref:2] Addr[I:10, N:Address_1, City:2]))
(Order[I:11, N:Order_4, Ref:1]
Customer[I:1, N:Customer_2, Ref:2]
(LineItem[I:12, N:LineItem_2, Ref:1] Addr[I:13, N:Address_1, City:2]),
(LineItem[I:14, N:LineItem_1, Ref:1] Addr[I:15, N:Address_2, City:2]),
(LineItem[I:16, N:LineItem_0, Ref:2] Addr[I:17, N:Address_2, City:2]))
(Order[I:18, N:Order_3, Ref:2]
Customer[I:1, N:Customer_2, Ref:2]
(LineItem[I:19, N:LineItem_3, Ref:2] Addr[I:20, N:Address_1, City:1]),
(LineItem[I:21, N:LineItem_2, Ref:1] Addr[I:22, N:Address_1, City:2]),
(LineItem[I:23, N:LineItem_1, Ref:2] Addr[I:24, N:Address_2, City:2]),
(LineItem[I:25, N:LineItem_0, Ref:1] Addr[I:26, N:Address_2, City:1]))
(Order[I:36, N:Order_1, Ref:2]
Customer[I:1, N:Customer_2, Ref:2]
(LineItem[I:37, N:LineItem_1, Ref:2] Addr[I:38, N:Address_2, City:2]),
(LineItem[I:39, N:LineItem_0, Ref:1] Addr[I:40, N:Address_1, City:1]))
(Order[I:41, N:Order_0, Ref:1]
Customer[I:1, N:Customer_2, Ref:2]
(LineItem[I:42, N:LineItem_1, Ref:1] Addr[I:43, N:Address_2, City:2]),
(LineItem[I:44, N:LineItem_0, Ref:2] Addr[I:45, N:Address_2, City:1]))
==== Filtered Order for LineItem ====
(Order[I:4, N:Order_5, Ref:2]
Customer[I:2, N:Customer_2, Ref:1]
(LineItem[I:7, N:LineItem_1, Ref:2] Addr[I:8, N:Address_1, City:2]),
(LineItem[I:9, N:LineItem_0, Ref:2] Addr[I:10, N:Address_1, City:2]))
(Order[I:11, N:Order_4, Ref:1]
Customer[I:1, N:Customer_2, Ref:2]
(LineItem[I:16, N:LineItem_0, Ref:2] Addr[I:17, N:Address_2, City:2]))
(Order[I:18, N:Order_3, Ref:2]
Customer[I:1, N:Customer_2, Ref:2]
(LineItem[I:19, N:LineItem_3, Ref:2] Addr[I:20, N:Address_1, City:1]))
(Order[I:18, N:Order_3, Ref:2]
Customer[I:1, N:Customer_2, Ref:2]
(LineItem[I:23, N:LineItem_1, Ref:2] Addr[I:24, N:Address_2, City:2]))
(Order[I:36, N:Order_1, Ref:2]
Customer[I:1, N:Customer_2, Ref:2]
(LineItem[I:37, N:LineItem_1, Ref:2] Addr[I:38, N:Address_2, City:2]))
(Order[I:41, N:Order_0, Ref:1]
Customer[I:1, N:Customer_2, Ref:2]
(LineItem[I:44, N:LineItem_0, Ref:2] Addr[I:45, N:Address_2, City:1]))
==== Filtered WorkitemSessions for LineItem ====
-- WorkitemSession(WorkitemSessionTransport[I:46, N:WorkitemSession_46, Ref:2-2]
Customer[I:2, N:Customer_2, Ref:1];
(Order[I:4, N:Order_5, Ref:2]
<prop-ignored>
(LineItem[I:7, N:LineItem_1, Ref:2] Addr[I:8, N:Address_1, City:2]),
(LineItem[I:9, N:LineItem_0, Ref:2] Addr[I:10, N:Address_1, City:2])))
-- WorkitemSession(WorkitemSessionTransport[I:47, N:WorkitemSession_47, Ref:1-2-2-2-1]
Customer[I:1, N:Customer_2, Ref:2];
(Order[I:11, N:Order_4, Ref:1]
<prop-ignored>
(LineItem[I:16, N:LineItem_0, Ref:2] Addr[I:17, N:Address_2, City:2])),
(Order[I:18, N:Order_3, Ref:2]
<prop-ignored>
(LineItem[I:19, N:LineItem_3, Ref:2] Addr[I:20, N:Address_1, City:1])),
(Order[I:18, N:Order_3, Ref:2]
<prop-ignored>
(LineItem[I:23, N:LineItem_1, Ref:2] Addr[I:24, N:Address_2, City:2])),
(Order[I:36, N:Order_1, Ref:2]
<prop-ignored>
(LineItem[I:37, N:LineItem_1, Ref:2] Addr[I:38, N:Address_2, City:2])),
(Order[I:41, N:Order_0, Ref:1]
<prop-ignored>
(LineItem[I:44, N:LineItem_0, Ref:2] Addr[I:45, N:Address_2, City:1])))
--------------
(Press any key to continue)
============== SAMPLE RESULTS ====================
(Order[I:4, N:Order_5, Ref:2]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:5, N:LineItem_2, Ref:2] Addr[I:6, N:Address_1, City:2]),
(LineItem[I:7, N:LineItem_1, Ref:1] Addr[I:8, N:Address_1, City:2]),
(LineItem[I:9, N:LineItem_0, Ref:2] Addr[I:10, N:Address_2, City:1]))
(Order[I:11, N:Order_4, Ref:2]
Customer[I:2, N:Customer_1, Ref:2]
(LineItem[I:12, N:LineItem_3, Ref:2] Addr[I:13, N:Address_1, City:2]),
(LineItem[I:14, N:LineItem_2, Ref:2] Addr[I:15, N:Address_1, City:1]),
(LineItem[I:16, N:LineItem_1, Ref:1] Addr[I:17, N:Address_1, City:1]),
(LineItem[I:18, N:LineItem_0, Ref:1] Addr[I:19, N:Address_2, City:1]))
(Order[I:20, N:Order_3, Ref:1]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:21, N:LineItem_1, Ref:1] Addr[I:22, N:Address_2, City:2]),
(LineItem[I:23, N:LineItem_0, Ref:1] Addr[I:24, N:Address_2, City:2]))
(Order[I:25, N:Order_2, Ref:1]
Customer[I:2, N:Customer_1, Ref:2]
(LineItem[I:26, N:LineItem_3, Ref:2] Addr[I:27, N:Address_1, City:2]),
(LineItem[I:28, N:LineItem_2, Ref:1] Addr[I:29, N:Address_2, City:1]),
(LineItem[I:30, N:LineItem_1, Ref:2] Addr[I:31, N:Address_1, City:1]),
(LineItem[I:32, N:LineItem_0, Ref:1] Addr[I:33, N:Address_1, City:1]))
(Order[I:34, N:Order_1, Ref:1]
Customer[I:2, N:Customer_1, Ref:2]
(LineItem[I:35, N:LineItem_2, Ref:2] Addr[I:36, N:Address_1, City:1]),
(LineItem[I:37, N:LineItem_1, Ref:1] Addr[I:38, N:Address_2, City:2]),
(LineItem[I:39, N:LineItem_0, Ref:2] Addr[I:40, N:Address_1, City:2]))
(Order[I:41, N:Order_0, Ref:2]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:42, N:LineItem_1, Ref:2] Addr[I:43, N:Address_2, City:1]),
(LineItem[I:44, N:LineItem_0, Ref:1] Addr[I:45, N:Address_2, City:1]))
==== Filtering on 1 ====
==== Filtered on Order ====
(Order[I:20, N:Order_3, Ref:1]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:21, N:LineItem_1, Ref:1] Addr[I:22, N:Address_2, City:2]),
(LineItem[I:23, N:LineItem_0, Ref:1] Addr[I:24, N:Address_2, City:2]))
(Order[I:25, N:Order_2, Ref:1]
Customer[I:2, N:Customer_1, Ref:2]
(LineItem[I:26, N:LineItem_3, Ref:2] Addr[I:27, N:Address_1, City:2]),
(LineItem[I:28, N:LineItem_2, Ref:1] Addr[I:29, N:Address_2, City:1]),
(LineItem[I:30, N:LineItem_1, Ref:2] Addr[I:31, N:Address_1, City:1]),
(LineItem[I:32, N:LineItem_0, Ref:1] Addr[I:33, N:Address_1, City:1]))
(Order[I:34, N:Order_1, Ref:1]
Customer[I:2, N:Customer_1, Ref:2]
(LineItem[I:35, N:LineItem_2, Ref:2] Addr[I:36, N:Address_1, City:1]),
(LineItem[I:37, N:LineItem_1, Ref:1] Addr[I:38, N:Address_2, City:2]),
(LineItem[I:39, N:LineItem_0, Ref:2] Addr[I:40, N:Address_1, City:2]))
==== Filtered Order on LineItem ====
(Order[I:4, N:Order_5, Ref:2]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:5, N:LineItem_2, Ref:2] Addr[I:6, N:Address_1, City:2]),
(LineItem[I:7, N:LineItem_1, Ref:1] Addr[I:8, N:Address_1, City:2]),
(LineItem[I:9, N:LineItem_0, Ref:2] Addr[I:10, N:Address_2, City:1]))
(Order[I:11, N:Order_4, Ref:2]
Customer[I:2, N:Customer_1, Ref:2]
(LineItem[I:12, N:LineItem_3, Ref:2] Addr[I:13, N:Address_1, City:2]),
(LineItem[I:14, N:LineItem_2, Ref:2] Addr[I:15, N:Address_1, City:1]),
(LineItem[I:16, N:LineItem_1, Ref:1] Addr[I:17, N:Address_1, City:1]),
(LineItem[I:18, N:LineItem_0, Ref:1] Addr[I:19, N:Address_2, City:1]))
(Order[I:20, N:Order_3, Ref:1]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:21, N:LineItem_1, Ref:1] Addr[I:22, N:Address_2, City:2]),
(LineItem[I:23, N:LineItem_0, Ref:1] Addr[I:24, N:Address_2, City:2]))
(Order[I:25, N:Order_2, Ref:1]
Customer[I:2, N:Customer_1, Ref:2]
(LineItem[I:26, N:LineItem_3, Ref:2] Addr[I:27, N:Address_1, City:2]),
(LineItem[I:28, N:LineItem_2, Ref:1] Addr[I:29, N:Address_2, City:1]),
(LineItem[I:30, N:LineItem_1, Ref:2] Addr[I:31, N:Address_1, City:1]),
(LineItem[I:32, N:LineItem_0, Ref:1] Addr[I:33, N:Address_1, City:1]))
(Order[I:34, N:Order_1, Ref:1]
Customer[I:2, N:Customer_1, Ref:2]
(LineItem[I:35, N:LineItem_2, Ref:2] Addr[I:36, N:Address_1, City:1]),
(LineItem[I:37, N:LineItem_1, Ref:1] Addr[I:38, N:Address_2, City:2]),
(LineItem[I:39, N:LineItem_0, Ref:2] Addr[I:40, N:Address_1, City:2]))
(Order[I:41, N:Order_0, Ref:2]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:42, N:LineItem_1, Ref:2] Addr[I:43, N:Address_2, City:1]),
(LineItem[I:44, N:LineItem_0, Ref:1] Addr[I:45, N:Address_2, City:1]))
==== Filtered Order for LineItem ====
(Order[I:4, N:Order_5, Ref:2]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:7, N:LineItem_1, Ref:1] Addr[I:8, N:Address_1, City:2]))
(Order[I:11, N:Order_4, Ref:2]
Customer[I:2, N:Customer_1, Ref:2]
(LineItem[I:16, N:LineItem_1, Ref:1] Addr[I:17, N:Address_1, City:1]))
(Order[I:11, N:Order_4, Ref:2]
Customer[I:2, N:Customer_1, Ref:2]
(LineItem[I:18, N:LineItem_0, Ref:1] Addr[I:19, N:Address_2, City:1]))
(Order[I:20, N:Order_3, Ref:1]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:21, N:LineItem_1, Ref:1] Addr[I:22, N:Address_2, City:2]),
(LineItem[I:23, N:LineItem_0, Ref:1] Addr[I:24, N:Address_2, City:2]))
(Order[I:25, N:Order_2, Ref:1]
Customer[I:2, N:Customer_1, Ref:2]
(LineItem[I:28, N:LineItem_2, Ref:1] Addr[I:29, N:Address_2, City:1]))
(Order[I:25, N:Order_2, Ref:1]
Customer[I:2, N:Customer_1, Ref:2]
(LineItem[I:32, N:LineItem_0, Ref:1] Addr[I:33, N:Address_1, City:1]))
(Order[I:34, N:Order_1, Ref:1]
Customer[I:2, N:Customer_1, Ref:2]
(LineItem[I:37, N:LineItem_1, Ref:1] Addr[I:38, N:Address_2, City:2]))
(Order[I:41, N:Order_0, Ref:2]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:44, N:LineItem_0, Ref:1] Addr[I:45, N:Address_2, City:1]))
==== Filtered WorkitemSessions for LineItem ====
-- WorkitemSession(WorkitemSessionTransport[I:46, N:WorkitemSession_46, Ref:2-1-1-2]
Customer[I:1, N:Customer_1, Ref:1];
(Order[I:4, N:Order_5, Ref:2]
<prop-ignored>
(LineItem[I:7, N:LineItem_1, Ref:1] Addr[I:8, N:Address_1, City:2])),
(Order[I:20, N:Order_3, Ref:1]
<prop-ignored>
(LineItem[I:21, N:LineItem_1, Ref:1] Addr[I:22, N:Address_2, City:2]),
(LineItem[I:23, N:LineItem_0, Ref:1] Addr[I:24, N:Address_2, City:2])),
(Order[I:41, N:Order_0, Ref:2]
<prop-ignored>
(LineItem[I:44, N:LineItem_0, Ref:1] Addr[I:45, N:Address_2, City:1])))
-- WorkitemSession(WorkitemSessionTransport[I:47, N:WorkitemSession_47, Ref:2-2-1-1-1]
Customer[I:2, N:Customer_1, Ref:2];
(Order[I:11, N:Order_4, Ref:2]
<prop-ignored>
(LineItem[I:16, N:LineItem_1, Ref:1] Addr[I:17, N:Address_1, City:1])),
(Order[I:11, N:Order_4, Ref:2]
<prop-ignored>
(LineItem[I:18, N:LineItem_0, Ref:1] Addr[I:19, N:Address_2, City:1])),
(Order[I:25, N:Order_2, Ref:1]
<prop-ignored>
(LineItem[I:28, N:LineItem_2, Ref:1] Addr[I:29, N:Address_2, City:1])),
(Order[I:25, N:Order_2, Ref:1]
<prop-ignored>
(LineItem[I:32, N:LineItem_0, Ref:1] Addr[I:33, N:Address_1, City:1])),
(Order[I:34, N:Order_1, Ref:1]
<prop-ignored>
(LineItem[I:37, N:LineItem_1, Ref:1] Addr[I:38, N:Address_2, City:2])))
--------------
(Press any key to continue)
(Order[I:4, N:Order_5, Ref:2]
Source[SSSSS]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:5, N:LineItem_2, Ref:1] Addr[I:6, N:Address_1, City:1]),
(LineItem[I:7, N:LineItem_1, Ref:2] Addr[I:8, N:Address_2, City:2]),
(LineItem[I:9, N:LineItem_0, Ref:2] Addr[I:10, N:Address_1, City:2]))
(Order[I:11, N:Order_4, Ref:2]
Source[AAAAA]
Customer[I:2, N:Customer_1, Ref:2]
(LineItem[I:12, N:LineItem_3, Ref:1] Addr[I:13, N:Address_1, City:2]),
(LineItem[I:14, N:LineItem_2, Ref:2] Addr[I:15, N:Address_1, City:1]),
(LineItem[I:16, N:LineItem_1, Ref:1] Addr[I:17, N:Address_1, City:1]),
(LineItem[I:18, N:LineItem_0, Ref:2] Addr[I:19, N:Address_1, City:2]))
(Order[I:20, N:Order_3, Ref:1]
Source[HHHHHHHHH]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:21, N:LineItem_2, Ref:1] Addr[I:22, N:Address_1, City:2]),
(LineItem[I:23, N:LineItem_1, Ref:2] Addr[I:24, N:Address_1, City:2]),
(LineItem[I:25, N:LineItem_0, Ref:1] Addr[I:26, N:Address_1, City:1]))
(Order[I:27, N:Order_2, Ref:1]
Source[YYYYYYY]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:28, N:LineItem_3, Ref:2] Addr[I:29, N:Address_1, City:2]),
(LineItem[I:30, N:LineItem_2, Ref:1] Addr[I:31, N:Address_2, City:1]),
(LineItem[I:32, N:LineItem_1, Ref:2] Addr[I:33, N:Address_2, City:1]),
(LineItem[I:34, N:LineItem_0, Ref:1] Addr[I:35, N:Address_2, City:1]))
(Order[I:36, N:Order_1, Ref:1]
Source[BBBBBBBBB]
Customer[I:2, N:Customer_1, Ref:2]
(LineItem[I:37, N:LineItem_1, Ref:1] Addr[I:38, N:Address_1, City:2]),
(LineItem[I:39, N:LineItem_0, Ref:1] Addr[I:40, N:Address_1, City:2]))
(Order[I:41, N:Order_0, Ref:1]
Source[RRRRRRR]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:42, N:LineItem_3, Ref:1] Addr[I:43, N:Address_2, City:1]),
(LineItem[I:44, N:LineItem_2, Ref:2] Addr[I:45, N:Address_1, City:1]),
(LineItem[I:46, N:LineItem_1, Ref:1] Addr[I:47, N:Address_1, City:1]),
(LineItem[I:48, N:LineItem_0, Ref:2] Addr[I:49, N:Address_2, City:2]))
==== Filtering on 1 ====
==== Filtered on Order ====
(Order[I:20, N:Order_3, Ref:1]
Source[HHHHHHHHH]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:21, N:LineItem_2, Ref:1] Addr[I:22, N:Address_1, City:2]),
(LineItem[I:23, N:LineItem_1, Ref:2] Addr[I:24, N:Address_1, City:2]),
(LineItem[I:25, N:LineItem_0, Ref:1] Addr[I:26, N:Address_1, City:1]))
(Order[I:27, N:Order_2, Ref:1]
Source[YYYYYYY]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:28, N:LineItem_3, Ref:2] Addr[I:29, N:Address_1, City:2]),
(LineItem[I:30, N:LineItem_2, Ref:1] Addr[I:31, N:Address_2, City:1]),
(LineItem[I:32, N:LineItem_1, Ref:2] Addr[I:33, N:Address_2, City:1]),
(LineItem[I:34, N:LineItem_0, Ref:1] Addr[I:35, N:Address_2, City:1]))
(Order[I:36, N:Order_1, Ref:1]
Source[BBBBBBBBB]
Customer[I:2, N:Customer_1, Ref:2]
(LineItem[I:37, N:LineItem_1, Ref:1] Addr[I:38, N:Address_1, City:2]),
(LineItem[I:39, N:LineItem_0, Ref:1] Addr[I:40, N:Address_1, City:2]))
(Order[I:41, N:Order_0, Ref:1]
Source[RRRRRRR]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:42, N:LineItem_3, Ref:1] Addr[I:43, N:Address_2, City:1]),
(LineItem[I:44, N:LineItem_2, Ref:2] Addr[I:45, N:Address_1, City:1]),
(LineItem[I:46, N:LineItem_1, Ref:1] Addr[I:47, N:Address_1, City:1]),
(LineItem[I:48, N:LineItem_0, Ref:2] Addr[I:49, N:Address_2, City:2]))
==== Filtered Order on LineItem ====
(Order[I:4, N:Order_5, Ref:2]
Source[SSSSS]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:5, N:LineItem_2, Ref:1] Addr[I:6, N:Address_1, City:1]),
(LineItem[I:7, N:LineItem_1, Ref:2] Addr[I:8, N:Address_2, City:2]),
(LineItem[I:9, N:LineItem_0, Ref:2] Addr[I:10, N:Address_1, City:2]))
(Order[I:11, N:Order_4, Ref:2]
Source[AAAAA]
Customer[I:2, N:Customer_1, Ref:2]
(LineItem[I:12, N:LineItem_3, Ref:1] Addr[I:13, N:Address_1, City:2]),
(LineItem[I:14, N:LineItem_2, Ref:2] Addr[I:15, N:Address_1, City:1]),
(LineItem[I:16, N:LineItem_1, Ref:1] Addr[I:17, N:Address_1, City:1]),
(LineItem[I:18, N:LineItem_0, Ref:2] Addr[I:19, N:Address_1, City:2]))
(Order[I:20, N:Order_3, Ref:1]
Source[HHHHHHHHH]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:21, N:LineItem_2, Ref:1] Addr[I:22, N:Address_1, City:2]),
(LineItem[I:23, N:LineItem_1, Ref:2] Addr[I:24, N:Address_1, City:2]),
(LineItem[I:25, N:LineItem_0, Ref:1] Addr[I:26, N:Address_1, City:1]))
(Order[I:27, N:Order_2, Ref:1]
Source[YYYYYYY]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:28, N:LineItem_3, Ref:2] Addr[I:29, N:Address_1, City:2]),
(LineItem[I:30, N:LineItem_2, Ref:1] Addr[I:31, N:Address_2, City:1]),
(LineItem[I:32, N:LineItem_1, Ref:2] Addr[I:33, N:Address_2, City:1]),
(LineItem[I:34, N:LineItem_0, Ref:1] Addr[I:35, N:Address_2, City:1]))
(Order[I:36, N:Order_1, Ref:1]
Source[BBBBBBBBB]
Customer[I:2, N:Customer_1, Ref:2]
(LineItem[I:37, N:LineItem_1, Ref:1] Addr[I:38, N:Address_1, City:2]),
(LineItem[I:39, N:LineItem_0, Ref:1] Addr[I:40, N:Address_1, City:2]))
(Order[I:41, N:Order_0, Ref:1]
Source[RRRRRRR]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:42, N:LineItem_3, Ref:1] Addr[I:43, N:Address_2, City:1]),
(LineItem[I:44, N:LineItem_2, Ref:2] Addr[I:45, N:Address_1, City:1]),
(LineItem[I:46, N:LineItem_1, Ref:1] Addr[I:47, N:Address_1, City:1]),
(LineItem[I:48, N:LineItem_0, Ref:2] Addr[I:49, N:Address_2, City:2]))
==== Filtered Order for LineItem ====
(Order[I:4, N:Order_5, Ref:2]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:5, N:LineItem_2, Ref:1] Addr[I:6, N:Address_1, City:1]))
(Order[I:11, N:Order_4, Ref:2]
Customer[I:2, N:Customer_1, Ref:2]
(LineItem[I:12, N:LineItem_3, Ref:1] Addr[I:13, N:Address_1, City:2]))
(Order[I:11, N:Order_4, Ref:2]
Customer[I:2, N:Customer_1, Ref:2]
(LineItem[I:16, N:LineItem_1, Ref:1] Addr[I:17, N:Address_1, City:1]))
(Order[I:20, N:Order_3, Ref:1]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:21, N:LineItem_2, Ref:1] Addr[I:22, N:Address_1, City:2]))
(Order[I:20, N:Order_3, Ref:1]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:25, N:LineItem_0, Ref:1] Addr[I:26, N:Address_1, City:1]))
(Order[I:27, N:Order_2, Ref:1]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:30, N:LineItem_2, Ref:1] Addr[I:31, N:Address_2, City:1]),
(LineItem[I:34, N:LineItem_0, Ref:1] Addr[I:35, N:Address_2, City:1]))
(Order[I:36, N:Order_1, Ref:1]
Customer[I:2, N:Customer_1, Ref:2]
(LineItem[I:37, N:LineItem_1, Ref:1] Addr[I:38, N:Address_1, City:2]),
(LineItem[I:39, N:LineItem_0, Ref:1] Addr[I:40, N:Address_1, City:2]))
(Order[I:41, N:Order_0, Ref:1]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:42, N:LineItem_3, Ref:1] Addr[I:43, N:Address_2, City:1]))
(Order[I:41, N:Order_0, Ref:1]
Customer[I:1, N:Customer_1, Ref:1]
(LineItem[I:46, N:LineItem_1, Ref:1] Addr[I:47, N:Address_1, City:1]))
==== Filtered WorkitemSessions for LineItem ====
-- WorkitemSession(WorkitemSessionTransport[I:50, N:WorkitemSession_50, Ref:2-1-1-1-1-1-1]
Customer[I:1, N:Customer_1, Ref:1];
(Order[I:4, N:Order_5, Ref:2]
Source[SSSSS]
<prop-ignored>
(LineItem[I:5, N:LineItem_2, Ref:1] Addr[I:6, N:Address_1, City:1])),
(Order[I:20, N:Order_3, Ref:1]
Source[HHHHHHHHH]
<prop-ignored>
(LineItem[I:21, N:LineItem_2, Ref:1] Addr[I:22, N:Address_1, City:2])),
(Order[I:20, N:Order_3, Ref:1]
Source[HHHHHHHHH]
<prop-ignored>
(LineItem[I:25, N:LineItem_0, Ref:1] Addr[I:26, N:Address_1, City:1])),
(Order[I:27, N:Order_2, Ref:1]
Source[YYYYYYY]
<prop-ignored>
(LineItem[I:30, N:LineItem_2, Ref:1] Addr[I:31, N:Address_2, City:1]),
(LineItem[I:34, N:LineItem_0, Ref:1] Addr[I:35, N:Address_2, City:1])),
(Order[I:41, N:Order_0, Ref:1]
Source[RRRRRRR]
<prop-ignored>
(LineItem[I:42, N:LineItem_3, Ref:1] Addr[I:43, N:Address_2, City:1])),
(Order[I:41, N:Order_0, Ref:1]
Source[RRRRRRR]
<prop-ignored>
(LineItem[I:46, N:LineItem_1, Ref:1] Addr[I:47, N:Address_1, City:1])))
-- WorkitemSession(WorkitemSessionTransport[I:51, N:WorkitemSession_51, Ref:2-2-1-1]
Customer[I:2, N:Customer_1, Ref:2];
(Order[I:11, N:Order_4, Ref:2]
Source[AAAAA]
<prop-ignored>
(LineItem[I:12, N:LineItem_3, Ref:1] Addr[I:13, N:Address_1, City:2])),
(Order[I:11, N:Order_4, Ref:2]
Source[AAAAA]
<prop-ignored>
(LineItem[I:16, N:LineItem_1, Ref:1] Addr[I:17, N:Address_1, City:1])),
(Order[I:36, N:Order_1, Ref:1]
Source[BBBBBBBBB]
<prop-ignored>
(LineItem[I:37, N:LineItem_1, Ref:1] Addr[I:38, N:Address_1, City:2]),
(LineItem[I:39, N:LineItem_0, Ref:1] Addr[I:40, N:Address_1, City:2])))
--------------
(Press any key to continue)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.