Duplicate citations with Supertool

I wish to dupplicate some citations using Supertool. Their notes, medias and attributes have to be attached to the new citations but not their references. They have to be attached to the same source than the original citation.

Do you know what I have to do, what is the method to use to?

Thanks

Perhaps understanding the Use Case would help get a more correct answer.

When starting to think about the method, I wondered why the attributes, media & notes would be the same while the date & Vol/Page number changed?

I realized that the Use Case made a difference in what solution has to be created.

Maybe the Confidence, Tags & Privacy are the focus? The Attribute in particular is another item needed special attention… since it is a special purpose item and has an internal handle but no ID. Does it need to be a duplicate or a shared instance?

1 Like

To complete my request, what I want to do is for one citation now I want to create (dupplicate) three more ones and update the original citation title. No date, attributes or media changes. Just these change in page title (But confidence will be change too - I think I’ll do that manually):

From citation page title:

  • xyz

To citations page title:

  • xyz [P/D]
  • xyz [P/I]
  • xyz [S/D]
  • xyz [S/I]

With P, S, D and I as Primary, Secondary, Direct and Indirect.

With that I will split references to citations in events correspondingly. It’ll be possible to me with that notation to know automatically with filters if events researches are complete (i.e birth/marriage/death events with a [P/D] citation) or not.

About attributes, yes they need to be duplicated (I don’t want to tinker either)

You can copy a citation with something like:

from gramps.gen.lib import SrcAttribute
c = Citation()
c.set_reference_handle(source.handle)
c.set_page(page)
c.set_date_object(obj.get_date_object())
c.set_confidence_level(confidence)
for n in notes:
    c.add_note(n.handle)
for mediaref in obj.get_media_list():
    c.add_media_reference(mediaref)
for attrtype, attrvalue in attributes:
    a = SrcAttribute()
    a.set_type(attrtype)
    a.set_value(attrvalue)
    c.add_attribute(a)
db.add_citation(c, trans)

Put the code in the “Statements executed for each object” section. Use option “Selected objects” and select the citation you want to copy. To create multiple copies, just execute the script multiple times.

Note that notes and media are not actually duplicated, the new citation just refers to the original note and media objects.

Hope this helps
Kari

type or paste code here
3 Likes

Thank you, that works perfectly.

I have thought about separating my citations in that way, but I would like to use a citation attribute “Information Type” with values “Primary” and “Secondary”, and another citation attribute “Evidence Type” with values “Direct” and “Indirect”, rather than putting that information in the the citation title. But I have not yet done so, because I don’t think I can create custom filters for citation attributes.

Similarly, I would create an attribute “Source Type” with values “Original”, “Derived” and “Authored Narrative”, though perhaps as a source attribute rather than a citation attribute.

1 Like

You could try my Supertool filter:

Load it, it and its includes from this web page, modify search keywords and Supertool title then save it as a regular filter. You will have a new attribute filter for citations (or sources, it will work too).

Note: you have to be in citations view not in sources view, even with viewing citations enable in this view, to save the citations filters (and in the sources view to save a sources filter)

Note 2: I’ve created another unpublished ST script wich create citations attributes selecting some information from citation page content to create them (I’d URL in page field I’ve transferred to an URL attribute). I could share it with you too if you need

1 Like

Actually, I see that issue #9845 created the “has attribute” filter rules for citations, sources, and repositories. But I still don’t see those filter rules after upgrading to 5.1.4.

This revision was only a maintenance release… so new features won’t be rolled in until the 5.2 upgrade.

You can still apply that patch from the Pull Request:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.