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
- Variables
- type Author
- type ExportSchema
- type IntermediateSchema
- func (is *IntermediateSchema) Allfields() string
- func (is *IntermediateSchema) ISSNList() []string
- func (is *IntermediateSchema) Imprint() (s string)
- func (mj *IntermediateSchema) MarshalJSON() ([]byte, error)
- func (mj *IntermediateSchema) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (is *IntermediateSchema) ParsedDate() time.Time
- func (is *IntermediateSchema) SortableAuthor() string
- func (is *IntermediateSchema) SortableTitle() string
- func (uj *IntermediateSchema) UnmarshalJSON(input []byte) error
- func (uj *IntermediateSchema) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
Constants ¶
const ( AIRecordType = "ai" IntermediateSchemaVersion = "0.9" )
Variables ¶
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) MarshalJSON ¶ added in v0.1.84
func (*Author) MarshalJSONBuf ¶ added in v0.1.84
func (mj *Author) MarshalJSONBuf(buf fflib.EncodingBuffer) error
func (*Author) UnmarshalJSON ¶ added in v0.1.84
func (*Author) UnmarshalJSONFFLexer ¶ added in v0.1.84
type ExportSchema ¶
type ExportSchema interface { // Convert takes an intermediate schema record to export. Returns an // error, if conversion failed. Convert(IntermediateSchema) error // Attach takes a list of strings (here: ISILs) and attaches them to the // current record. Attach([]string) }
ExportSchema encapsulate an export flavour. This will most likely be a struct with fields and methods relevant to the exported format. For the moment we assume, the output is JSON. If formats other than JSON are requested, move the marshalling into this interface.
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.isbn,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"` }
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) 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) MarshalJSON ¶ added in v0.1.84
func (mj *IntermediateSchema) MarshalJSON() ([]byte, error)
func (*IntermediateSchema) MarshalJSONBuf ¶ added in v0.1.84
func (mj *IntermediateSchema) MarshalJSONBuf(buf fflib.EncodingBuffer) error
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
func (*IntermediateSchema) UnmarshalJSON ¶ added in v0.1.84
func (uj *IntermediateSchema) UnmarshalJSON(input []byte) error
func (*IntermediateSchema) UnmarshalJSONFFLexer ¶ added in v0.1.84
func (uj *IntermediateSchema) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error