예제 #1
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", 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));
        }
예제 #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>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));
        }
예제 #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.</returns>
        public override IEnumerable <DataPin> GetDataPins(IItem item)
        {
            DataPinBuilder builder = new DataPinBuilder(
                DataPinHelper.DefaultFilter);

            if (Subjects?.Count > 0)
            {
                builder.AddValues("subject", Subjects);
            }

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

            if (!string.IsNullOrEmpty(Color))
            {
                builder.AddValue("color", Color, filter: true, filterOptions: true);
            }

            if (Links?.Count > 0)
            {
                builder.AddValues("target-id", Links.Select(l => l.Id));
            }

            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));
        }
예제 #5
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));
        }
예제 #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: 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));
        }
예제 #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.</returns>
        public override IEnumerable <DataPin> GetDataPins(IItem item)
        {
            DataPinBuilder builder = new DataPinBuilder(
                new StandardDataPinTextFilter());

            builder.AddValue("id", GraffitiId);

            if (!string.IsNullOrEmpty(Language))
            {
                builder.AddValue("language", Language);
            }

            if (!string.IsNullOrEmpty(Verse))
            {
                builder.AddValue("verse", Verse);
            }

            if (!string.IsNullOrEmpty(Author))
            {
                builder.AddValue("author", Author, filter: true, filterOptions: true);
            }

            if (Identifications?.Count > 0)
            {
                builder.AddValues("pid", Identifications.Select(i => i.Id));
            }

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

            return(builder.Build(this));
        }
예제 #8
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: multiple pins with key <c>area</c>,
        /// <c>owner</c> (both filtered, with digits).</returns>
        public override IEnumerable <DataPin> GetDataPins(IItem item)
        {
            DataPinBuilder builder = new DataPinBuilder(
                new StandardDataPinTextFilter());

            if (Provenances?.Count > 0)
            {
                builder.AddValues("area", Provenances.Select(p => p.Area),
                                  filter: true, filterOptions: true);
            }

            if (Owners?.Count > 0)
            {
                builder.AddValues("owner", Owners,
                                  filter: true, filterOptions: true);
            }

            return(builder.Build(this));
        }
예제 #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 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));
        }
예제 #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>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));
        }
예제 #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: 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));
        }
예제 #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>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));
        }
예제 #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: <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));
        }
예제 #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>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));
        }
예제 #15
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));
        }