finc

package
v0.1.137 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2017 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package finc holds finc SolrSchema (SOLR) and intermediate schema related types and methods.

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 (
	AIRecordType              = "ai"
	IntermediateSchemaVersion = "0.9"
)

Variables

View Source
var (
	NOT_ASSIGNED    = "not assigned"
	NonAlphaNumeric = regexp.MustCompile("/[^A-Za-z0-9]+/")
)

Functions

This section is empty.

Types

type Author

type Author struct {
	ID           string `json:"x.id,omitempty"`
	Name         string `json:"rft.au,omitempty"`
	LastName     string `json:"rft.aulast,omitempty"`
	FirstName    string `json:"rft.aufirst,omitempty"`
	Initial      string `json:"rft.auinit,omitempty"`
	FirstInitial string `json:"rft.auinit1,omitempty"`
	MiddleName   string `json:"rft.auinitm,omitempty"`
	Suffix       string `json:"rft.ausuffix,omitempty"`
	Corporation  string `json:"rft.aucorp,omitempty"`
}

Author representes an author, "inspired" by OpenURL.

func (*Author) String

func (author *Author) String() string

String returns a formatted author string. TODO(miku): make this complete.

type Exporter added in v0.1.125

type Exporter interface {
	// Export turns an intermediate schema into bytes. Lower level
	// representation than ExportSchema.Convert. Allows JSON, XML, Marc,
	// Formeta and other formats.
	Export(is IntermediateSchema, withFullrecord bool) ([]byte, error)
}

type IntermediateSchema

type IntermediateSchema struct {
	Format         string `json:"finc.format,omitempty"`
	MegaCollection string `json:"finc.mega_collection,omitempty"`
	RecordID       string `json:"finc.record_id,omitempty"`
	SourceID       string `json:"finc.source_id,omitempty"`

	Database     string `json:"ris.db,omitempty"`
	DataProvider string `json:"ris.dp,omitempty"`
	RefType      string `json:"ris.type,omitempty"`

	ArticleNumber string `json:"rft.artnum,omitempty"`
	ArticleTitle  string `json:"rft.atitle,omitempty"`

	BookTitle    string   `json:"rft.btitle,omitempty"`
	Chronology   string   `json:"rft.chron,omitempty"`
	Edition      string   `json:"rft.edition,omitempty"`
	EISBN        []string `json:"rft.eisbn,omitempty"`
	EISSN        []string `json:"rft.eissn,omitempty"`
	EndPage      string   `json:"rft.epage,omitempty"`
	Genre        string   `json:"rft.genre,omitempty"`
	ISBN         []string `json:"rft.isbn,omitempty"`
	ISSN         []string `json:"rft.issn,omitempty"`
	Issue        string   `json:"rft.issue,omitempty"`
	JournalTitle string   `json:"rft.jtitle,omitempty"`
	PageCount    string   `json:"rft.tpages,omitempty"`
	Pages        string   `json:"rft.pages,omitempty"`
	Part         string   `json:"rft.part,omitempty"`
	Places       []string `json:"rft.place,omitempty"`
	Publishers   []string `json:"rft.pub,omitempty"`
	Quarter      string   `json:"rft.quarter,omitempty"`

	// TODO(miku): we do not need both dates
	RawDate string    `json:"rft.date,omitempty"`
	Date    time.Time `json:"x.date,omitempty"`

	Season     string `json:"rft.ssn,omitempty"`
	Series     string `json:"rft.series,omitempty"`
	ShortTitle string `json:"rft.stitle,omitempty"`
	StartPage  string `json:"rft.spage,omitempty"`
	Volume     string `json:"rft.volume,omitempty"`

	Abstract  string   `json:"abstract,omitempty"`
	Authors   []Author `json:"authors,omitempty"`
	DOI       string   `json:"doi,omitempty"`
	Languages []string `json:"languages,omitempty"`
	URL       []string `json:"url,omitempty"`
	Version   string   `json:"version,omitempty"`

	ArticleSubtitle string   `json:"x.subtitle,omitempty"`
	Fulltext        string   `json:"x.fulltext,omitempty"`
	Headings        []string `json:"x.headings,omitempty"`
	Subjects        []string `json:"x.subjects,omitempty"`
	Type            string   `json:"x.type,omitempty"`

	// Indicator can hold update related information, e.g. in GBI the filedate
	Indicator string `json:"x.indicator,omitempty"`
	// Packages can hold set information, e.g. in GBI the licenced package or GBI database
	Packages []string `json:"x.packages,omitempty"`
	// Labels can carry a list of marks for a given records, e.g. ISILs
	Labels []string `json:"x.labels,omitempty"`

	// OpenAccess, refs. #8986, prototype
	OpenAccess bool     `json:"x.oa,omitempty"`
	License    []string `json:"x.license,omitempty"`
}

IntermediateSchema abstract and collects the values of various input formats. Goal is to simplify further processing by using a single format, from which the next artifacts can be derived, e.g. records for solr indices. This format can be viewed as a catch-all format. The dotted notation hints at the origin of the field, e.g. OpenURL, RIS, finc.

Notes on the format: - The x namespace is experimental. - RawDate must be in ISO8601 (YYYY-MM-DD) format. - Version is mandatory. - Headings and Subjects are not bound to any format yet. - Use plural for slices, if possible.

func NewIntermediateSchema

func NewIntermediateSchema() *IntermediateSchema

func (*IntermediateSchema) Allfields

func (is *IntermediateSchema) Allfields() string

Allfields returns a combination of various fields.

func (*IntermediateSchema) ISBNList added in v0.1.128

func (is *IntermediateSchema) ISBNList() []string

ISBNList returns a deduplicated list of all ISBN and EISBN.

func (*IntermediateSchema) ISSNList

func (is *IntermediateSchema) ISSNList() []string

ISSNList returns a deduplicated list of all ISSN and EISSN.

func (*IntermediateSchema) Imprint

func (is *IntermediateSchema) Imprint() (s string)

Imprint MARC 260 a, b, c (trad.)

func (*IntermediateSchema) ParsedDate

func (is *IntermediateSchema) ParsedDate() time.Time

ParsedDate turns tries to turn a raw date string into a date. TODO(miku): sources need to enforce a format, maybe enforce it here, too?

func (*IntermediateSchema) SortableAuthor

func (is *IntermediateSchema) SortableAuthor() string

SortableAuthor is loosely based on solrmarcs builtin getSortableAuthor

func (*IntermediateSchema) SortableTitle

func (is *IntermediateSchema) SortableTitle() string

SortableAuthor is loosely based on solrmarcs builtin getSortableTitle

type StrippedSchema added in v0.1.109

type StrippedSchema struct {
	DOI      string   `json:"doi"`
	Labels   []string `json:"x.labels"`
	SourceID string   `json:"finc.source_id"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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