how to add a customField for an itemType

638 views
Skip to first unread message

Abbas Shahzadeh

unread,
Jun 20, 2011, 3:38:06 AM6/20/11
to zoter...@googlegroups.com
Dear Zotero Developer's, Hi.

I want to add a customField to the 'book' itemType. By modifying "userdata.sql" and "schema.js" I can add base fields to customItemTypes. But can't figure a way to add customFields to base itemTypes.  

The field that I like to add is printNumber(printing number) that indicates which run a book came from.  It seems that no major style addresses this field but people in Iran tend to record it in their bibliographies.

Regards,
Abbas

Bruce D'Arcus

unread,
Jun 20, 2011, 7:57:12 AM6/20/11
to zoter...@googlegroups.com

Isn't printrun just a version/edition id?

> --
> You received this message because you are subscribed to the Google Groups "zotero-dev" group.
> To post to this group, send email to zoter...@googlegroups.com.
> To unsubscribe from this group, send email to zotero-dev+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/zotero-dev?hl=en.
>

Abbas Shahzadeh

unread,
Jun 20, 2011, 8:47:09 AM6/20/11
to zoter...@googlegroups.com
Each batch of copies printed is termed a print run, printing run, printing, impression, or press run. This is all of the copies produced by a single set-up of the production equipment. One edition can have any number of print runs. Poor-selling books may have only one. Very successful books may have 50 or more.
http://en.wikipedia.org/wiki/Edition_%28book%29#Print_run

Avram Lyon

unread,
Jun 20, 2011, 9:08:03 AM6/20/11
to zoter...@googlegroups.com
On Mon, Jun 20, 2011 at 4:47 PM, Abbas Shahzadeh <a.sha...@gmail.com> wrote:
> Each batch of copies printed is termed a print run, printing run, printing,
> impression, or press run. This is all of the copies produced by a single
> set-up of the production equipment. One edition can have any number of print
> runs. Poor-selling books may have only one. Very successful books may have
> 50 or more.
> http://en.wikipedia.org/wiki/Edition_%28book%29#Print_run

But couldn't you still put this in the edition field?
E.g.:
1st edition, 20th printing.

This would mean the ordinals (-st, -th) would need to be entered
manually in the Zotero field, but that's not too bad. Can you provide
example citations that show what the citations look like? Preferably
in English, but I can make sense of the citation in Persian if need
be.

- Avram

Abbas Shahzadeh

unread,
Jun 20, 2011, 9:29:40 AM6/20/11
to zoter...@googlegroups.com
Thanks for your suggestion. But in most style files, term="edition" is included in the style. So if I put something like "1st edition, 20th printing" in edition field of a book, it will appear like "1st edition, 20th printing edition" in bibliography. Then if I edit styles, to remove the "edition" term, items with just a number in their edition field will not be formatted correctly.

example citation with print number: "volume 3, print 17" or "جلد۳، چاپ ۱۷"



But couldn't you still put this in the edition field?
E.g.:
1st edition, 20th printing.

This would mean the ordinals (-st, -th) would need to be entered
manually in the Zotero field, but that's not too bad. Can you provide
example citations that show what the citations look like? Preferably
in English, but I can make sense of the citation in Persian if need
be.

- Avram

Avram Lyon

unread,
Jun 21, 2011, 2:40:41 AM6/21/11
to zoter...@googlegroups.com
On Mon, Jun 20, 2011 at 5:29 PM, Abbas Shahzadeh <a.sha...@gmail.com> wrote:
> Thanks for your suggestion. But in most style files, term="edition" is
> included in the style. So if I put something like "1st edition, 20th
> printing" in edition field of a book, it will appear like "1st edition, 20th
> printing edition" in bibliography. Then if I edit styles, to remove the
> "edition" term, items with just a number in their edition field will not be
> formatted correctly.
> example citation with print number: "volume 3, print 17" or "جلد۳، چاپ ۱۷"

For some reason, I thought that the is-numeric test would help here,
but now I see that it will return true for both "3" and "volume 3,
print 17", so we can't use that to determine whether to append
"edition", or "volume", or "printing".

Can the CSL gurus offer any advice on this?

By the way, does the citation processor handle the Arabic (۱۲۳...)
numerals correctly?

Avram

Abbas Shahzadeh

unread,
Jun 21, 2011, 11:14:52 AM6/21/11
to zoter...@googlegroups.com
Does anybody ever used "custom fields" in Zotero or knows how to implement them?


By the way, does the citation processor handle the Arabic (۱۲۳...)
numerals correctly?

Avram

No it doesn't. And it is not necessary until numbers are stored as European numerals. BTW I've implemented a converter in NLAI translator to convert Arabic numeral to European when necessary to ensure that numbers are always stored correctly (https://gist.github.com/1015122)




adamsmith

unread,
Jun 21, 2011, 11:41:40 AM6/21/11
to zotero-dev

> For some reason, I thought that the is-numeric test would help here,
> but now I see that it will return true for both "3" and "volume 3,
> print 17", so we can't use that to determine whether to append
> "edition", or "volume", or "printing".
uh - to be honest that's what I thought, too. Most well written styles
test for "is numeric" and only add "edition" if it returns true -
obviously that does work for some cases ("revised and extended
edition" for example) but it'd be nice to have the "is numeric" test
be a little stricter.

Avram Lyon

unread,
Jun 21, 2011, 2:41:30 PM6/21/11
to zoter...@googlegroups.com
On Tue, Jun 21, 2011 at 7:14 PM, Abbas Shahzadeh <a.sha...@gmail.com> wrote:
> Does anybody ever used "custom fields" in Zotero or knows how to implement
> them?

I think this might be part of the functionality added for the
NSF-specific version of Zotero that was created. Don't know anything
about the details, and I can't help there.

I very much hope that Dan can offer some guidance-- it would be good
to know that there is a real, successful attempt to run the Zotero
client and server in another, quite different, environment. And maybe
you could produce some more documentation on how you've managed to set
things up, for future implementers' reference.

Abbas also wrote:
>> By the way, does the citation processor handle the Arabic (۱۲۳...)
>> numerals correctly?

> No it doesn't. And it is not necessary until numbers are stored as European
> numerals. BTW I've implemented a converter in NLAI translator to convert
> Arabic numeral to European when necessary to ensure that numbers are always
> stored correctly (https://gist.github.com/1015122)

Interesting. How do you handle converting back to Arabic numbers in
styles? I suppose you could define them as the long form of the number
terms, but that's still a bad solution. This might still need
attention in a future version of CSL.

Avram

Avram Lyon

unread,
Jun 21, 2011, 2:42:40 PM6/21/11
to zoter...@googlegroups.com

The CSL specification is pretty clear on this, with an example even.
Can someone explain the decision to go with this behavior?

Avram

Dan Stillman

unread,
Jun 21, 2011, 2:46:56 PM6/21/11
to zoter...@googlegroups.com
On 6/21/11 2:41 PM, Avram Lyon wrote:
> On Tue, Jun 21, 2011 at 7:14 PM, Abbas Shahzadeh<a.sha...@gmail.com> wrote:
>> Does anybody ever used "custom fields" in Zotero or knows how to implement
>> them?
> I think this might be part of the functionality added for the
> NSF-specific version of Zotero that was created. Don't know anything
> about the details, and I can't help there.

Yes, and those tables aren't meant to be used for anything else for the
time being.

Rintze Zelle

unread,
Jun 21, 2011, 4:17:55 PM6/21/11
to zoter...@googlegroups.com
We followed the behavior implemented in Zotero's old (< Zotero 2.1) CSL processor, see e.g. http://forums.zotero.org/discussion/3401/zotero-bugs-found-when-creating-csl-stylesheet/ . I can't find any documentation on why this behavior was chosen in the first place. Note however that, although it's not described in the spec, quoted content always fails for is-numeric: http://forums.zotero.org/discussion/5080/isphrase-condition/?Focus=22138#Comment_22138

Rintze

Abbas Shahzadeh

unread,
Jun 22, 2011, 9:41:19 AM6/22/11
to zoter...@googlegroups.com
Dear Zotero developers, thanks for responding.

>>>Does anybody ever used "custom fields" in Zotero or knows how to implement
>>> them?
>>
>> I think this might be part of the functionality added for the
>> NSF-specific version of Zotero that was created.
>>

> Yes, and those tables aren't meant to be used for anything else for the time being.

I conclude that no custom fields can be added to any item type. Maybe
I can modify the original schema in "userdata.sql" and "schema.js" by
inserting some "alter table" statements. I will give it a try. Using
edition field may cause problems with localization.


>>> By the way, does the citation processor handle the Arabic (۱۲۳...)
>>> numerals correctly?
>> No it doesn't. And it is not necessary until numbers are stored as European
>> numerals. BTW I've implemented a converter in NLAI translator to convert
>> Arabic numeral to European when necessary to ensure that numbers are always
>> stored correctly (https://gist.github.com/1015122)

>Interesting. How do you handle converting back to Arabic numbers in
>styles? I suppose you could define them as the long form of the number
>terms, but that's still a bad solution.

I've modified the source code and in "integration.js" just before
inserting citations and bibliography into the Word document I test
language field of items(using item_ids) and if it is "fa" I convert
commas, semicolons, ... to Persian and make its direction right to
left. I could convert numerals too but MS Word handles it itself.
Could not use long form of numbers yet.

Dan Stillman

unread,
Jun 22, 2011, 10:32:55 AM6/22/11
to zoter...@googlegroups.com
On 6/22/11 9:41 AM, Abbas Shahzadeh wrote:
> Dear Zotero developers, thanks for responding.
>
>>>> Does anybody ever used "custom fields" in Zotero or knows how to implement
>>>> them?
>>> I think this might be part of the functionality added for the
>>> NSF-specific version of Zotero that was created.
>>>
>> Yes, and those tables aren't meant to be used for anything else for the time being.
> I conclude that no custom fields can be added to any item type. Maybe
> I can modify the original schema in "userdata.sql" and "schema.js" by
> inserting some "alter table" statements. I will give it a try. Using
> edition field may cause problems with localization.

Using custom fields will break syncing and potentially break Zotero
upgrades. That's what I mean when I say they're not meant to be used
right now.

Avram Lyon

unread,
Jun 22, 2011, 2:28:55 PM6/22/11
to zoter...@googlegroups.com

Abbas, I gather, is apparently part of a workgroup in Iran that is
implementing a local version of Zotero's client and server. Thus they
may well be modifying the server as well to maintain syncing. It will
of course break syncing with zotero.org, and upgrades as well, but
they'd presumably be committing to maintaining a customized fork of
the project.

I personally think that this is a very interesting and positive
development-- more in-depth experimentation like may well drive the
development useful and unexpected new features.

Avram

Abbas Shahzadeh

unread,
Jun 23, 2011, 12:30:35 AM6/23/11
to zoter...@googlegroups.com
> On Wed, Jun 22, 2011 at 6:32 PM, Dan Stillman <dsti...@zotero.org> wrote:
> Using custom fields will break syncing and potentially break Zotero
> upgrades. That's what I mean when I say they're not meant to be used right
> now.

Do you mean that there IS some way to add a custom field (using
customFields table) to 'book' item type?

> On Wed, Jun 22, 2011 at 9:58 PM, Avram Lyon <ajl...@gmail.com> wrote:
> Abbas, I gather, is apparently part of a workgroup in Iran that is
> implementing a local version of Zotero's client and server.

Actually there are two workgroups and I am with the one that is
working on client side. We will contact people who are working on
server. But for now our priority is to release a version of zotero
with RTL and Persian support including Persian user interface,
documentation, national library translator and a website to
communicate with users. Since there is no free reference manager
software with complete RTL and Persian support I guess Zotero will
become so popular in Iranian universities.

Frank Bennett

unread,
Jun 23, 2011, 2:35:46 AM6/23/11
to zotero-dev
If you are careful, it should be possible to shoehorn new field data
into Zotero without touching the core database schema. It's a hard
process of reverse engineering, but I would strongly urge that you
take a close look and try to come up with a strategy that does not
make any changes to system.sql or userdata.sql.

In the multilingual branch, I started by modifying userdata.sql, and
then later refactored much of the code to isolate the multilingual
data in a separate set of tables, built from a separately versioned
database template (multilingual.sql). From that experience I learned
(a) that reverse-migrating a variant schema back to the standard is
_very_ hard -- if you look at the reverse-migration code, you'll see
it's a real horror story; (b) that everything I needed to do could
have been done without touching userdata.sql in the first place; and
(c) that my life became much, much simpler and less stressful once my
variant's schema was once again aligned with mainstream Zotero.

Frank

Dan Stillman

unread,
Jun 23, 2011, 11:57:54 AM6/23/11
to zoter...@googlegroups.com
On 6/23/11 12:30 AM, Abbas Shahzadeh wrote:
>> On Wed, Jun 22, 2011 at 9:58 PM, Avram Lyon<ajl...@gmail.com> wrote:
>> Abbas, I gather, is apparently part of a workgroup in Iran that is
>> implementing a local version of Zotero's client and server.
> Actually there are two workgroups and I am with the one that is
> working on client side. We will contact people who are working on
> server. But for now our priority is to release a version of zotero
> with RTL and Persian support including Persian user interface,
> documentation, national library translator and a website to
> communicate with users.

Why should this be a separate release (which, by the way, cannot be
called "Zotero", which is a registered trademark of George Mason
University�see http://www.zotero.org/support/terms/trademark for more
information�and won't be able to benefit from Zotero support) rather
than patches to the core release?

Abbas Shahzadeh

unread,
Jun 23, 2011, 10:53:43 PM6/23/11
to zoter...@googlegroups.com
On Thu, Jun 23, 2011 at 7:27 PM, Dan Stillman <dsti...@zotero.org> wrote:
> On 6/23/11 12:30 AM, Abbas Shahzadeh wrote:
>>>
>>> On Wed, Jun 22, 2011 at 9:58 PM, Avram Lyon<ajl...@gmail.com>  wrote:
>>> Abbas, I gather, is apparently part of a workgroup in Iran that is
>>> implementing a local version of Zotero's client and server.
>>
>> Actually there are two workgroups and I am with the one that is
>> working on client side. We will contact people who are working on
>> server. But for now our priority is to release a version of zotero
>> with RTL and Persian support including Persian user interface,
>> documentation, national library translator and a website to
>> communicate with users.
>
> Why should this be a separate release (which, by the way, cannot be called
> "Zotero", which is a registered trademark of George Mason University—see
> http://www.zotero.org/support/terms/trademark for more information—and won't

> be able to benefit from Zotero support) rather than patches to the core
> release?

Dear Dan, I appreciate your suggestion.
Practically we've sent some parts of our work to you and eventually we
will submit every part of code that we've changed. We should convince
you to apply the changes and this is not possible unless our code is
mature enough. So any separate release will be temporary and of course
we will bound ourselves to the license.

Reply all
Reply to author
Forward
0 new messages