elsevier

package
v0.1.317 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2020 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

TODO.

Index

Constants

View Source
const (
	SourceID   = "85"
	Format     = "ElectronicArticle"
	Collection = "Elsevier Journals"
	Genre      = "article"
	// Default ris.type
	DefaultRefType = "EJOUR"
)

Variables

View Source
var (
	ErrNoYearFound     = errors.New("no year found")
	ErrTarFileRequired = errors.New("a tar file is required")
)

Functions

This section is empty.

Types

type Article

type Article struct {
	xml.Name   `xml:"article"`
	Xlink      string `xml:"xlink,attr"`
	Ce         string `xml:"ce,attr"`
	Sb         string `xml:"sb,attr"`
	Docsubtype string `xml:"docsubtype,attr"`
	Version    string `xml:"version,attr"`
	Lang       string `xml:"lang,attr"`
	ItemInfo   struct {
		Jid       string `xml:"jid"`
		Aid       string `xml:"aid"`
		Pii       string `xml:"pii"`
		Doi       string `xml:"doi"`
		Copyright struct {
			Type string `xml:"type,attr"`
			Year string `xml:"year,attr"`
		} `xml:"copyright"`
	} `xml:"item-info"`
	Head struct {
		ArticleFootnote string `xml:"article-footnote"`
		Dochead         struct {
			Id     string `xml:"id,attr"`
			Textfn string `xml:"textfn"`
		} `xml:"dochead"`
		Title       string `xml:"title"`
		AuthorGroup struct {
			Id     string `xml:"id,attr"`
			Author []struct {
				Id        string `xml:"id,attr"`
				Orcid     string `xml:"orcid,attr"`
				GivenName string `xml:"given-name"`
				Surname   string `xml:"surname"`
				Degrees   string `xml:"degrees"`
				CrossRef  struct {
					Refid string `xml:"refid,attr"`
					Id    string `xml:"id,attr"`
					Sup   string `xml:"sup"`
				} `xml:"cross-ref"`
				EAddress struct {
					Type string `xml:"type,attr"`
					Id   string `xml:"id,attr"`
				} `xml:"e-address"`
			} `xml:"author"`
			Affiliation struct {
				Id          string `xml:"id,attr"`
				Textfn      string `xml:"textfn"`
				Affiliation struct {
					Sa           string   `xml:"sa,attr"`
					Organization []string `xml:"organization"`
					AddressLine  string   `xml:"address-line"`
					City         string   `xml:"city"`
					State        string   `xml:"state"`
					PostalCode   string   `xml:"postal-code"`
					Country      string   `xml:"country"`
				} `xml:"affiliation"`
			} `xml:"affiliation"`
			Correspondence struct {
				Id    string `xml:"id,attr"`
				Label string `xml:"label"`
				Text  string `xml:"text"`
			} `xml:"correspondence"`
		} `xml:"author-group"`
		DateReceived struct {
			Day   string `xml:"day,attr"`
			Month string `xml:"month,attr"`
			Year  string `xml:"year,attr"`
		} `xml:"date-received"`
		DateRevised struct {
			Day   string `xml:"day,attr"`
			Month string `xml:"month,attr"`
			Year  string `xml:"year,attr"`
		} `xml:"date-revised"`
		DateAccepted struct {
			Day   string `xml:"day,attr"`
			Month string `xml:"month,attr"`
			Year  string `xml:"year,attr"`
		} `xml:"date-accepted"`
		Abstract []struct {
			Text         string `xml:",innerxml"`
			Lang         string `xml:"lang,attr"`
			Id           string `xml:"id,attr"`
			View         string `xml:"view,attr"`
			Class        string `xml:"class,attr"`
			SectionTitle string `xml:"section-title"`
			AbstractSec  []struct {
				Role         string `xml:"role,attr"`
				Id           string `xml:"id,attr"`
				View         string `xml:"view,attr"`
				SectionTitle string `xml:"section-title"`
				SimplePara   struct {
					Id   string `xml:"id,attr"`
					View string `xml:"view,attr"`
					List struct {
						Id       string `xml:"id,attr"`
						ListItem []struct {
							Id    string `xml:"id,attr"`
							Label string `xml:"label"`
							Para  struct {
								Id   string `xml:"id,attr"`
								View string `xml:"view,attr"`
							} `xml:"para"`
						} `xml:"list-item"`
					} `xml:"list"`
				} `xml:"simple-para"`
			} `xml:"abstract-sec"`
		} `xml:"abstract"`
		Keywords struct {
			Lang         string `xml:"lang,attr"`
			Id           string `xml:"id,attr"`
			View         string `xml:"view,attr"`
			Class        string `xml:"class,attr"`
			SectionTitle string `xml:"section-title"`
			Keyword      []struct {
				Id   string `xml:"id,attr"`
				Text string `xml:"text"`
			} `xml:"keyword"`
		} `xml:"keywords"`
	} `xml:"head"`
	// in case of a "simple-article", carry this field as well
	SimpleHead struct {
		Title       string `xml:"title"`
		AuthorGroup struct {
			Id     string `xml:"id,attr"`
			Author []struct {
				Id        string `xml:"id,attr"`
				GivenName string `xml:"given-name"`
				Surname   string `xml:"surname"`
				EAddress  struct {
					Id   string `xml:"id,attr"`
					Type string `xml:"type,attr"`
				} `xml:"e-address"`
			} `xml:"author"`
			Affiliation struct {
				Id          string `xml:"id,attr"`
				Textfn      string `xml:"textfn"`
				Affiliation struct {
					Sa           string   `xml:"sa,attr"`
					Organization []string `xml:"organization"`
					AddressLine  string   `xml:"address-line"`
					City         string   `xml:"city"`
					PostalCode   string   `xml:"postal-code"`
					Country      string   `xml:"country"`
				} `xml:"affiliation"`
			} `xml:"affiliation"`
		} `xml:"author-group"`
	} `xml:"simple-head"`
}

Article describes a single article.

func (Article) Authors

func (article Article) Authors() []finc.Author

func (Article) Date

func (article Article) Date() (time.Time, error)

Date returns the date of the article. Currently use the date-received attribute.

func (Article) Title

func (article Article) Title() string

type Dataset

type Dataset struct {
	xml.Name         `xml:"dataset"`
	SchemaVersion    string `xml:"schema-version,attr"`
	Xsi              string `xml:"xsi,attr"`
	SchemaLocation   string `xml:"schemaLocation,attr"`
	DatasetUniqueIds struct {
		ProfileCode      string `xml:"profile-code"`
		ProfileDatasetId string `xml:"profile-dataset-id"`
		Timestamp        string `xml:"timestamp"`
	} `xml:"dataset-unique-ids"`
	DatasetProperties struct {
		DatasetAction     string `xml:"dataset-action"`
		ProductionProcess string `xml:"production-process"`
	} `xml:"dataset-properties"`
	DatasetContent struct {
		JournalIssue []struct {
			Version struct {
				VersionNumber string `xml:"version-number"`
				Stage         string `xml:"stage"`
			} `xml:"version"`
			JournalIssueUniqueIds struct {
				Pii    string `xml:"pii"`
				Doi    string `xml:"doi"`
				JidAid struct {
					Jid  string `xml:"jid"`
					Issn string `xml:"issn"`
					Aid  string `xml:"aid"`
				} `xml:"jid-aid"`
			} `xml:"journal-issue-unique-ids"`
			JournalIssueProperties struct {
				Jid               string `xml:"jid"`
				Issn              string `xml:"issn"`
				VolumeIssueNumber struct {
					VolFirst string `xml:"vol-first"`
					Suppl    string `xml:"suppl"`
				} `xml:"volume-issue-number"`
				CollectionTitle string `xml:"collection-title"`
			} `xml:"journal-issue-properties"`
			FilesInfo struct {
				Ml []struct {
					Pathname   string `xml:"pathname"`
					Filesize   string `xml:"filesize"`
					Purpose    string `xml:"purpose"`
					DTDVersion string `xml:"dtd-version"`
				} `xml:"ml"`
			} `xml:"files-info"`
		} `xml:"journal-issue"`
		JournalItem []struct {
			CrossMark string `xml:"cross-mark,attr"`
			Version   struct {
				VersionNumber string `xml:"version-number"`
				Stage         string `xml:"stage"`
			} `xml:"version"`
			JournalItemUniqueIds struct {
				Pii    string `xml:"pii"`
				Doi    string `xml:"doi"`
				JidAid struct {
					Jid  string `xml:"jid"`
					Issn string `xml:"issn"`
					Aid  string `xml:"aid"`
				} `xml:"jid-aid"`
			} `xml:"journal-item-unique-ids"`
			JournalItemProperties struct {
				Pit                   string `xml:"pit"`
				ProductionType        string `xml:"production-type"`
				OnlinePublicationDate string `xml:"online-publication-date"`
			} `xml:"journal-item-properties"`
			FilesInfo struct {
				Ml []struct {
					Pathname   string `xml:"pathname"`
					Filesize   string `xml:"filesize"`
					Purpose    string `xml:"purpose"`
					DTDVersion string `xml:"dtd-version"`
				} `xml:"ml"`
			} `xml:"files-info"`
		} `xml:"journal-item"`
	} `xml:"dataset-content"`
}

Dataset describes journal issues and items, usually inside a dataset.xml.

type Pages

type Pages struct {
	FirstPage string `xml:"first-page"`
	LastPage  string `xml:"last-page"`
}

Pages is a helper, so we can calculate the total.

func (Pages) Total

func (p Pages) Total() string

Total number of pages. Will not do any plausibility checks.

type SerialIssue

type SerialIssue struct {
	xml.Name  `xml:"serial-issue"`
	IssueInfo struct {
		Pii               string `xml:"pii"`
		Jid               string `xml:"jid"`
		Issn              string `xml:"issn"`
		VolumeIssueNumber struct {
			VolFirst string `xml:"vol-first"`
			IssFirst string `xml:"iss-first"`
		} `xml:"volume-issue-number"`
	} `xml:"issue-info"`
	IssueData struct {
		CoverDate struct {
			DateRange struct {
				StartDate string `xml:"start-date"`
			} `xml:"date-range"`
		} `xml:"cover-date"`
		Pages      []Pages `xml:"pages"`
		CoverImage string  `xml:"cover-image"`
	} `xml:"issue-data"`
	IssueBody struct {
		IncludeItem []struct {
			Pii   string `xml:"pii"`
			Doi   string `xml:"doi"`
			Pages string `xml:"pages"`
		} `xml:"include-item"`
		IssueSec []struct {
			SectionTitle string `xml:"section-title"`
			IncludeItem  []struct {
				Pii   string `xml:"pii"`
				Doi   string `xml:"doi"`
				Pages Pages  `xml:"pages"`
			} `xml:"include-item"`
		} `xml:"issue-sec"`
	} `xml:"issue-body"`
}

SerialIssue contains information about an issue, usually inside issue.xml.

type Shipment

type Shipment struct {
	// contains filtered or unexported fields
}

Shipment is a tar export, looks like SAXC0000000000046A.tar. The tar is not extracted but loaded into memory at once. Issues and articles are stored in a map, each keyed on the PII.

func NewShipment

func NewShipment(r io.Reader) (Shipment, error)

NewShipment creates a new bag of data from a given tarfile.

func (Shipment) BatchConvert

func (s Shipment) BatchConvert() ([]finc.IntermediateSchema, error)

BatchConvert converts all items for a shipment into importable objects.

func (Shipment) String

func (s Shipment) String() string

String describes the shipment briefly.

Jump to

Keyboard shortcuts

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