I really need a Citations filter which gives the Citations belonging to a Subset of people

(Please include your Gramps version and Operating System)
Gramps v5.1.5
OS: Linux
Desktop: Cinnamon 5.4.12 tk: GTK 3.24.24 wm: Mutter dm: LightDM Distro: LMDE 5 Elsie base: Debian 11.2 bullseye

Citations of people matching the

we currently have
Active Person
Descendants of
I need the next step to give the Citations of those people.

Can anyone help ?

If you filter on those people in the People category view, then you can use the Citations gramplet to view their citations.

Sorry George, that is no good. I need it to feed a Report.

Are those ALL the citations you want to find?

Don’t you also want the Citations for :

  • any Primary Role Event under those people
  • any non-primary Role Event under those people
  • any secondary object under those people
  • any Family where any of those people are a spouse
  • any secondary object under those Spousal Families
  • any Family where any of those people are a child
  • any secondary object under those Offspring Families

I think you are right, I need the events of the people first. Plus the events of the Families where those people are in the Primary Role.
Then the citations of all those events. Parents and children would be included in the original People list if required.
I’m trying to get to the list of Citations as given in the Detailed Descendant Report.

If you are looking at this from a coding point of view, the export module might be the best example of what data to gather.

For the Selected set of people, it exports EVERYTHING related to those people, including secondary objects and the Family containers where they were a member. (Although it correctly omits the spouses, parents, siblings and offspring if those people were not part of the filter.)

You just need the subset of Citations and Sources within the tree cutting that the Export grabs. (I had not considered the Place and Enclosing Place citations in my previous posting. Or the Repositories. But this would include those too.)

I’ve wrote a SuperTool script which find events with a specific role in persons or families records (STF_participant_role). But I’m not sure it cover all types @emyoulation enumerates.

@kku if it’s easy to call a Citation filter from SuperTool running in Citations, do you think it is possible from SuperTool running in Citations to call an Event filter to obtain citations from events it finds? Some kind of filter proxy.

If it’s possible it could be easy to call my first filter from a Citations SuperTool filter to find Citations used in events with a specific role in persons or families records.

The export builds a comprehensive set of objects & recursive secondary objects for a filter of persons.

Maybe there could be a generalized filter that gathers that leverages the code already done for export and delivers just the active category’s objects from that subset?

Did an experiment with @cdhorn 's Relationships category CardView and discovered its citations panel doesn’t delve as deeply as I’d anticipated.

@PLegoux, I hope I understood correctly. This was not possible until now - but now SuperTool is updated to support accessing custom filters from another namespace. The syntax is like

f1 = filter(“event-filtername”, namespace=“Event”)

This change is in SuperTool version 1.2.5.

Thanks for the suggestion.

2 Likes

Active Person
Descendants of

I’ve found the next step

Events of persons matching the filter with option to include Family events
That will give me all Person and Family events for a subset of Persons.

I suspect that the Isotammi Supertool is the way to go but I have just downloaded it and shall have to learn how to use it.

Thanks to everyone who answered my call.

Hi @kku
I have been able to get a filter in another namespace to work, but I cannot get it to work when that filter calls another filter. Is it me or is this a problem.?

Now I really need a concrete example :grin:

1 Like

You could post the SuperTool script here along with the custom_filters.xml file from your Gramps User Directory. (Use the ‘code’ markup control. (An example capture and filter below. @kku these are NOT examples of his issue. They are examples of what kind of data would be provided.)

Or if you’ve installed his experimental FilterParams addon, you could post a visualization of how one filter calls the other(s):

in comparison to the custom_filters.xml raw XML:

<?xml version="1.0" encoding="utf-8"?>
<filters>
  <object type="Person">
    <filter name="Some Event in place x" function="and" comment="People filter : who has the events">
      <rule class="MatchesEventFilter" use_regex="False">
        <arg value="Event in place x"/>
      </rule>
    </filter>
  </object>
  <object type="Event">
    <filter name="Event in place x" function="and" comment="Event filter : occurred in a place">
      <rule class="MatchesPlaceFilter" use_regex="False">
        <arg value="In place X"/>
      </rule>
    </filter>
  </object>
  <object type="Place">
    <filter name="In place X" function="and" comment="Place filter : enclosed by a place">
      <rule class="IsEnclosedBy" use_regex="False">
        <arg value="P0003"/>
        <arg value="1"/>
      </rule>
    </filter>
  </object>
</filters>

My Script is as follows

[Gramps SuperTool script file]
version=1

[title]
SuperTool-CitationsforActivePersonDesc

[category]
Citations

[initial_statements]
# takes Event filter eventsofactivedescent as its input and outputs a list of Citations used in those Events
# George Baynes
events_list = filter("eventsofactivedescent", namespace = "Event")

[statements]

[filter]

[expressions]
citation

[scope]
filtered

[unwind_lists]
False

[commit_changes]
False

[summary_only]
False

and my custom_filters.xml is here - only the relevant bits (I hope)

<?xml version="1.0" encoding="utf-8"?>
<filters>
  <object type="Person">
    <filter name="ActivePerson" function="and">
      <rule class="IsActivePerson" use_regex="False">
      </rule>
    </filter>
    <filter name="activepersondescendants" function="and">
      <rule class="IsDescendantFamilyOfFilterMatch" use_regex="False">
        <arg value="ActivePerson"/>
      </rule>
    </filter>
  </object>
  <object type="Event">
    <filter name="eventsofactivedescent" function="and">
      <rule class="MatchesPersonFilter" use_regex="False">
        <arg value="activepersondescendants"/>
        <arg value="1"/>
      </rule>
    </filter>
  </object>
</filters>

I’m still trying to get it to work in display mode but I just get the full set of Citations. The Events filter works in Gramps. And I’ve tried using a simple Events filter with Supertool and that works fine.
Thanks for your time.

So it is running from the SuperTool Citations namespace, calling a filter in the Events namespace that calls 2 stage filter in the Person namespace?

1 Like

I’m guessing that ST is running the filter itself rather than letting Gramps do it.
Like I said, I’m guessing.

I’ve always run the filter in the Filter Gramplet of the Category view. Then applied the SuperTool script on the “Filtered Objects”. But since you’re using this to mock up finding the Citation List for to add to a Report, you won’t have that SuperTool shell simplifying things.

a try:

  • 4 persons in Persons bookmarks
  • Persons filter: persons in bookmarks (4)
  • Events filter: events of Persons filter (212)
  • Citations SuperTool filter : Citations matching citations in events from Events filter results (240)
  • print source title and citation page of found citations

[Gramps SuperTool script file]
version=1

[title]
SuperTool-Citations - Citations matching citations in events from Events filter results

[category]
Citations

[initial_statements]
sel_events = filter("90. Individus(Signets).EvFamiliaux(Inclus) - 046p", namespace="Event")

[statements]
found = False
for c in citators:
	if type(c).__name__ == "EventProxy":
		if sel_events(c):
			found = True
			break

[filter]
found

[expressions]
source.title, page

[scope]
all

[unwind_lists]
False

[commit_changes]
False

[summary_only]
False


Another try to match initial question:

  • Person filter: Descendants of my grand-father
  • Citations SuperTool filter : Citations matching citations in Person filter results

Script V2 (I’ve made some changes to make it working with every filters where citations exist):

[Gramps SuperTool script file]
version=1

[title]
SuperTool-Citations - Citations matching citations in another namespace filter results

[category]
Citations

[initial_statements]
filter_ns = "Person" # Valid values: Person, Event, ...
filter_name = "Descendants d'André Legoux" # Any filter name defined in previous namespace

ns_proxy = filter_ns + "Proxy"
ns_with_citations = ["Person", "Event", "Place", "Media", "Family"]
authorized = True if filter_ns in ns_with_citations else False
if authorized:
    try:
        sel_objects = filter(filter_name, namespace=filter_ns)
    except:
        authorized = False

[statements]
found = False
if authorized and filter_ns != namespace:
    for c in citators:
        if type(c).__name__ == ns_proxy:
            if sel_objects(c):
                found = True
                break

[filter]
found

[expressions]
source.title, page

[scope]
all

[unwind_lists]
False

[commit_changes]
False

[summary_only]
False

PS: @kku Could you make namespace property available in Initial statements? If so it could be possible to test it there (In my case I could set my authorized variable to false there without need to test it every time in Statements)