jats

package
v0.1.130 Latest Latest
Warning

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

Go to latest
Published: May 28, 2018 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Article

type Article struct {
	XMLName xml.Name `xml:"article"`
	Type    string   `xml:"article-type,attr"`
	Front   struct {
		XMLName xml.Name `xml:"front"`
		Journal struct {
			ID struct {
				XMLName xml.Name `xml:"journal-id"`
				Type    string   `xml:"journal-id-type,attr"`
				Value   string   `xml:",chardata"`
			}
			ISSN []struct {
				Type  string `xml:"pub-type,attr"`
				Value string `xml:",chardata"`
			} `xml:"issn"`
			TitleGroup struct {
				XMLName      xml.Name `xml:"journal-title-group"`
				JournalTitle struct {
					XMLName xml.Name `xml:"journal-title"`
					Title   string   `xml:",chardata"`
				}
				AbbreviatedTitle struct {
					XMLName xml.Name `xml:"abbrev-journal-title"`
					Title   string   `xml:",chardata"`
					Type    string   `xml:"abbrev-type,attr"`
				}
			}
			AbbreviatedTitle struct {
				XMLName xml.Name `xml:"abbrev-journal-title"`
				Title   string   `xml:",chardata"`
				Type    string   `xml:"abbrev-type,attr"`
			}
			Publisher struct {
				XMLName xml.Name `xml:"publisher"`
				Name    struct {
					XMLName xml.Name `xml:"publisher-name"`
					Value   string   `xml:",chardata"`
				}
			}
		} `xml:"journal-meta"`
		Article struct {
			XMLName xml.Name `xml:"article-meta"`
			ID      []struct {
				Type  string `xml:"pub-id-type,attr"`
				Value string `xml:",chardata"`
			} `xml:"article-id"`
			TitleGroup struct {
				XMLName xml.Name `xml:"title-group"`
				Title   struct {
					XMLName xml.Name `xml:"article-title"`
					Value   string   `xml:",chardata"`
				}
				Subtitle struct {
					XMLName xml.Name `xml:"subtitle"`
					Value   string   `xml:",chardata"`
				}
			}
			ContribGroup struct {
				XMLName xml.Name `xml:"contrib-group"`
				Contrib []struct {
					Type      string `xml:"contrib-type,attr"`
					XLinkType string `xml:"xlink.type,attr"`
					Name      struct {
						XMLName xml.Name `xml:"name"`
						Style   string   `xml:"name-style"`
						Surname struct {
							XMLName xml.Name `xml:"surname"`
							Value   string   `xml:",chardata"`
						}
						GivenNames struct {
							XMLName xml.Name `xml:"given-names"`
							Value   string   `xml:",chardata"`
						}
					}
					StringName struct {
						XMLName xml.Name `xml:"string-name"`
						Surname struct {
							XMLName xml.Name `xml:"surname"`
							Value   string   `xml:",chardata"`
						}
						GivenNames struct {
							XMLName xml.Name `xml:"given-names"`
							Value   string   `xml:",chardata"`
						}
						X struct {
							XMLName xml.Name `xml:"x"`
							Value   string   `xml:",chardata"`
						}
						Suffix struct {
							XMLName xml.Name `xml:"suffix"`
							Value   string   `xml:",chardata"`
						}
					}
				} `xml:"contrib"`
			}
			Categories struct {
				XMLName       xml.Name `xml:"article-categories"`
				SubjectGroups []struct {
					Type     string `xml:"subj-group-type,attr"`
					Subjects []struct {
						Value string `xml:",chardata"`
					} `xml:"subject"`
				} `xml:"subj-group"`
			} `xml:"article-categories"`
			PubDates []PubDate `xml:"pub-date"`
			Volume   struct {
				XMLName xml.Name `xml:"volume"`
				Value   string   `xml:",chardata"`
			}
			Issue struct {
				XMLName xml.Name `xml:"issue"`
				Value   string   `xml:",chardata"`
			}
			FirstPage struct {
				XMLName xml.Name `xml:"fpage"`
				Value   string   `xml:",chardata"`
			}
			LastPage struct {
				XMLName xml.Name `xml:"lpage"`
				Value   string   `xml:",chardata"`
			}
			Products []struct {
				Source struct {
					XMLName xml.Name `xml:"source"`
					Value   string   `xml:",innerxml"`
				}
				StringName struct {
					XMLName xml.Name `xml:"string-name"`
					Value   string   `xml:",innerxml"`
				}
			} `xml:"product"`
			Permissions struct {
				XMLName       xml.Name `xml:"permissions"`
				CopyrightYear struct {
					XMLName xml.Name `xml:"copyright-year"`
					Value   string   `xml:",chardata"`
				}
				CopyrightStatement struct {
					XMLName xml.Name `xml:"copyright-statement"`
					Value   string   `xml:",chardata"`
				}
			}
			Abstract struct {
				XMLName xml.Name `xml:"abstract"`
				Value   string   `xml:",innerxml"`
				Lang    string   `xml:"lang,attr"`
			}
			TranslatedAbstract struct {
				XMLName xml.Name `xml:"trans-abstract"`
				Lang    string   `xml:"lang,attr"`
				Title   struct {
					XMLName xml.Name `xml:"title"`
					Value   string   `xml:",innerxml"`
				}
			}
			KeywordGroup struct {
				XMLName xml.Name `xml:"kwd-group"`
				Title   struct {
					XMLName xml.Name `xml:"title"`
					Value   string   `xml:",chardata"`
				}
				Keywords []struct {
					Value string `xml:",chardata"`
				} `xml:"kwd"`
			}
			SelfURI struct {
				XMLName xml.Name `xml:"self-uri"`
				Value   string   `xml:"href,attr"`
			}
			CustomMetaGroup struct {
				XMLName    xml.Name `xml:"custom-meta-group"`
				CustomMeta []struct {
					Name struct {
						XMLName xml.Name `xml:"meta-name"`
						Value   string   `xml:",chardata"`
					}
					Value struct {
						XMLName xml.Name `xml:"meta-value"`
						Value   string   `xml:",chardata"`
					}
				} `xml:"custom-meta"`
			}
		}
	}
	Body struct {
		XMLName xml.Name `xml:"body"`
		Section struct {
			XMLName xml.Name `xml:"sec"`
			Type    string   `xml:"sec-type,attr"`
			Value   string   `xml:",innerxml"`
		}
	}
}

Article mirrors a JATS article element.

func (*Article) Authors

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

Authors returns the authors as slice. TODO(miku): get rid of cross-format dependency.

func (*Article) CombinedTitle

func (article *Article) CombinedTitle() string

CombinedTitle returns a longish title.

func (*Article) DOI

func (article *Article) DOI() (s string, err error)

DOI is a convenience shortcut to get the DOI. It is an error, if there is no DOI.

func (*Article) Date

func (article *Article) Date() (t time.Time)

Date returns this articles' issuing date in a best effort manner. Use electronic publication (epub), if available.

func (*Article) Headings

func (article *Article) Headings() (hs []string)

Headings returns heading categories.

func (*Article) ISSN

func (article *Article) ISSN() (issns []string)

ISSN returns a list of ISSNs associated with this article.

func (*Article) Identifiers

func (article *Article) Identifiers() (Identifiers, error)

identifiers returns the doi and the dependent url and recordID in a struct. It is an error, if there is no DOI.

func (*Article) JournalTitle

func (article *Article) JournalTitle() string

JournalTitle will look in various fields for a journal title.

func (*Article) Languages

func (article *Article) Languages() []string

Languages returns the given and guessed languages found in abstract and fulltext. Note: This is slow. Skip detection on too short strings.

func (*Article) PageCount

func (article *Article) PageCount() (s string)

PageCount return the number of pages as string, or an empty string.

func (*Article) Subjects

func (article *Article) Subjects() (ss []string)

Subjects returns subjects, that are not headings.

func (*Article) ToIntermediateSchema

func (article *Article) ToIntermediateSchema() (*finc.IntermediateSchema, error)

ToInternalSchema converts a jats article into an internal schema. This is a basic implementation, different source might implement their own.

type Identifiers

type Identifiers struct {
	DOI string
	URL string
	ID  string
}

identifiers is a helper struct.

type PubDate

type PubDate struct {
	Type  string `xml:"pub-type,attr"`
	Month struct {
		XMLName xml.Name `xml:"month"`
		Value   string   `xml:",chardata"`
	}
	Year struct {
		XMLName xml.Name `xml:"year"`
		Value   string   `xml:",chardata"`
	}
	Day struct {
		XMLName xml.Name `xml:"day"`
		Value   string   `xml:",chardata"`
	}
}

PubDate represents a publication date. Typical type values are ppub and epub.

Jump to

Keyboard shortcuts

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