[Tellico-users] Dewey Decimal in Tellico?

Andrew Bennett drewbenn at gmail.com
Fri Jul 9 09:01:04 UTC 2010

Hi Derek,

I've wanted this functionality for a while, too, but I haven't been
importing very many books so I usually just added Dewey & LC numbers
manually.  Thanks for giving me a reason to look into it again!

Unfortunately, I think you'll have to re-build Tellico to get this.  With
any luck, I'm mistaken and someone can point out an easier way :) but, if
not, here's what I did with the 2.2 source:

src/collections/bookcollection.cpp in BookCollection::defaultFields() I
added the fields I wanted (Dewey and LCC):

  field = new Field(QLatin1String("dewey-class"), i18n("Dewey Class"),

  field = new Field(QLatin1String("loc-classification"), i18n("LOC
Classification"), Field::Para);

I put them at the end of the function, right after 'comments'.  The names
'dewey-class' and 'loc-classification' already existed in my Tellico file --
to get the equivalent for your file, export it (at least one record) to XML,
and look for 'dewey' or whatever you called the field, and get the 'name'.
Here's that line from my .xml file:
   <field title="Dewey Class" flags="0" category="General" format="4"
type="1" name="dewey-class"/>

A useful thing for someone to do would be to research these fields and
propose "correct" names, if we hope to get this functionality included in
the Tellico source in the future.

In src/fetch/srufetcher.cpp's SRUFetcher::allOptionalFields you can add
lines like:
  hash[QLatin1String("dewey-class")] = i18n("Dewey Class"); // Dewey Decimal
if you want to disable the fetching of the Dewey value at runtime (by
unchecking the box in Settings | Configure Tellico... | Data Sources |
Library of Congress | Available Fields).

Add lines like these to xslt/mods2tellico.xsl, changing e.g. 'dewey-class'
to match your own field name (leave 'ddc' alone: it is the string in the
query result returned from the LoC servers):

<xsl:template match="mods:classification">
  <xsl:when test="@authority='lcc'">
    <xsl:value-of select="."/>
   <xsl:when test="@authority='ddc'">
    <xsl:value-of select="."/>

I put those just above the 'xsl:template match="mods:identifier"> line for
isbn/lccn/doi/issn/uri (search for 'doi' which doesn't occur anywhere else
in that file).
If you are going to 'make install', then that .xsl file *should* get
installed to the right place.  If not (i.e. you run 'src/tellico' after
building, instead of installing over your existing tellico package), you'll
need to put it in the right place, per
http://tellico-project.org/faq#n1552.  For me, that was

Dewey appears to have an 'edition' field that the code above isn't returning
(and I don't understand XSL well enough to include it); for example the LoC
web page http://lccn.loc.gov/96008131 will show Dewey Class Number as
"155.9/6 20" but in the returned MODS query it is "<classification
authority="ddc" edition="20">155.9/6</classification>" and the code I wrote
only returns the "155.9/6".  I don't know enough about Dewey to know if that
field is important.

I noticed that SubTitle isn't being fetched; and that subjects/keywords that
should be dashed are being treated as separate subjects (e.g. a book with
"Research --Psychological aspects" and "Space flight --Psychological
aspects" gets imported as "Research; Psychological aspects; Space flight;
Psychological aspects") so I might try to look into those two issues, too.
I'll reply back here if I get anywhere.

It may be useful to sniff the packets so you can see the raw data Tellico is
getting; I put, in srufetcher.cpp after "modsResult = result;", a
"printf("modsResult = %s\n", modsResult.toStdString().c_str());", but
instead of recompiling just for debug info you might prefer:
sudo tcpdump -i wlan0 -s 1514 -X host -w ~/tcpdump.txt
(eth0 instead of wlan0 if you have a wired connection, or whatever else is
appropriate; was the loc.gov server I connected to (I got the
address from a wireshark log))
(do the search, then control-c after it completes)
tcpick -yP -r ~/tcpdump.txt

I did all my testing with the book 'Bold Endeavors' which had the advantages
of having a fairly unique title, having LCC and DDC data, and is a book I
have so I could easily verify the data I got.

A couple notes for Robby:
- the instructions in 'COMPILING' were very helpful.  This was my first time
using cmake so I really appreciated them.
- if I go to http://tellico-project.org/, mouse over 'Help' and then click
on 'Handbook,' I am taken to a blank page
View Source on that page also opens up an empty window.  Ubuntu (GNOME)
10.04 64-bit, Firefox 3.6.6, if it matters.
- after adding the same book a few times (don't know if that was important
or not), if I double-clicked on the entry to bring up the edit view,
sometimes some (but never all) of the data fields (like title, author;
seemed to change every time) would be blank. The data was still there;
pressing escape, then enter to re-open the edit view usually would result in
all the data being shown.  Sorry I don't have better replication
instructions; I was doing this inside my main .tc file (saved in Tellico
2.1.1) with ~250 entries.


Drew Bennett
drewbenn at gmail.com

On Wed, Jul 7, 2010 at 5:57 PM, Derek Tombrello <mrmagnet at bellsouth.net>wrote:

>  Hi...
> I love the Tellico program, but there is one thing that I need that either
> I am overlooking or is not available. I know how to add a Dewey Decimal
> field, but is there anyway that the program can automatically update this
> field? I used to use Collectorz.com software before switching to Linux -
> which would pull the Dewey number from the Library of Congress database.
> Thanks...
>   --
> Derek Tombrellowww.RobotsAndComputers.com
> _______________________________________________
> tellico-users mailing list
> tellico-users at kde.org
> https://mail.kde.org/mailman/listinfo/tellico-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/tellico-users/attachments/20100709/7dcd3c29/attachment.html>

More information about the tellico-users mailing list