Citation(Hashable)¶
-
class
metaknowledge.citation.
Citation
(cite, scopusMode=False)¶ A class to hold citation strings and allow for comparison between them.
The initializer takes in a string representing a WOS citation in the form:
Author, Year, Journal, Volume, Page, DOI
Author
is the author’s name in the form of first last name first initial sometimes followed by a period.Year
is the year of publication.Journal
being the 29-Character Source Abbreviation of the journal.Volume
is the volume number(s) of the publication preceded by a VPage
is the page number the record starts onDOI
is the DOI number of the cited record preceeded by the letters'DOI'
Combined they look like:Nunez R., 1998, MATH COGNITION, V4, P85, DOI 10.1080/135467998387343
Note: any of the fields have been known to be missing and the requirements for the fields are not always met. If something is in the source string that cannot be interpreted as any of these it is put in the
misc
attribute. That is the reason to use this class, it gracefully handles missing information while still allowing for comparison between WOS citation strings.Customizations¶
Citation’s hashing and equality checking are based on ID() and use the values of
author
,year
andjournal
.When converted to a string a Citation will return the original string.
Attributes¶
As noted above, citations are considered to be divided into six distinct fields (
Author
,Year
,Journal
,Volume
,Page
andDOI
) with a seventhmisc
for anything not in those. Records thus have an attribute with a name corresponding to eachauthor
,year
,journal
,V
,P
,DOI
andmisc
respectively. These are created if there is anything in the field. So aCitation
created from the string:'Nunez R., 1998, MATH COGNITION'
would haveauthor
,year
andjournal
defined. While one from'Nunez R.'
would have only the attributemisc
.If the parsing of a citation string fails the attribute
bad
is set toTrue
and the attributeerror
is created to contain said error, which is a BadCitation object. If no errors occurbad
isFalse
.The attribute
original
is the unmodified string (cite) given to create the Citation, it can also be accessed by converting to a string, e.g. withstr()
.__Init__¶
Citations can be created by Records or by giving the initializer a string containing a WOS style citation.
Parameters¶
cite :
str
A str containing a WOS style citation.-
Extra
()¶ Returns any
V
,P
,DOI
ormisc
values as a string. These are all the values not returned by ID(), they are separated by' ,'
.
-
FullJournalName
()¶ Returns the full name of the Citation’s journal field. Requires the j9Abbreviations database file.
Note: Requires the j9Abbreviations database file and will raise an error if it cannot be found.
-
ID
()¶ Returns all of
author
,year
andjournal
available separated by' ,'
. It is for shortening labels when creating networks as the resultant strings are often unique. Extra() gets everything not returned by ID().This is also used for hashing and equality checking.
-
__eq__
(other)¶ First checks DOI for equality then checks each attribute if any are not equal False is returned
-
__hash__
()¶ A hash for Citation that should be equal to the hash of other citations that are equal to it. Based on the values returned by ID().
-
__init__
(cite, scopusMode=False)¶ Initialize self. See help(type(self)) for accurate signature.
-
__repr__
()¶ the representation of the Citation is its original form
-
__str__
()¶ returns the original string
-
__weakref__
¶ list of weak references to the object (if defined)
-
addToDB
(manualName=None, manualDB='manualj9Abbreviations', invert=False)¶ Adds the journal of this Citation to the user created database of journals. This will cause isJournal() to return
True
for this Citation and all others with itsjournal
.Note: Requires the j9Abbreviations database file and will raise an error if it cannot be found.
-
allButDOI
()¶ Returns a string of the normalized values from the Citation excluding the DOI number. Equivalent to getting the ID with ID() then appending the extra values from Extra() and then removing the substring containing the DOI number.
-
isAnonymous
()¶ Checks if the author is given as
'[ANONYMOUS]'
and returnsTrue
if so.
-
isJournal
(dbname='j9Abbreviations', manualDB='manualj9Abbreviations', returnDict='both', checkIfExcluded=False)¶ Returns
True
if theCitation
’sjournal
field is a journal abbreviation from the WOS listing found at http://images.webofknowledge.com/WOK46/help/WOS/A_abrvjt.html, i.e. checks if the citation is citing a journal.Note: Requires the j9Abbreviations database file and will raise an error if it cannot be found.
Note: All parameters are used for getting the data base with getj9dict.
-