Documentation ¶
Overview ¶
Copyright 2015 by Leipzig University Library, http://ub.uni-leipzig.de The Finc Authors, http://finc.info Martin Czygan, <martin.czygan@uni-leipzig.de>
This file is part of some open source application.
Some open source application is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Some open source application is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Foobar. If not, see <http://www.gnu.org/licenses/>.
@license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+>
Index ¶
- Constants
- Variables
- type BulkResponse
- type DateField
- type DatePart
- type Document
- func (doc *Document) Authors() (authors []finc.Author)
- func (doc *Document) CombinedTitle() string
- func (doc *Document) FindLanguages() []string
- func (doc *Document) FindShortTitle() (s string)
- func (doc *Document) ID() string
- func (doc *Document) PageInfo() PageInfo
- func (doc *Document) ToIntermediateSchema() (*finc.IntermediateSchema, error)
- type PageInfo
Constants ¶
const (
// Internal bookkeeping.
SourceID = "49"
)
Variables ¶
var ( DefaultFormat = "ElectronicArticle" // Load assets Formats = assetutil.MustLoadStringMap("assets/crossref/formats.json") Genres = assetutil.MustLoadStringMap("assets/crossref/genres.json") RefTypes = assetutil.MustLoadStringMap("assets/crossref/reftypes.json") // AuthorReplacer is a special cleaner for author names. AuthorReplacer = strings.NewReplacer("#", "", "--", "", "*", "", "|", "", "&NA;", "", "\u0026NA;", "", "\u0026", "") // ArticleTitleBlocker will trigger skips, if article title matches exactly. ArticleTitleBlocker = []string{"Titelei", "Front Matter", "Advertisement", "Advertisement:"} // ArticleTitleCleanerPatterns removes matching parts. ArticleTitleCleanerPatterns = []*regexp.Regexp{ regexp.MustCompile(`[?]{6,}`), } // Future ends soon. Future = time.Now().Add(time.Hour * 24 * 365 * 2) )
Functions ¶
This section is empty.
Types ¶
type BulkResponse ¶
type BulkResponse struct { Status string `json:"status"` MessageType string `json:"message-type"` MessageVersion string `json:"message-version"` Message struct { NextCursor string `json:"next-cursor"` TotalResults int `json:"total-results"` Items []Document `json:"items"` } `json:"message"` }
BulkResponse for a bulk request containing multiple items.
type DateField ¶
type DateField struct { DateParts []DatePart `json:"date-parts"` DateTime string `json:"date-time"` Timestamp int64 `json:"timestamp"` }
DateField contains two representations of one value.
type DatePart ¶
type DatePart []int
DatePart consists of up to three int, representing year, month, day.
type Document ¶
type Document struct { Abstract string `json:"abstract"` Author []struct { Family string `json:"family"` Given string `json:"given"` } `json:"author"` ContainerTitle []string `json:"container-title"` ContentDomain struct { CrossmarkRestriction bool `json:"crossmark-restriction"` Domain []interface{} `json:"domain"` } `json:"content-domain"` Created DateField `json:"created"` DOI string Deposited DateField `json:"deposited"` ISBN []string ISSN []string Indexed DateField `json:"indexed"` IsReferencedByCount int64 `json:"is-referenced-by-count"` IsbnType []struct { Type string `json:"type"` Value string `json:"value"` } `json:"isbn-type"` IssnType []struct { Type string `json:"type"` Value string `json:"value"` } `json:"issn-type"` Issue string `json:"issue"` Issued DateField `json:"issued"` JournalIssue struct { Issue string `json:"issue"` PublishedPrint DateField `json:"published-print"` } `json:"journal-issue"` Language string `json:"language"` License []struct { ContentVersion string `json:"content-version"` DelayInDays int64 `json:"delay-in-days"` Start DateField `json:"start"` URL string } `json:"license"` Link []struct { ContentType string `json:"content-type"` ContentVersion string `json:"content-version"` IntendedApplication string `json:"intended-application"` URL string } `json:"link"` Member string `json:"member"` OriginalTitle []interface{} `json:"original-title"` Page string `json:"page"` Prefix string `json:"prefix"` PublishedPrint DateField `json:"published-print"` Publisher string `json:"publisher"` ReferenceCount int64 `json:"reference-count"` ReferencesCount int64 `json:"references-count"` Relation struct { } `json:"relation"` Score float64 `json:"score"` ShortContainerTitle []string `json:"short-container-title"` ShortTitle interface{} `json:"short-title"` Source string `json:"source"` Subject []string `json:"subject"` Subtitle []string `json:"subtitle"` Title []string `json:"title"` Type string `json:"type"` URL string `json:"URL"` Volume string `json:"volume"` }
Document is an updated v1 crossref API message.
func (*Document) CombinedTitle ¶
CombinedTitle returns a longish title.
func (*Document) FindLanguages ¶ added in v0.1.261
FindLanguages tries to find language, falls back to English.
func (*Document) FindShortTitle ¶ added in v0.1.261
FindShortTitle returns the first main title only.
func (*Document) ID ¶
ID is of the form <kind>-<source-id>-<id-base64-unpadded> We simple map any primary key of the source (preferably a URL) to a safer alphabet. Since the base64 part is not meant to be decoded we drop the padding. It is simple enough to recover the original value.
func (*Document) PageInfo ¶
PageInfo parses a page specfication in a best effort manner into a PageInfo struct.
func (*Document) ToIntermediateSchema ¶
func (doc *Document) ToIntermediateSchema() (*finc.IntermediateSchema, error)
ToIntermediateSchema converts a crossref document into IS. XXX: Use a canonical publisher, based on doi prefix, /cc @ad.