holdings

package
v0.1.59 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2016 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package holdings contains wrappers for holding files.

The main format is OVID, an XML-based format, whose XSD can be found under http://rzblx4.uni-regensburg.de/ezeitdata/admin/ezb_export_ovid_v01.xsd

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+>

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

View Source
const (

	// LowDatum16 represents a lowest datum for unspecified start dates.
	// The format is YYYYvvvvvviiiiii (year-volume-issue, zero-padded).
	LowDatum16 = "0000000000000000"

	// HighDatum16 represents a lowest datum for unspecified end dates.
	// The format is YYYYvvvvvviiiiii (year-volume-issue, zero-padded).
	HighDatum16 = "ZZZZZZZZZZZZZZZZ"

	// MaxVolume is the largest year we can sensibly handle.
	MaxYear = "9999"

	// MaxVolume is the largest volume number we can sensibly handle.
	MaxVolume = "999999"

	// MaxVolume is the largest issue number we can sensibly handle.
	MaxIssue = "999999"
)

Variables

View Source
var ISSNPattern = regexp.MustCompile(`^\d\d\d\d-\d\d\d\d$`)

ISSNPattern is the canonical form of an ISSN.

Functions

func CombineDatum

func CombineDatum(year, volume, issue string, empty string) string

CombineDatum combines year, volume and issue into a single value, that preserves the order, if length of year, volume and issue do not exceed 4, 6 and 6, respectively: YYYYvvvvvviiiiii.

Types

type Coverage

type Coverage struct {
	FromYear         int    `xml:"from>year"`
	FromVolume       int    `xml:"from>volume"`
	FromIssue        int    `xml:"from>issue"`
	ToYear           int    `xml:"to>year"`
	ToVolume         int    `xml:"to>volume"`
	ToIssue          int    `xml:"to>issue"`
	Comment          string `xml:"comment"`
	DaysNotAvailable int    `xml:"embargo>days_not_available"`
}

Coverage contains coverage information for an item

type Entitlement

type Entitlement struct {
	Status     string `xml:"status,attr" json:"status"`
	URL        string `xml:"url" json:"url"`
	Anchor     string `xml:"anchor" json:"anchor"`
	FromYear   string `xml:"begin>year" json:"from-year"`
	FromVolume string `xml:"begin>volume" json:"from-volume"`
	FromIssue  string `xml:"begin>issue" json:"from-issue"`
	FromDelay  string `xml:"begin>delay" json:"from-delay"`
	ToYear     string `xml:"end>year" json:"to-year"`
	ToVolume   string `xml:"end>volume" json:"to-volume"`
	ToIssue    string `xml:"end>issue" json:"to-issue"`
	ToDelay    string `xml:"end>delay" json:"to-delay"`
}

Entitlement holds a single OVID entitlement.

type Holding

type Holding struct {
	EZBID        int           `xml:"ezb_id,attr" json:"ezbid"`
	Title        string        `xml:"title" json:"title"`
	Publishers   string        `xml:"publishers" json:"publishers"`
	PISSN        []string      `xml:"EZBIssns>p-issn" json:"pissn"`
	EISSN        []string      `xml:"EZBIssns>e-issn" json:"eissn"`
	Entitlements []Entitlement `xml:"entitlements>entitlement" json:"entitlements"`
}

Holding contains a single holding.

type Item

type Item struct {
	Title string     `xml:"title"`
	ISSN  string     `xml:"issn"`
	Covs  []Coverage `xml:"coverage"`
}

Item is the main google scholar holdings container

type KBART added in v0.1.59

type KBART struct {
	PublicationTitle         string
	PrintIdentifier          string
	OnlineIdentifier         string
	FirstIssueDate           string
	FirstVolume              string
	FirstIssue               string
	LastIssueDate            string
	LastVolume               string
	LastIssue                string
	TitleURL                 string
	FirstAuthor              string
	TitleID                  string
	Embargo                  string
	CoverageDepth            string
	CoverageNotes            string
	PublisherName            string
	InterlibraryRelevance    string
	InterlibraryNationwide   string
	InterlibraryTransmission string
	InterlibraryComment      string
	Publisher                string
	Anchor                   string
	ZDBID                    string
}

KBART: Knowledge Bases And Related Tools working group. A single holding file entry.

type KBARTEntries added in v0.1.59

type KBARTEntries []KBART

KBARTEntries are a list of holding file entries.

func NewKBARTEntries added in v0.1.59

func NewKBARTEntries(r io.Reader) (KBARTEntries, error)

NewKBARTEntries creates a new list of kbart entries from a reader.

type License

type License string

License represents a span of time, which a license covers, expressed as a string of the form `from:to:delay`. Both `from` and `to` are expressed as `YYYYvvvvvviiiiii` (year-volume-issue, zero-padded). Since we resort to string comparisons, `0000000000000000` and `ZZZZZZZZZZZZZZZZ` are valid values for unbounded start and end points in time. The delay must be expressed in nanoseconds, e.g. -2Y would be expressed as `-62208000000000000`.

func NewLicenseFromEntitlement

func NewLicenseFromEntitlement(e Entitlement) (License, error)

NewLicenseFromEntitlement creates a simple License string from the more complex Entitlement structure. If error is nil, the License passed the sanity checks.

func (License) Covers

func (l License) Covers(signature string) bool

Covers returns true, if the given signature falls between the start and end of the license. Moving wall does not play a role here.

func (License) Delay

func (l License) Delay() time.Duration

Delay returns the delay as a duration. This function will halt the world if the license has not passed basic sanity checks. Always use `NewLicenseFromEntitlement` to build a license.

func (License) From

func (l License) From() string

From returns the start of the license range.

func (License) To

func (l License) To() string

To returns the end of the license range.

func (License) Wall

func (l License) Wall(ref time.Time) time.Time

Wall returns the licence wall truncated to day. The moving wall calculation is based on the time given in ref.

type Licenses

type Licenses map[string][]License

Licenses holds the license ranges for an ISSN.

func ParseHoldings

func ParseHoldings(r io.Reader) (Licenses, []error)

ParseHoldings takes a reader and will try to return Licenses, which is just a map from ISSN to []License. Errors are collected and returned as slice.

func (Licenses) Add

func (t Licenses) Add(issn string, license License)

Add adds a license range string to a given ISSN. Dups are ignored.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL