/// <summary> /// Get all the key=value pairs (pins) exposed by the implementor. /// </summary> /// <param name="item">The optional item. The item with its parts /// can optionally be passed to this method for those parts requiring /// to access further data.</param> /// <returns>The pins: a collection of pins with keys: /// <c>tot-count</c>=total count of exchanges in the part; /// <c>dubious-count</c>, <c>indirect-count</c>, <c>incoming-count</c>, /// <c>{TAG}-date-value</c>, <c>{TAG}-place</c> (filtered, including /// digits), <c>participant.ROLE</c> (filtered including digits), /// <c>att-TYPE-count</c>=count of attachment of type TYPE (one count /// for each distinct type found in the part), <c>att-tot-count</c>= /// total count of attachments.</returns> public override IEnumerable <DataPin> GetDataPins(IItem item) { DataPinBuilder builder = new DataPinBuilder(DataPinHelper.DefaultFilter); builder.Set("tot", Exchanges?.Count ?? 0, false); foreach (CorrExchange exchange in Exchanges) { if (exchange.IsDubious) { builder.Increase("dubious", false); } if (exchange.IsIndirect) { builder.Increase("indirect", false); } if (exchange.IsFromParticipant) { builder.Increase("incoming", false); } if (exchange.Chronotopes?.Count > 0) { foreach (Chronotope c in exchange.Chronotopes) { string tag = c.Tag?.ToLowerInvariant() ?? ""; if (c.Date != null) { builder.AddValue("date-value." + tag, c.Date.GetSortValue()); } if (!string.IsNullOrEmpty(c.Place)) { builder.AddValue("place." + tag, c.Place, filter: true, filterOptions: true); } } } if (exchange.Participants?.Count > 0) { foreach (var p in exchange.Participants) { builder.AddValue($"participant.{p.Tag ?? ""}", p.Id, filter: true, filterOptions: true); } } if (exchange.Attachments?.Count > 0) { builder.Increase(from a in exchange.Attachments select a.Type, true, "att-"); } } return(builder.Build(this)); }
/// <summary> /// Get all the key=value pairs (pins) exposed by the implementor. /// </summary> /// <param name="item">The optional item. The item with its parts /// can optionally be passed to this method for those parts requiring /// to access further data.</param> /// <returns>The pins: <c>tot-count</c>, and a collection of pins with /// keys: <c>subject-X-count</c>, <c>place</c> (filtered, with digits), /// <c>date-value</c>.</returns> public override IEnumerable <DataPin> GetDataPins(IItem item) { DataPinBuilder builder = new DataPinBuilder( DataPinHelper.DefaultFilter); builder.Set("tot", Watermarks?.Count ?? 0, false); if (Watermarks?.Count > 0) { foreach (MsWatermark watermark in Watermarks) { builder.Increase(watermark.Subject, false, "subject-"); if (!string.IsNullOrEmpty(watermark.Place)) { builder.AddValue("place", watermark.Place, filter: true, filterOptions: true); } if (watermark.Date != null) { builder.AddValue("date-value", watermark.Date.GetSortValue()); } } } return(builder.Build(this)); }
/// <summary> /// Get all the key=value pairs (pins) exposed by the implementor. /// </summary> /// <param name="item">The optional item. The item with its parts /// can optionally be passed to this method for those parts requiring /// to access further data.</param> /// <returns>The pins: <c>tot-count</c>, and lists of pins with keys: /// <c>tag-TAG-count</c>, <c>library</c> (filtered, with digits), /// <c>city</c> (filtered). /// </returns> public override IEnumerable <DataPin> GetDataPins(IItem item) { DataPinBuilder builder = new DataPinBuilder( DataPinHelper.DefaultFilter); builder.Set("tot", Signatures?.Count ?? 0, false); if (Signatures?.Count > 0) { foreach (MsSignature signature in Signatures) { builder.Increase(signature.Tag, false, "tag-"); if (!string.IsNullOrEmpty(signature.Library)) { builder.AddValue("library", signature.Library, filter: true, filterOptions: true); } if (!string.IsNullOrEmpty(signature.City)) { builder.AddValue("city", signature.City, filter: true); } } } return(builder.Build(this)); }
/// <summary> /// Get all the key=value pairs (pins) exposed by the implementor. /// </summary> /// <param name="item">The optional item. The item with its parts /// can optionally be passed to this method for those parts requiring /// to access further data.</param> /// <returns>The pins: <c>tot-count</c> and a collection of pins with /// keys: <c>pos-X-count</c>, <c>vrt-X-count</c>.</returns> public override IEnumerable <DataPin> GetDataPins(IItem item) { DataPinBuilder builder = new DataPinBuilder(); builder.Set("tot", Catchwords?.Count ?? 0, false); if (Catchwords?.Count > 0) { foreach (MsCatchword catchword in Catchwords) { builder.Increase(catchword.Position, false, "pos-"); builder.Increase(catchword.IsVertical, false, "vrt-"); } } return(builder.Build(this)); }
/// <summary> /// Get all the key=value pairs (pins) exposed by the implementor. /// </summary> /// <param name="item">The optional item. The item with its parts /// can optionally be passed to this method for those parts requiring /// to access further data.</param> /// <returns>The pins: <c>tot-count</c> and a collection of pins with /// these keys: <c>type-X-count</c>, <c>subject-X-count</c>, /// <c>color-X-count</c>, (all the keys with X are filtered, with digits), /// <c>artist-id</c> (filtered, with digits). /// </returns> public override IEnumerable <DataPin> GetDataPins(IItem item) { DataPinBuilder builder = new DataPinBuilder( DataPinHelper.DefaultFilter); builder.Set("tot", Decorations?.Count ?? 0, false); if (Decorations?.Count > 0) { foreach (MsDecoration decoration in Decorations) { builder.Increase( DataPinHelper.DefaultFilter.Apply(decoration.Type, true), false, "type-"); if (decoration.Date != null) { builder.AddValue("date-value", decoration.Date.GetSortValue()); } foreach (MsDecorationElement element in decoration?.Elements) { builder.Increase( DataPinHelper.DefaultFilter.Apply(element.Subject, true), false, "subject-"); foreach (string color in element.Colors) { builder.Increase( DataPinHelper.DefaultFilter.Apply(color, true), false, "color-"); } } if (!string.IsNullOrEmpty(decoration.Artist?.Id)) { builder.AddValue("artist-id", decoration.Artist.Id, filter: true, filterOptions: true); } } } return(builder.Build(this)); }
/// <summary> /// Get all the key=value pairs (pins) exposed by the implementor. /// </summary> /// <param name="item">The optional item. The item with its parts /// can optionally be passed to this method for those parts requiring /// to access further data.</param> /// <returns>The pins: <c>tot-count</c>, and a collection of pins /// with keys: <c>era-X-count</c>, <c>sys-X-count</c>, /// <c>tech-X-count</c>, <c>century</c>, <c>position</c>. /// </returns> public override IEnumerable <DataPin> GetDataPins(IItem item) { DataPinBuilder builder = new DataPinBuilder(); builder.Set("tot", Numberings?.Count ?? 0, false); if (Numberings?.Count > 0) { foreach (MsNumbering numbering in Numberings) { if (!string.IsNullOrEmpty(numbering.Era)) { builder.Increase(numbering.Era, false, "era-"); } if (!string.IsNullOrEmpty(numbering.System)) { builder.Increase(numbering.System, false, "sys-"); } if (!string.IsNullOrEmpty(numbering.Technique)) { builder.Increase(numbering.Technique, false, "tech-"); } if (numbering.Century != 0) { builder.AddValue("century", numbering.Century); } if (!string.IsNullOrEmpty(numbering.Position)) { builder.AddValue("position", numbering.Position); } } } return(builder.Build(this)); }
/// <summary> /// Get all the key=value pairs (pins) exposed by the implementor. /// </summary> /// <param name="item">The optional item. The item with its parts /// can optionally be passed to this method for those parts requiring /// to access further data.</param> /// <returns>The pins: <c>sheet-count</c>, <c>guard-sheet-count</c>, /// <c>section-count</c>, and a list with keys: <c>section-TAG-count</c>, /// <c>section-label</c> (filtered, with digits), /// <c>section-date-value</c>, <c>guard-material</c> (filtered, with /// digits), <c>guard-date-value</c>. /// </returns> public override IEnumerable <DataPin> GetDataPins(IItem item) { DataPinBuilder builder = new DataPinBuilder(DataPinHelper.DefaultFilter); builder.Set("sheet", SheetCount, false); builder.Set("guard-sheet", GuardSheetCount, false); builder.Set("section", Sections?.Count ?? 0, false); if (GuardSheets?.Count > 0) { foreach (MsGuardSheet guard in GuardSheets) { if (!string.IsNullOrEmpty(guard.Material)) { builder.AddValue("guard-material", guard.Material, filter: true, filterOptions: true); } if (guard.Date != null) { builder.AddValue("guard-date-value", guard.Date.GetSortValue()); } } } if (Sections?.Count > 0) { foreach (MsSection section in Sections) { builder.Increase(section.Tag, false, "section-"); if (!string.IsNullOrEmpty(section.Label)) { builder.AddValue("section-label", section.Label, filter: true, filterOptions: true); } if (section.Date != null) { builder.AddValue("section-date-value", section.Date.GetSortValue()); } } } return(builder.Build(this)); }
/// <summary> /// Get all the key=value pairs (pins) exposed by the implementor. /// </summary> /// <param name="item">The optional item. The item with its parts /// can optionally be passed to this method for those parts requiring /// to access further data.</param> /// <returns>The pins: <c>att-TYPE-count</c>=count of attachment of /// type TYPE (one count for each distinct type found in the part), /// <c>tot-count</c>=total count of attachments; plus a list of /// attachment IDs with key <c>aid</c>.</returns> public override IEnumerable <DataPin> GetDataPins(IItem item) { DataPinBuilder builder = new DataPinBuilder(); builder.Set("tot", Attachments?.Count ?? 0, false); if (Attachments.Count > 0) { builder.AddValues("aid", Attachments.Select(a => a.Id)); builder.Increase(from a in Attachments select a.Type, false, "att-"); } return(builder.Build(this)); }
/// <summary> /// Get all the key=value pairs (pins) exposed by the implementor. /// </summary> /// <param name="item">The optional item. The item with its parts /// can optionally be passed to this method for those parts requiring /// to access further data.</param> /// <returns>The pins: <c>tot-count</c> and a collection of pins with /// these keys: <c>type-{TYPE}-count</c>.</returns> public override IEnumerable <DataPin> GetDataPins(IItem item) { DataPinBuilder builder = new DataPinBuilder(); builder.Set("tot", Ornaments?.Count ?? 0, false); if (Ornaments?.Count > 0) { foreach (MsOrnament ornament in Ornaments) { // type-X-count counts if not null, unfiltered: builder.Increase(ornament.Type, false, "type-"); } } return(builder.Build(this)); }
/// <summary> /// Get all the key=value pairs (pins) exposed by the implementor. /// </summary> /// <param name="item">The optional item. The item with its parts /// can optionally be passed to this method for those parts requiring /// to access further data.</param> /// <returns>The pins: collections of unique values keyed under these /// IDs: <c>tot-count</c>=total events count, <c>type-TAG-count</c>, /// <c>date-value</c>, <c>place</c> (filtered, with digits), /// <c>participant</c> (filtered, with digits, prefixed by tag + /// <c>:</c>).</returns> public override IEnumerable <DataPin> GetDataPins(IItem item) { DataPinBuilder builder = new DataPinBuilder( DataPinHelper.DefaultFilter); builder.Set("tot", Events?.Count ?? 0, false); if (Events?.Count > 0) { foreach (BioEvent e in Events) { if (!string.IsNullOrEmpty(e.Type)) { builder.Increase(e.Type, false, "type-"); } if (e.Date != null) { builder.AddValue("date-value", e.Date.GetSortValue()); } if (e.Places?.Count > 0) { builder.AddValues("place", e.Places, filter: true, filterOptions: true); } if (e.Participants?.Count > 0) { builder.AddValues("participant", from p in e.Participants select builder.ApplyFilter(options: true, p.Tag + ":", true, p.Id)); } } } return(builder.Build(this)); }
/// <summary> /// Get all the key=value pairs (pins) exposed by the implementor. /// </summary> /// <param name="item">The optional item. The item with its parts /// can optionally be passed to this method for those parts requiring /// to access further data.</param> /// <returns>The pins: <c>tot-count</c> and a list of pins under these /// keys: <c>tag-place</c>=TAG:place (place filtered, with digits), /// <c>tag-date</c>=TAG:normalized date value, <c>date-value</c>, /// <c>tag-VALUE-count</c>. /// The normalized date value is a fixed-format number of type /// +0000.00 or -0000.00 allowing a text sort. /// </returns> public override IEnumerable <DataPin> GetDataPins(IItem item) { DataPinBuilder builder = new DataPinBuilder( DataPinHelper.DefaultFilter); builder.Set("tot", Chronotopes?.Count ?? 0, false); if (Chronotopes?.Count > 0) { foreach (Chronotope coords in Chronotopes) { builder.Increase(coords.Tag, false, "tag-"); string tag = coords.Tag ?? ""; if (!string.IsNullOrEmpty(coords.Place)) { builder.AddValue( "tag-place", builder.ApplyFilter(options: true, tag + ":", true, coords.Place)); } if (coords.Date != null) { double d = coords.Date.GetSortValue(); builder.AddValue("date-value", d); builder.AddValue( "tag-date", $"{tag}:{+d:0000.00;-d:0000.00}"); } } } return(builder.Build(this)); }
/// <summary> /// Get all the key=value pairs (pins) exposed by the implementor. /// </summary> /// <param name="item">The optional item. The item with its parts /// can optionally be passed to this method for those parts requiring /// to access further data.</param> /// <returns>The pins: <c>area</c> (filtered, with digits), /// <c>pers-count</c>, <c>ann-count</c>, <c>rest-count</c>, /// <c>pers-name</c> (full name; filtered, with digits), /// <c>pers-date-value</c>, <c>ann-X-count</c>, <c>rest-X-count</c>, /// <c>rest-date-value</c>.</returns> public override IEnumerable <DataPin> GetDataPins(IItem item) { DataPinBuilder builder = new DataPinBuilder(DataPinHelper.DefaultFilter); if (Provenances?.Count > 0) { builder.AddValues("area", Provenances.Select(p => p.Area), filter: true, filterOptions: true); } builder.Set("pers", Persons?.Count ?? 0, false); builder.Set("ann", Annotations?.Count ?? 0, false); builder.Set("rest", Restorations?.Count ?? 0, false); if (Persons?.Count > 0) { builder.AddValues("pers-name", from p in Persons where p.Name != null select p.Name.GetFullName(), filter: true, filterOptions: true); foreach (var person in Persons.Where(p => p.Date != null)) { builder.AddValue("pers-date-value", person.Date.GetSortValue()); } } if (Annotations?.Count > 0) { foreach (var annotation in Annotations) { string id = SanitizeForPinId(annotation.Type); if (id != null) { builder.Increase(id, false, "ann-"); } } } if (Restorations?.Count > 0) { foreach (var restoration in Restorations) { string id = SanitizeForPinId(restoration.Type); if (id != null) { builder.Increase(id, false, "rest-"); } if (restoration.Date != null) { builder.AddValue("rest-date-value", restoration.Date.GetSortValue()); } } } return(builder.Build(this)); }