Example #1
0
        /// <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>, <c>dubious-count</c>,
        /// <c>lost-count</c>, and a list with <c>title</c> (filtered, with
        /// digits), <c>genre</c>, <c>language</c>.</returns>
        public override IEnumerable <DataPin> GetDataPins(IItem item)
        {
            DataPinBuilder builder = new DataPinBuilder(
                DataPinHelper.DefaultFilter);

            // tot-count
            builder.Set("tot", Works?.Count ?? 0, false);
            // dubious-count
            builder.Set("dubious", Works?.Count(w => w.IsDubious) ?? 0, false);
            // lost-count
            builder.Set("lost", Works?.Count(w => w.IsLost) ?? 0, false);

            if (Works?.Count > 0)
            {
                foreach (PersonWork work in Works)
                {
                    // title
                    builder.AddValues("title", work.Titles,
                                      filter: true, filterOptions: true);
                    // genre
                    builder.AddValue("genre", work.Genre);
                    // language
                    builder.AddValue("language", work.Language);
                }
            }

            return(builder.Build(this));
        }
Example #2
0
        /// <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));
        }
Example #3
0
        /// <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>id</c>.</returns>
        public override IEnumerable <DataPin> GetDataPins(IItem item)
        {
            DataPinBuilder builder = new DataPinBuilder();

            builder.Set("tot", Hands?.Count ?? 0, false);

            if (Hands?.Count > 0)
            {
                foreach (MsHand hand in Hands)
                {
                    if (!string.IsNullOrEmpty(hand.Id))
                    {
                        builder.AddValue("id", hand.Id);
                    }

                    if (!string.IsNullOrEmpty(hand.PersonId))
                    {
                        builder.AddValue("person-id", hand.PersonId);
                    }

                    if (hand.Types?.Count > 0)
                    {
                        foreach (string type in hand.Types)
                        {
                            builder.AddValue("type", type);
                        }
                    }
                }
            }

            return(builder.Build(this));
        }
        /// <summary>
        /// Get all the key=value pairs 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>fr.tag</c>=tag if any.</returns>
        public IEnumerable <DataPin> GetDataPins(IItem item = null)
        {
            DataPinBuilder builder = new DataPinBuilder(
                new StandardDataPinTextFilter());

            // fr.tot-count
            builder.Set(PartBase.FR_PREFIX + "tot", Forms?.Count ?? 0, false);

            if (Forms?.Count > 0)
            {
                foreach (LingTaggedForm form in Forms)
                {
                    // fr.lemma
                    if (form.Lemmata?.Count > 0)
                    {
                        builder.AddValues(PartBase.FR_PREFIX + "lemma",
                                          form.Lemmata,
                                          filter: true,
                                          filterOptions: true);
                    }

                    // fr.tag
                    if (form.Tags?.Count > 0)
                    {
                        builder.AddValues(PartBase.FR_PREFIX + "tag",
                                          form.Tags.Select(t => t.Value));
                    }
                }
            }

            return(builder.Build(null));
        }
        /// <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>title</c> (filtered, including digits) and <c>date-value</c>,
        /// plus a list of participant IDs in <c>pid</c>.
        /// </returns>
        public override IEnumerable <DataPin> GetDataPins(IItem item)
        {
            DataPinBuilder builder = new DataPinBuilder(
                DataPinHelper.DefaultFilter);

            builder.Set("tot", Dedications?.Count ?? 0, false);

            foreach (LitDedication dedication in Dedications)
            {
                builder.AddValue("title",
                                 dedication.Title, filter: true, filterOptions: true);

                if (dedication.Date != null)
                {
                    builder.AddValue("date-value", dedication.Date.GetSortValue());
                }

                if (dedication.Participants?.Count > 0)
                {
                    builder.AddValues("pid",
                                      dedication.Participants.Select(p => p.Id));
                }
            }

            return(builder.Build(this));
        }
Example #6
0
        /// <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>, <c>palimpsest</c> (true if any),
        /// and a collection of pins with these keys: <c>material</c>,
        /// <c>sheet-count</c>, <c>guard-sheet-count</c>.</returns>
        public override IEnumerable <DataPin> GetDataPins(IItem item)
        {
            DataPinBuilder builder = new DataPinBuilder();

            builder.Set("tot", Units?.Count ?? 0, false);

            if (Units?.Count > 0)
            {
                bool pal = false;
                foreach (MsUnit unit in Units)
                {
                    if (!pal && unit.Palimpsests?.Count > 0)
                    {
                        pal = true;
                    }

                    builder.AddValue("material", unit.Material);

                    if (unit.SheetCount > 0)
                    {
                        builder.AddValue("sheet-count", unit.SheetCount);
                    }

                    if (unit.GuardSheetCount > 0)
                    {
                        builder.AddValue("guard-sheet-count", unit.GuardSheetCount);
                    }
                }
                builder.AddValue("palimpsest", pal);
            }

            return(builder.Build(this));
        }
Example #7
0
        /// <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>; a list of unique <c>author</c>
        /// <c>claimed-author</c>'s, and <c>work</c>'s (all filtered, with digits).
        /// </returns>
        public override IEnumerable <DataPin> GetDataPins(IItem item)
        {
            DataPinBuilder builder =
                new DataPinBuilder(DataPinHelper.DefaultFilter);

            builder.Set("tot", Contents?.Count ?? 0, false);

            if (Contents?.Count > 0)
            {
                foreach (MsContent content in Contents)
                {
                    builder.AddValue("author", content.Author,
                                     filter: true, filterOptions: true);

                    if (!string.IsNullOrEmpty(content.ClaimedAuthor))
                    {
                        builder.AddValue("claimed-author", content.ClaimedAuthor,
                                         filter: true, filterOptions: true);
                    }

                    builder.AddValue("work", content.Work,
                                     filter: true, filterOptions: true);
                }
            }

            return(builder.Build(this));
        }
        /// <summary>
        /// Get all the key=value pairs 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>fr.tag</c>=tag if any.</returns>
        public IEnumerable <DataPin> GetDataPins(IItem item = null)
        {
            DataPinBuilder builder = new DataPinBuilder(
                new StandardDataPinTextFilter());

            // fr-tot-count
            builder.Set(PartBase.FR_PREFIX + "tot",
                        Interpolations?.Count ?? 0, false);

            if (Interpolations?.Count > 0)
            {
                foreach (Interpolation entry in Interpolations)
                {
                    // fr-language
                    if (entry.Languages?.Length > 0)
                    {
                        builder.AddValues(PartBase.FR_PREFIX + "language",
                                          entry.Languages);
                    }
                    // fr-value
                    builder.AddValue(PartBase.FR_PREFIX + "value", entry.Value,
                                     filter: true);
                    // fr-tag
                    builder.AddValue(PartBase.FR_PREFIX + "tag", entry.Tag);
                    // fr-role
                    builder.AddValue(PartBase.FR_PREFIX + "role", entry.Role);
                }
            }

            return(builder.Build(null));
        }
Example #9
0
        /// <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));
        }
Example #10
0
        /// <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>role</c>, <c>language</c>, <c>type</c>,
        /// <c>hand-id</c>.</returns>
        public override IEnumerable <DataPin> GetDataPins(IItem item)
        {
            DataPinBuilder builder = new DataPinBuilder();

            builder.Set("tot", Scripts?.Count ?? 0, false);

            if (Scripts?.Count > 0)
            {
                foreach (MsScript script in Scripts)
                {
                    builder.AddValue("role", script.Role);
                    if (script.Languages?.Count > 0)
                    {
                        builder.AddValues("language", script.Languages);
                    }
                    builder.AddValue("type", script.Type);
                    if (script.Hands?.Count > 0)
                    {
                        builder.AddValues("hand-id", script.Hands.Select(h => h.Id));
                    }
                }
            }

            return(builder.Build(this));
        }
Example #11
0
        /// <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));
        }
Example #12
0
        /// <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>lid</c>, <c>lemma</c>, <c>u-lemma</c>, <c>pos</c>,
        /// <c>variant</c>, <c>u-variant</c>.</returns>
        public override IEnumerable <DataPin> GetDataPins(IItem item)
        {
            DataPinBuilder builder = new DataPinBuilder(
                DataPinHelper.DefaultFilter);

            builder.Set("tot", Forms?.Count ?? 0, false);

            if (Forms?.Count > 0)
            {
                foreach (WordForm form in Forms)
                {
                    builder.AddValue("lid", form.Lid);
                    builder.AddValue("lemma", form.Lemma,
                                     filter: true, filterOptions: true);
                    builder.AddValue("u-lemma", form.Lemma);
                    builder.AddValue("pos", form.Pos);

                    if (form.Variants?.Count > 0)
                    {
                        foreach (var v in form.Variants)
                        {
                            builder.AddValue("variant", v.Value,
                                             filter: true, filterOptions: true);
                            builder.AddValue("u-variant", v.Value);
                        }
                    }
                }
            }

            return(builder.Build(this));
        }
Example #13
0
        /// <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));
        }
Example #14
0
        /// <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>material</c> (filtered, with digits),
        /// <c>format</c> (filtered, with digits), <c>state</c> (filtered, with
        /// digits), <c>c-X-count</c> for counts, <c>palimpsest-count</c>.
        /// </returns>
        public override IEnumerable <DataPin> GetDataPins(IItem item)
        {
            DataPinBuilder builder = new DataPinBuilder(
                DataPinHelper.DefaultFilter);

            builder.Set("palimpsest", Palimpsests?.Count ?? 0, false);

            builder.AddValue("material", builder.Filter.Apply(Material, true));
            builder.AddValue("format", builder.Filter.Apply(Format, true));
            builder.AddValue("state", builder.Filter.Apply(State, true));

            if (Counts?.Count > 0)
            {
                foreach (var count in Counts)
                {
                    builder.Set(count.Id, count.Value, false, "c-");
                }
            }

            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>witness</c>.</returns>
        public override IEnumerable <DataPin> GetDataPins(IItem item)
        {
            DataPinBuilder builder = new DataPinBuilder();

            builder.Set("tot", Witnesses?.Count ?? 0, false);

            if (Witnesses?.Count > 0)
            {
                builder.AddValues("witness", from w in Witnesses select w.Id);
            }

            return(builder.Build(this));
        }
Example #16
0
        /// <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));
        }
Example #17
0
        /// <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>hand-id</c>.</returns>
        public override IEnumerable <DataPin> GetDataPins(IItem item)
        {
            DataPinBuilder builder = new DataPinBuilder();

            builder.Set("tot", Features?.Count ?? 0, false);

            if (Features?.Count > 0)
            {
                foreach (MsFormalFeature feature in Features)
                {
                    builder.AddValue("hand-id", feature.HandId);
                }
            }

            return(builder.Build(this));
        }
Example #18
0
        /// <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));
        }
Example #19
0
        /// <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));
        }
Example #20
0
        /// <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));
        }
Example #21
0
        /// <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>=total count of pseudonyms;
        /// for each pseudonym, a <c>pseudonym</c> pin with value equal to
        /// <c>+</c>=author's pseudonym or <c>-</c>=non-author pseudonym,
        /// followed by the filtered pseudonym (including digits).
        /// </returns>
        public override IEnumerable <DataPin> GetDataPins(IItem item)
        {
            DataPinBuilder builder = new DataPinBuilder(
                DataPinHelper.DefaultFilter);

            builder.Set("tot", Pseudonyms?.Count ?? 0, false);

            if (Pseudonyms?.Count > 0)
            {
                builder.AddValues("pseudonym",
                                  from p in Pseudonyms
                                  select builder.ApplyFilter(options: true,
                                                             p.IsAuthor ? "+" : "-",
                                                             true,
                                                             p.Value));
            }

            return(builder.Build(this));
        }
Example #22
0
        /// <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.</returns>
        public override IEnumerable <DataPin> GetDataPins(IItem item)
        {
            DataPinBuilder builder = new DataPinBuilder(
                new StandardDataPinTextFilter());

            // tot-count
            builder.Set("tot", Contents?.Count ?? 0, false);

            if (Contents?.Count > 0)
            {
                foreach (var content in Contents)
                {
                    builder.AddValue("work", content.Work);
                    builder.AddValue("title", content.Title,
                                     filter: true, filterOptions: true);
                }
            }

            return(builder.Build(this));
        }
Example #23
0
        /// <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>sheet-count</c>.</returns>
        public override IEnumerable <DataPin> GetDataPins(IItem item)
        {
            DataPinBuilder builder = new DataPinBuilder();

            builder.Set("tot", Quires?.Count ?? 0, false);

            if (Types?.Count > 0)
            {
                builder.AddValues("type", Types);
            }

            if (Quires?.Count > 0)
            {
                builder.AddValues(
                    "sheet-count",
                    from q in Quires
                    select q.SheetCount.ToString(CultureInfo.InvariantCulture));
            }

            return(builder.Build(this));
        }
Example #24
0
        /// <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: ....</returns>
        public override IEnumerable <DataPin> GetDataPins(IItem item)
        {
            DataPinBuilder builder = new DataPinBuilder(
                new StandardDataPinTextFilter());

            builder.Set("tot", Places?.Count ?? 0, false);

            if (Places?.Count > 0)
            {
                foreach (var place in Places)
                {
                    if (!string.IsNullOrEmpty(place.Area))
                    {
                        builder.AddValue("area", place.Area,
                                         filter: true, filterOptions: true);
                    }

                    if (!string.IsNullOrEmpty(place.City))
                    {
                        builder.AddValue("city", place.City,
                                         filter: true, filterOptions: true);
                    }

                    if (!string.IsNullOrEmpty(place.Address))
                    {
                        builder.AddValue("address", place.Address);

                        int n = 0;
                        foreach (string c in place.Address.Split(','))
                        {
                            builder.AddValue($"address-{++n}", c.Trim(),
                                             filter: true, filterOptions: true);
                        }
                    }
                }
            }

            return(builder.Build(this));
        }
Example #25
0
        /// <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));
        }
Example #26
0
        /// <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));
        }
Example #27
0
        /// <summary>
        /// Get all the key=value pairs 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>fr.tag</c>=tag if any.</returns>
        public IEnumerable <DataPin> GetDataPins(IItem item = null)
        {
            DataPinBuilder builder = new DataPinBuilder(
                new StandardDataPinTextFilter());

            // fr-tot-count
            builder.Set(PartBase.FR_PREFIX + "tot", Quotations?.Count ?? 0, false);

            if (Quotations?.Count > 0)
            {
                foreach (VarQuotation entry in Quotations)
                {
                    // fr-tag
                    builder.AddValue(PartBase.FR_PREFIX + "tag", entry.Tag);
                    // fr-authority
                    builder.AddValue(PartBase.FR_PREFIX + "authority",
                                     entry.Authority);
                    // fr-work
                    builder.AddValue(PartBase.FR_PREFIX + "work", entry.Work);

                    if (entry.Variants?.Count > 0)
                    {
                        foreach (QuotationVariant variant in entry.Variants)
                        {
                            // fr-var-lemma (filtered)
                            builder.AddValue(PartBase.FR_PREFIX + "var-lemma",
                                             variant.Lemma, filter: true);
                            // fr-var-value (filtered)
                            builder.AddValue(PartBase.FR_PREFIX + "var-value",
                                             variant.Value, filter: true);
                        }
                    }
                }
            }

            return(builder.Build(null));
        }
Example #28
0
        /// <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));
        }
Example #29
0
        /// <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 under keys:
        /// <c>name</c>=full name (filtered), <c>id</c>=identification.</returns>
        public override IEnumerable <DataPin> GetDataPins(IItem item)
        {
            DataPinBuilder builder = new DataPinBuilder(
                DataPinHelper.DefaultFilter);

            builder.Set("tot", Persons?.Count ?? 0, false);

            if (Persons?.Count > 0)
            {
                foreach (CitedPerson person in Persons)
                {
                    builder.AddValue("name",
                                     person.Name?.GetFullName(), filter: true);

                    if (person.Ids != null)
                    {
                        builder.AddValues("id", from ident in person.Ids
                                          select ident.Id);
                    }
                }
            }

            return(builder.Build(this));
        }
Example #30
0
        /// <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));
        }