filter

package
v0.1.64 Latest Latest
Warning

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

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

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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Any

type Any struct{}

Any always returns true.

func (Any) Apply

func (f Any) Apply(is finc.IntermediateSchema) bool

Apply filter.

type CollectionFilter

type CollectionFilter struct {
	Set *container.StringSet
}

CollectionFilter allows any record that belongs to a collection, that is listed in Names. TODO(miku): better: MegaCollectionFilter?

func NewCollectionFilter

func NewCollectionFilter(r io.Reader) (CollectionFilter, error)

func (CollectionFilter) Apply

Apply filter.

func (CollectionFilter) MarshalJSON

func (f CollectionFilter) MarshalJSON() ([]byte, error)

MarshalJSON provides custom serialization.

type DOIFilter

type DOIFilter struct {
	Set *container.StringSet
}

DOIFilter will exclude DOIs, that are listed in Set.

func NewDOIFilter

func NewDOIFilter(r io.Reader) (DOIFilter, error)

TODO(miku): Simplify set filters: ISSNFilter, MegaCollectionFilter, DOIFilter, ...

func (DOIFilter) Apply

func (f DOIFilter) Apply(is finc.IntermediateSchema) bool

Apply filter.

func (DOIFilter) MarshalJSON

func (f DOIFilter) MarshalJSON() ([]byte, error)

MarshalJSON provides custom serialization.

type Filter

type Filter interface {
	Apply(finc.IntermediateSchema) bool
}

Filter wraps the decision, whether a given IntermediateSchema record should be attached or not. The decision may be based on record properties, simple ISSN lists or more involved holdings files.

type HoldingFilter

type HoldingFilter struct {
	Ref   time.Time
	Table holdings.Licenses
}

HoldingFilter looks at licensing information from an OVID files. Ref is the reference date for moving wall calculations and Table contains a map from ISSNs to licenses.

func NewHoldingFilter

func NewHoldingFilter(r io.Reader) (HoldingFilter, error)

NewHoldingFilter loads the holdings information for a single institution. Returns a single error, if one or more errors have been encountered.

func (HoldingFilter) Apply

HoldingFilter compares the (year, volume, issue) of an intermediate schema record with licensing information, including moving walls.

func (HoldingFilter) MarshalJSON

func (f HoldingFilter) MarshalJSON() ([]byte, error)

MarshalJSON provides custom serialization.

type ISILTagger

type ISILTagger map[string][]Filter

ISILTagger maps ISILs to one or more Filters. If any of these filters return true, the ISIL shall be attached (therefore order of the filters does not matter).

func (ISILTagger) Tags

Tags returns all ISILs that could be attached to a given intermediate schema record. If an ISIL has multiple filters, each filter is applied in order, if any matches, the ISIL is added. TODO(miku): maybe we need order, like "attach any record, but filter out those, that contain x in field y" or attach all records where x == y, but of those ignore those, that are given in this list, etc.

type ListFilter

type ListFilter struct {
	Set *container.StringSet
}

ListFilter will include records, whose ISSN is contained in a given set. TODO(miku): The name ListFilter is much too generic for an ISSNFilter.

func NewListFilter

func NewListFilter(r io.Reader) (ListFilter, error)

NewAttachByList reads one record per line from reader. Empty lines are ignored.

func (ListFilter) Apply

func (f ListFilter) Apply(is finc.IntermediateSchema) bool

Apply filter.

func (ListFilter) MarshalJSON

func (f ListFilter) MarshalJSON() ([]byte, error)

MarshalJSON provides custom serialization.

type PackageFilter added in v0.1.59

type PackageFilter struct {
	Set *container.StringSet
}

DOIFilter will exclude DOIs, that are listed in Set.

func NewPackageFilter added in v0.1.59

func NewPackageFilter(r io.Reader) (PackageFilter, error)

TODO(miku): Simplify set filters: ISSNFilter, MegaCollectionFilter, DOIFilter, ...

func (PackageFilter) Apply added in v0.1.59

Apply filter.

func (PackageFilter) MarshalJSON added in v0.1.59

func (f PackageFilter) MarshalJSON() ([]byte, error)

MarshalJSON provides custom serialization.

type SourceFilter

type SourceFilter struct {
	SourceID string
}

SourceFilter allows to attach ISIL on records of a given source.

func (SourceFilter) Apply

Apply filter.

func (SourceFilter) MarshalJSON

func (f SourceFilter) MarshalJSON() ([]byte, error)

MarshalJSON provides custom serialization.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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