eprinttools

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: BSD-3-Clause Imports: 18 Imported by: 1

README

eprinttools

This is a collection of command line tools written in Go, a Go for working with EPrints 3.3.x EPrint XML and with the EPrint REST API.

This project also hosts demonstration code to replicate a public facing version of an EPrints repository outside of EPrints. Think of it as the public views and landing pages.

Go base code

The command line programs
  • eputil is a command line utility for interacting (e.g. harvesting) JSON and XML from EPrints' REST API
    • uses minimal configuration (because it does less!)
  • epfmt is a command line utility to pretty print EPrints XML and convert to/from JSON including a simplified JSON inspired by DataCite and Invenion 3
  • doi2eprintxml is a command line program for turning metadata harvested from CrossRef and DataCite into an EPrint XML document based on one or more supplied DOI
  • ep3apid is a Unix style service for interacting with an EPrint repository via a localhost proxy. It includes the ability to get restricted key lists as well as retrieve a simplified JSON record representing an EPrints record

Configuration is via a JSON "settings.json" file. The settings includes a repository id with "dsn" (Data Source Name) attribute for accessing EPrint's MySQL database(s) and "rest" attribute holding the base URL used to access the REST API. You can define more than one repository in "settings.json". Below is a simple example for "example.edu"'s authors repository.

    {
        "authors": {
            "dsn": "USERNAME:SECRET@/authors",
            "rest": "https://USERNAME:SECRET@authors.example.edu"
        }
    }

In the "dsn" attribute USERNAME:SECRET are the username/password for accessing the database. In the "rest" attribute the USERNAME:SECRET are the username/password for accessing the REST API.

py_dataset

This Python module provides access to dataset collections which we use as intermediate storage for JSON documents and related attachments.

AMES

The eprintools command line programs have been made available to Python via the AMES project. This include support for both read and write to EPrints repository systems.

Documentation

Overview

Package eprinttools is a collection of structures, functions and programs// for working with the EPrints XML and EPrints REST API

@author R. S. Doiel, <rsdoiel@caltech.edu>

Copyright (c) 2021, Caltech All rights not granted herein are expressly reserved by Caltech.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Package eprinttools is a collection of structures, functions and programs// for working with the EPrints XML and EPrints REST API

@author R. S. Doiel, <rsdoiel@caltech.edu>

Copyright (c) 2021, Caltech All rights not granted herein are expressly reserved by Caltech.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Package eprinttools is a collection of structures, functions and programs// for working with the EPrints XML and EPrints REST API

@author R. S. Doiel, <rsdoiel@caltech.edu>

Copyright (c) 2021, Caltech All rights not granted herein are expressly reserved by Caltech.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Package eprinttools is a collection of structures, functions and programs// for working with the EPrints XML and EPrints REST API

@author R. S. Doiel, <rsdoiel@caltech.edu>

Copyright (c) 2021, Caltech All rights not granted herein are expressly reserved by Caltech.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Package eprinttools is a collection of structures, functions and programs// for working with the EPrints XML and EPrints REST API

@author R. S. Doiel, <rsdoiel@caltech.edu>

Copyright (c) 2021, Caltech All rights not granted herein are expressly reserved by Caltech.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Package eprinttools is a collection of structures, functions and programs// for working with the EPrints XML and EPrints REST API

@author R. S. Doiel, <rsdoiel@caltech.edu>

Copyright (c) 2021, Caltech All rights not granted herein are expressly reserved by Caltech.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Package eprinttools is a collection of structures, functions and programs// for working with the EPrints XML and EPrints REST API

@author R. S. Doiel, <rsdoiel@caltech.edu>

Copyright (c) 2021, Caltech All rights not granted herein are expressly reserved by Caltech.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Package eprinttools is a collection of structures, functions and programs// for working with the EPrints XML and EPrints REST API

@author R. S. Doiel, <rsdoiel@caltech.edu>

Copyright (c) 2021, Caltech All rights not granted herein are expressly reserved by Caltech.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Index

Constants

View Source
const (
	AuthNone = iota
	BasicAuth
)
View Source
const Version = "1.0.2"

Variables

This section is empty.

Functions

func DisplayLicense added in v1.0.2

func DisplayLicense(out io.Writer, appName string, license string)

func DisplayUsage added in v1.0.2

func DisplayUsage(out io.Writer, appName string, flagSet *flag.FlagSet, description string, examples string, license string)

func DisplayVersion added in v1.0.2

func DisplayVersion(out io.Writer, appName string)

func GetKeys added in v0.0.14

func GetKeys(baseURL string) ([]int, error)

GetKeys returns a list of eprint record ids from the EPrints REST API

func InitExtendedAPI added in v1.0.2

func InitExtendedAPI(settings string) error

func RunExtendedAPI added in v1.0.2

func RunExtendedAPI(appName string) error

Types

type Access added in v1.0.2

type Access struct {
	OwnedBy []*User `json:"owned_by,omitempty"`
}

Access is a third level element used by PersistentIdenitifier to describe access ownership of the record.

type AccompanimentItemList added in v0.0.14

type AccompanimentItemList struct {
	XMLName xml.Name `xml:"accompaniment" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

AccompanimentItemList

func (*AccompanimentItemList) AddItem added in v0.0.14

func (accompanimentItemList *AccompanimentItemList) AddItem(item *Item) int

AddItem adds an item to the accompaniment item list and returns the new count of items

type Affiliation added in v1.0.2

type Affiliation struct {
	ID   string `json:"id,omitempty"`   // The organizational or institutional id from the controlled vocabularly
	Name string `json:"name,omitempty"` // The name of the organization or institution
}

Affiliation describes how a person or organization is affialated for the purpose of the record.

type AltTitleItemList added in v0.0.14

type AltTitleItemList struct {
	XMLName xml.Name `xml:"alt_title" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

AltTitleItemList

func (*AltTitleItemList) AddItem added in v0.0.14

func (altTitleItemList *AltTitleItemList) AddItem(item *Item) int

AddItem adds an item to the altTitle item list and returns the new count of items

type ConductorItemList added in v0.0.14

type ConductorItemList struct {
	XMLName xml.Name `xml:"conductors" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

ConductorItemList

func (*ConductorItemList) AddItem added in v0.0.14

func (conductorItemList *ConductorItemList) AddItem(item *Item) int

AddItem adds an item to the conductor item list and returns the new count of items

type ConfCreatorItemList added in v0.0.14

type ConfCreatorItemList struct {
	XMLName xml.Name `xml:"conf_creators" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

ConfCreatorItemList

func (*ConfCreatorItemList) AddItem added in v0.0.14

func (confCreatorItemList *ConfCreatorItemList) AddItem(item *Item) int

AddItem adds an item to the confCreator item list and returns the new count of items

type Config added in v1.0.2

type Config struct {
	// Hostname for running service
	Hostname string `json:"hostname"`

	// Repositories are defined by a REPO_ID (string)
	// that points at a MySQL Db connection string
	Repositories map[string]*DataSource `json:"repositories"`

	// Connections is a map to database connections
	Connections map[string]*sql.DB `json:"-"`

	// Routes holds the mapping of end points to repository id
	// instances.
	Routes map[string]map[string]func(http.ResponseWriter, *http.Request, string, []string) (int, error) `json:"-"`
}

Config holds a configuration file structure used by EPrints Extended API Configuration file is expected to be in JSON format.

type ContributorItemList added in v0.0.14

type ContributorItemList struct {
	XMLName xml.Name `xml:"contributors" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

ContributorItemList

func (*ContributorItemList) AddItem added in v0.0.14

func (contributorItemList *ContributorItemList) AddItem(item *Item) int

AddItem adds an item to the contributor item list and returns the new count of items

type CopyrightHolderItemList added in v0.0.14

type CopyrightHolderItemList struct {
	XMLName xml.Name `xml:"copyright_holders" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

CopyrightHolderItemList

func (*CopyrightHolderItemList) AddItem added in v0.0.14

func (copyrightHolderItemList *CopyrightHolderItemList) AddItem(item *Item) int

AddItem adds an item to the copyrightHolder item list and returns the new count of items

type CorpContributorItemList added in v1.0.2

type CorpContributorItemList struct {
	XMLName xml.Name `json:"-"` //`xml:"corp_contributors" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

CorpContributorItemList

type CorpCreatorItemList added in v0.0.14

type CorpCreatorItemList struct {
	XMLName xml.Name `json:"-"` //`xml:"corp_creators" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

CorpCreatorItemList

func (*CorpCreatorItemList) AddItem added in v0.0.14

func (corpCreatorItemList *CorpCreatorItemList) AddItem(item *Item) int

AddItem adds an item to the corp creator item list and returns the new count of items

type Creator added in v1.0.2

type Creator struct {
	PersonOrOrg  *PersonOrOrg   `json:"person_or_org,omitempty"` // The person or organization.
	Role         string         `json:"role,omitempty"`          // The role of the person or organization selected from a customizable controlled vocabularly.
	Affiliations []*Affiliation `json:"affiliations,omitempty"`  // Affiliations if `PersonOrOrg.Type` is personal.
}

Creator of a record's object

type CreatorItemList added in v0.0.14

type CreatorItemList struct {
	XMLName xml.Name `xml:"creators" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

CreatorItemList holds a list of authors

func (*CreatorItemList) AddItem added in v0.0.14

func (creatorItemList *CreatorItemList) AddItem(item *Item) int

AddItem adds an item to the Creator list and returns the new count of items

type DataSource added in v1.0.2

type DataSource struct {
	// DSN is used to connect to a MySQL style DB.
	DSN string `json:"dsn,omitempty"`
	// Rest is used to connect to EPrints REST API
	// NOTE: assumes Basic Auth for authentication
	RestAPI string `json:"rest,omitempty"`
}

DataSource can contain one or more types of datasources. E.g. E.g. dsn for MySQL connections and also data for REST API access.

type DateType added in v1.0.2

type DateType struct {
	Date        string `json:"date,omitempty"`
	Type        *Type  `json:"type,omitempty"`
	Description string `json:"description,omitempty"`
}

DateType holds Invenio dates used in Metadata element.

type Description added in v1.0.2

type Description struct {
	Description string `json:"description,omitempty"`
	Type        *Type  `json:"type,omitempty"`
	Lang        *Type  `json:"lang,omitempty"`
}

Description holds additional descriptions in Metadata element. e.g. language versions of Abstract, etc.

type DivisionItemList added in v0.0.14

type DivisionItemList struct {
	XMLName xml.Name `xml:"divisions" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

DivisionItemList

func (*DivisionItemList) AddItem added in v0.0.14

func (divisionItemList *DivisionItemList) AddItem(item *Item) int

AddItem adds an item to the division item list and returns the new count of items

type Document

type Document struct {
	XMLName     xml.Name `json:"-"`
	ID          string   `xml:"id,attr" json:"id"`
	DocID       int      `xml:"docid" json:"doc_id"`
	RevNumber   int      `xml:"rev_number" json:"rev_number,omitempty"`
	Files       []*File  `xml:"files>file" json:"files,omitempty"`
	EPrintID    int      `xml:"eprintid" json:"eprint_id"`
	Pos         int      `xml:"pos" json:"pos,omitempty"`
	Placement   int      `xml:"placement,omitempty" json:"placement,omitempty"`
	MimeType    string   `xml:"mime_type" json:"mime_type"`
	Format      string   `xml:"format" json:"format"`
	FormatDesc  string   `xml:"formatdesc,omitempty" json:"format_desc,omitempty"`
	Language    string   `xml:"language,omitempty" json:"language,omitempty"`
	Security    string   `xml:"security" json:"security"`
	License     string   `xml:"license" json:"license"`
	Main        string   `xml:"main" json:"main"`
	DateEmbargo string   `xml:"date_embargo,omitempty" json:"date_embargo,omitempty"`
	Content     string   `xml:"content,omitempty" json:"content,omitempty"`
	Relation    []*Item  `xml:"relation>item,omitempty" json:"relation,omitempty"`
}

Document structures inside a Record (i.e. <eprint>...<documents><document>...</document>...</documents>...</eprint>)

type DocumentList

type DocumentList []*Document

DocumentList is an array of pointers to Document structs

func (DocumentList) AddDocument added in v0.0.20

func (documentList DocumentList) AddDocument(document *Document) int

AddDocument adds a document to the documents list and returns the new count of items

func (DocumentList) IndexOf added in v0.0.28

func (documentList DocumentList) IndexOf(i int) *Document

GetDocument takes a position (zero based) and returns the *Document in the DocumentList.

func (DocumentList) Length added in v0.0.28

func (documentList DocumentList) Length() int

Length returns the length of DocumentList

type EPrint added in v0.0.14

type EPrint struct {
	XMLName              xml.Name                      `json:"-"`
	ID                   string                        `xml:"id,attr,omitempty" json:"id,omitempty"`
	EPrintID             int                           `xml:"eprintid,omitempty" json:"eprint_id,omitempty"`
	RevNumber            int                           `xml:"rev_number,omitempty" json:"rev_number,omitempty"`
	Documents            *DocumentList                 `xml:"documents>document,omitempty" json:"documents,omitempty"`
	EPrintStatus         string                        `xml:"eprint_status,omitempty" json:"eprint_status,omitempty"`
	UserID               int                           `xml:"userid,omitempty" json:"userid,omitempty"`
	Dir                  string                        `xml:"dir,omitempty" json:"dir,omitempty"`
	DateStamp            string                        `xml:"datestamp,omitempty" json:"datestamp,omitempty"`
	LastModified         string                        `xml:"lastmod,omitempty" json:"lastmod,omitempty"`
	StatusChanged        string                        `xml:"status_changed,omitempty" json:"status_changed,omitempty"`
	Type                 string                        `xml:"type,omitempty" json:"type,omitempty"`
	MetadataVisibility   string                        `xml:"metadata_visibility,omitempty" json:"metadata_visibility,omitempty"`
	Creators             *CreatorItemList              `xml:"creators,omitempty" json:"creators,omitempty"`
	Title                string                        `xml:"title,omitempty" json:"title,omitempty"`
	IsPublished          string                        `xml:"ispublished,omitempty" json:"ispublished,omitempty"`
	FullTextStatus       string                        `xml:"full_text_status,omitempty" json:"full_text_status,omitempty"`
	Keywords             string                        `xml:"keywords,omitempty" json:"keywords,omitempty"`
	Note                 string                        `xml:"note,omitempty" json:"note,omitempty"`
	Abstract             string                        `xml:"abstract,omitempty" json:"abstract,omitempty"`
	Date                 string                        `xml:"date,omitempty" json:"date,omitempty"`
	DateType             string                        `xml:"date_type,omitempty" json:"date_type,omitempty"`
	Series               string                        `xml:"series,omitempty" json:"series,omitempty"`
	Publication          string                        `xml:"publication,omitempty" json:"publication,omitempty"`
	Volume               string                        `xml:"volume,omitempty" json:"volume,omitempty"`
	Number               string                        `xml:"number,omitempty" json:"number,omitempty"`
	Publisher            string                        `xml:"publisher,omitempty" json:"publisher,omitempty"`
	PlaceOfPub           string                        `xml:"place_of_pub,omitempty" json:"place_of_pub,omitempty"`
	Edition              string                        `xml:"edition,omitempty" json:"edition,omitempty"`
	PageRange            string                        `xml:"pagerange,omitempty" json:"pagerange,omitempty"`
	Pages                string                        `xml:"pages,omitempty" json:"pages,omitempty"`
	EventTitle           string                        `xml:"event_title,omitempty" json:"event_title,omitempty"`
	EventLocation        string                        `xml:"event_location,omitempty" json:"event_location,omitempty"`
	EventDates           string                        `xml:"event_dates,omitempty" json:"event_dates,omitempty"`
	IDNumber             string                        `xml:"id_number,omitempty" json:"id_number,omitempty"`
	Refereed             string                        `xml:"refereed,omitempty" json:"refereed,omitempty"`
	ISBN                 string                        `xml:"isbn,omitempty" json:"isbn,omitempty"`
	ISSN                 string                        `xml:"issn,omitempty" json:"issn,omitempty"`
	BookTitle            string                        `xml:"book_title,omitempty" json:"book_title,omitempty"`
	Editors              *EditorItemList               `xml:"editors,omitempty" json:"editors,omitempty"`
	OfficialURL          string                        `xml:"official_url,omitempty" json:"official_url,omitempty"`
	RelatedURL           *RelatedURLItemList           `xml:"related_url,omitempty" json:"related_url,omitempty"`
	ReferenceText        *ReferenceTextItemList        `xml:"referencetext,omitempty" json:"referencetext,omitempty"`
	Projects             *ProjectItemList              `xml:"projects,omitempty" json:"projects,omitempty"`
	Rights               string                        `xml:"rights,omitempty" json:"rights,omitempty"`
	Funders              *FunderItemList               `xml:"funders,omitempty" json:"funders,omitempty"`
	Collection           string                        `xml:"collection,omitempty" json:"collection,omitempty"`
	Reviewer             string                        `xml:"reviewer,omitempty" json:"reviewer,omitempty"`
	OfficeCitation       string                        `xml:"official_cit,omitempty" json:"official_cit,omitempty"`
	OtherNumberingSystem *OtherNumberingSystemItemList `xml:"other_numbering_system,omitempty" json:"other_numbering_system,omitempty"`
	LocalGroup           *LocalGroupItemList           `xml:"local_group,omitempty" json:"local_group,omitempty"`
	Errata               *ErrataItemList               `xml:"errata,omitempty" json:"errata,omitempty"`
	Contributors         *ContributorItemList          `xml:"contributors,omitempty" json:"contributors,omitempty"`
	MonographType        string                        `xml:"monograph_type,omitempty" json:"monograph_type,omitempty"`

	// Caltech Library uses suggestions as an internal note field (RSD, 2018-02-15)
	Suggestions string            `xml:"suggestions,omitempty" json:"suggestions,omitempty"`
	OtherURL    *OtherURLItemList `xml:"other_url,omitempty" json:"other_url,omitempty"`

	// NOTE: Misc fields discoverd exploring REST API records, not currently used at Caltech Library (RSD, 2018-01-02)
	Subjects           *SubjectItemList         `xml:"subjects,omitempty" json:"subjects,omitempty"`
	PresType           string                   `xml:"pres_type,omitempty" json:"presentation_type,omitempty"`
	Succeeds           string                   `xml:"succeeds,omitempty" json:"succeeds,omitempty"`
	Commentary         string                   `xml:"commentary,omitempty" json:"commentary,omitempty"`
	ContactEMail       string                   `xml:"contact_email,omitempty" json:"contect_email,omitempty"`
	FileInfo           string                   `xml:"fileinfo,omitempty" json:"file_info,omitempty"`
	Latitude           string                   `xml:"latitude,omitempty" json:"latitude,omitempty"`
	Longitude          string                   `xml:"longitude,omitempty" json:"longitude,omitempty"`
	ItemIssues         *ItemIssueItemList       `xml:"item_issues,omitempty" json:"item_issues,omitempty"`
	ItemIssuesCount    int                      `xml:"item_issues_count,omitempty" json:"item_issues_count,omitempty"`
	CorpCreators       *CorpCreatorItemList     `xml:"corp_creators,omitempty" json:"corp_creators,omitempty"`
	CorpContributors   *CorpContributorItemList `xml:"corp_contributors,omitempty" json:"corp_contributors,omitempty"`
	Department         string                   `xml:"department,omitempty" json:"department,omitempty"`
	OutputMedia        string                   `xml:"output_media,omitempty" json:"output_media,omitempty"`
	Exhibitors         *ExhibitorItemList       `xml:"exhibitors,omitempty" json:"exhibitors,omitempty"`
	NumPieces          string                   `xml:"num_pieces,omitempty" json:"num_pieces,omitempty"`
	CompositionType    string                   `xml:"composition_type,omitempty" json:"composition_type,omitempty"`
	Producers          *ProducerItemList        `xml:"producers,omitempty" json:"producers,omitempty"`
	Conductors         *ConductorItemList       `xml:"conductors,omitempty" json:"conductors,omitempty"`
	Lyricists          *LyricistItemList        `xml:"lyricists,omitempty" json:"lyricists,omitempty"`
	Accompaniment      *AccompanimentItemList   `xml:"accompaniment,omitempty" json:"accompaniment,omitempty"`
	DataType           string                   `xml:"data_type,omitempty" json:"data_type,omitempty"`
	PedagogicType      string                   `xml:"pedagogic_type,omitempty" json:"pedagogic_type,omitempty"`
	CompletionTime     string                   `xml:"completion_time,omitempty" json:"completion_time,omitempty"`
	TaskPurpose        string                   `xml:"task_purpose,omitempty" json:"task_purpose,omitempty"`
	SkillAreas         *SkillAreaItemList       `xml:"skill_areas,omitempty" json:"skill_areas,omitempty"`
	CopyrightHolders   *CopyrightHolderItemList `xml:"copyright_holders,omitempty" json:"copyright_holders,omitempty"`
	LearningLevel      *LearningLevelItemList   `xml:"learning_level,omitempty" json:"learning_level,omitempty"`
	DOI                string                   `xml:"doi,omitempty" json:"doi,omitempty"`
	PMCID              string                   `xml:"pmc_id,omitempty" json:"pmcid,omitempty"`
	PMID               string                   `xml:"pmid,omitempty" json:"pmid,omitempty"`
	ParentURL          string                   `xml:"parent_url,omitempty" json:"parent_url,omitempty"`
	Reference          *ReferenceItemList       `xml:"reference,omitempty" json:"reference,omitempty"`
	ConfCreators       *ConfCreatorItemList     `xml:"conf_creators,omitempty" json:"conf_creators,omitempty"`
	AltTitle           *AltTitleItemList        `xml:"alt_title,omitempty" json:"alt_title,omitempty"`
	TOC                string                   `xml:"toc,omitempty" json:"toc,omitempty"`
	Interviewer        string                   `xml:"interviewer,omitempty" json:"interviewer,omitempty"`
	InterviewDate      string                   `xml:"interviewdate,omitempty" json:"interviewdate,omitempty"`
	GScholar           *GScholarItemList        `xml:"gscholar,omitempty" json:"gscholar,omitempty"`
	NonSubjKeywords    string                   `xml:"nonsubj_keywords,omitempty" json:"nonsubj_keywords,omitempty"`
	Season             string                   `xml:"season,omitempty" json:"season,omitempty"`
	ClassificationCode string                   `xml:"classification_code,omitempty" json:"classification_code,omitempty"`
	Shelves            *ShelfItemList           `xml:"shelves,omitempty" json:"shelves,omitempty"`

	// NOTE: Sword deposit fields
	SwordDepository string `xml:"sword_depository,omitempty" json:"sword_depository,omitempty"`
	SwordSlug       string `xml:"sword_slug,omitempty" json:"sword_slug,omitempty"`
	ImportID        string `xml:"importid,omitempty" json:"import_id,omitempty"`

	// Patent related fields
	PatentApplicant      string                        `xml:"patent_applicant,omitempty" json:"patent_applicant,omitempty"`
	PatentNumber         string                        `xml:"patent_number,omitempty" json:"patent_number,omitempty"`
	PatentAssignee       *PatentAssigneeItemList       `xml:"patent_assignee,omitempty" json:"patent_assignee,omitempty"`
	PatentClassification *PatentClassificationItemList `xml:"patent_classification,omitempty" json:"patent_classification,omitempty"`
	RelatedPatents       *RelatedPatentItemList        `xml:"related_patents,omitempty" json:"related_patents,omitempty"`

	// Thesis oriented fields
	Divisions              *DivisionItemList        `xml:"divisions,omitemmpty" json:"divisions,omitempty"`
	Institution            string                   `xml:"institution,omitempty" json:"institution,omitempty"`
	ThesisType             string                   `xml:"thesis_type,omitempty" json:"thesis_type,omitempty"`
	ThesisAdvisor          *ThesisAdvisorItemList   `xml:"thesis_advisor,omitempty" json:"thesis_advisor,omitempty"`
	ThesisCommittee        *ThesisCommitteeItemList `xml:"thesis_committee,omitempty" json:"thesis_committee,omitempty"`
	ThesisDegree           string                   `xml:"thesis_degree,omitempty" json:"thesis_degree,omitempty"`
	ThesisDegreeGrantor    string                   `xml:"thesis_degree_grantor,omitempty" json:"thesis_degree_grantor,omitempty"`
	ThesisDegreeDate       string                   `xml:"thesis_degree_date,omitempty" json:"thesis_degree_date,omitempty"`
	ThesisSubmittedDate    string                   `xml:"thesis_submit_date,omitempty" json:"thesis_submit_date,omitempty"`
	ThesisDefenseDate      string                   `xml:"thesis_defense_date,omitempty" json:"thesis_defense_date,omitempty"`
	ThesisApprovedDate     string                   `xml:"thesis_approved_date,omitempty" json:"thesis_approved_date,omitempty"`
	ThesisPublicDate       string                   `xml:"thesis_public_date,omitempty" json:"thesis_public_date,omitempty"`
	ThesisAuthorEMail      string                   `xml:"thesis_author_email,omitempty" json:"thesis_author_email,omitempty"`
	HideThesisAuthorEMail  string                   `xml:"hide_thesis_author_email,omitempty" json:"hide_thesis_author_email,omitempty"`
	GradOfficeApprovalDate string                   `xml:"gradofc_approval_date,omitempty" json:"gradofc_approval_date,omitempty"`
	ThesisAwards           string                   `xml:"thesis_awards,omitempty" json:"thesis_awards,omitempty"`
	ReviewStatus           string                   `xml:"review_status,omitempty" json:"review_status,omitempty"`
	OptionMajor            *OptionMajorItemList     `xml:"option_major,omitempty" json:"option_major,omitempty"`
	OptionMinor            *OptionMinorItemList     `xml:"option_minor,omitempty" json:"option_major,omitempty"`
	CopyrightStatement     string                   `xml:"copyright_statement,omitempty" json:"copyright_statement,omitempty"`

	// Synthetic fields are created to help in eventual migration of
	// EPrints field data to other JSON formats.
	PrimaryObject  map[string]interface{}   `xml:"-" json:"primary_object,omitempty"`
	RelatedObjects []map[string]interface{} `xml:"-" json:"related_objects,omitempty"`
}

EPrint is the record contated in a EPrints XML document such as they used to store revisions.

func CrossRefWorksToEPrint added in v0.0.17

func CrossRefWorksToEPrint(obj crossrefapi.Object) (*EPrint, error)

CrossRefWorksToEPrint takes a works object from the CrossRef API and maps the fields into an EPrint struct return a new struct or error.

func DataCiteWorksToEPrint added in v0.0.17

func DataCiteWorksToEPrint(obj dataciteapi.Object) (*EPrint, error)

DataCiteWorksToEPrint takes a works object from the DataCite API and maps the fields into an EPrint struct return a new struct or error.

func (*EPrint) PubDate added in v0.0.14

func (eprint *EPrint) PubDate() string

PubDate returns the publication date or empty string

func (*EPrint) SyntheticFields added in v0.0.52

func (e *EPrint) SyntheticFields()

SyntheticFields renders analyzes an EPrint object and populates or updates any synthetic fields like primary_object and related_object.

type EPrints added in v0.0.14

type EPrints struct {
	XMLName xml.Name  `xml:"eprints" json:"-"`
	XMLNS   string    `xml:"xmlns,attr,omitempty" json:"xmlns,omitempty"`
	EPrint  []*EPrint `xml:"eprint" json:"eprint"`
}

EPrints is the high level XML you get from the REST API. E.g. curl -L -O https://eprints3.example.org/rest/eprint/1234.xml Then parse the 1234.xml document stucture.

func GetEPrint added in v1.0.2

func GetEPrint(baseURL string, eprintID int) (*EPrints, error)

GetEPrint fetches a single EPrint record via the EPrint REST API.

func (*EPrints) AddEPrint added in v0.0.14

func (eprints *EPrints) AddEPrint(eprint *EPrint) int

AddEPrint appends an EPrint struct to an EPrints struct returning the count of attached eprints

type EPrintsDataSet added in v0.0.14

type EPrintsDataSet struct {
	XMLName xml.Name `xml:"html" json:"-"`
	Paths   []string `xml:"body>ul>li>a,omitempty" json:"paths"`
}

EPrintsDataSet is a struct for parsing the HTML page that returns a list of available EPrint IDs with links.

func (EPrintsDataSet) MarshalJSON added in v0.0.14

func (epds EPrintsDataSet) MarshalJSON() ([]byte, error)

MarshalJSON() renders the EPrintsDataSet HTML/XML as a list of ids

type EditorItemList added in v0.0.14

type EditorItemList struct {
	XMLName xml.Name `xml:"editors" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

EditorItemList holds a list of editors

func (*EditorItemList) AddItem added in v0.0.14

func (editorItemList *EditorItemList) AddItem(item *Item) int

AddItem adds an item to the Editor item list and returns the new count of items

type Embargo added in v1.0.2

type Embargo struct {
	Active bool   `json:"active,omitempty"` // boolean, is the record under an embargo or not.
	Until  string `json:"until,omitempty"`  // Required if active true. ISO date string. When to lift the embargo. e.g. "2100-10-01"
	Reason string `json:"reason,omitempty"` // Explanation for the embargo
}

Embargo is a third level element used by RecordAccess to describe the embargo status of a record.

type Entry added in v1.0.2

type Entry struct {
	BucketID     string `json:"bucket_id,omitempty"`
	VersionID    string `json:"version_id,omitempty"`
	FileID       string `json:"file_id,omitempty"`
	Backend      string `json:"backend,omitempty"`
	StorageClass string `json:"storage_class,omitempty"`
	Key          string `json:"key,omitempty"`
	MimeType     string `json:"mimetype,omitempty"`
	Size         int    `json:"size,omitempty"`
	CheckSum     string `json:"checksum,omitempty"`
}

type ErrataItemList added in v0.0.14

type ErrataItemList struct {
	XMLName xml.Name `xml:"errata" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

ErrataItemList

func (*ErrataItemList) AddItem added in v0.0.14

func (errataItemList *ErrataItemList) AddItem(item *Item) int

AddItem adds an item to the errata item list and returns the new count of items

type ExhibitorItemList added in v0.0.14

type ExhibitorItemList struct {
	XMLName xml.Name `xml:"exhibitors" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

ExhibitorItemList

func (*ExhibitorItemList) AddItem added in v0.0.14

func (exhibitorItemList *ExhibitorItemList) AddItem(item *Item) int

AddItem adds an item to the exhibitor item list and returns the new count of items

type File

type File struct {
	XMLName   xml.Name `json:"-"`
	ID        string   `xml:"id,attr" json:"id"`
	FileID    int      `xml:"fileid" json:"fileid"`
	DatasetID string   `xml:"datasetid" json:"datasetid"`
	ObjectID  int      `xml:"objectid" json:"objectid"`
	Filename  string   `xml:"filename" json:"filename"`
	MimeType  string   `xml:"mime_type" json:"mime_type"`
	Hash      string   `xml:"hash,omitempty" json:"hash,omitempty"`
	HashType  string   `xml:"hash_type,omitempty" json:"hash_type,omitempty"`
	FileSize  int      `xml:"filesize" json:"filesize"`
	MTime     string   `xml:"mtime" json:"mtime"`
	URL       string   `xml:"url" json:"url"`
}

File structures in Document

type Files added in v1.0.2

type Files struct {
	Enabled        bool                    `json:"enabled,omitempty"`
	Entries        map[string]*Entry       `json:"entries,omitempty"`
	DefaultPreview string                  `json:"default_preview,omitempty"`
	Sizes          []string                `json:"sizes,omitempty"`
	Formats        []string                `json:"formats,omitempty"`
	Locations      map[string]*interface{} `json:"locations,omitempty"`
}

Files

type Funder

type Funder struct {
	Funder    []*Identifier `json:"funder,omitempty"`
	Award     *Identifier   `json:"award,omitempty"`
	Reference []*Identifier `json:"references,omitempty"`
}

Funder holds funding information for funding organizations in Metadata

type FunderItemList added in v0.0.14

type FunderItemList struct {
	XMLName xml.Name `xml:"funders" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

FunderItemList

func (*FunderItemList) AddItem added in v0.0.14

func (funderItemList *FunderItemList) AddItem(item *Item) int

AddItem adds an item to the funder item list and returns the new count of items

type GScholarItemList added in v0.0.14

type GScholarItemList struct {
	XMLName xml.Name `xml:"gscholar" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

GScholarItemList

func (*GScholarItemList) AddItem added in v0.0.14

func (gScholarItemList *GScholarItemList) AddItem(item *Item) int

AddItem adds an item to the gScholar item list and returns the new count of items

type Identifier added in v1.0.2

type Identifier struct {
	Scheme       string      `json:"scheme,omitempty"`
	Name         string      `json:"name,omitempty"`
	Title        string      `json:"title,omitempty"`
	Number       string      `json:"number,omitempty"`
	Identifier   string      `json:"identifier,omitempty"`
	RelationType *TypeDetail `json:"relation_type,omitempty"`
	ResourceType *TypeDetail `json:"resource_type,omitempty"`
}

Identifier holds an Identifier, e.g. ORCID, ROR, ISNI, GND for a person for organization it holds GRID, ROR. etc.

type Item added in v0.0.14

type Item struct {
	XMLName     xml.Name `xml:"item" json:"-"`
	Name        *Name    `xml:"name,omitempty" json:"name,omitempty"`
	ID          string   `xml:"id,omitempty" json:"id,omitempty"`
	EMail       string   `xml:"email,omitempty" json:"email,omitempty"`
	ShowEMail   string   `xml:"show_email,omitempty" json:"show_email,omitempty"`
	Role        string   `xml:"role,omitempty" json:"role,omitempty"`
	URL         string   `xml:"url,omitempty" json:"url,omitempty"`
	Type        string   `xml:"type,omitempty" json:"type,omitempty"`
	Description string   `xml:"description,omitempty" json:"description,omitempty"`
	Agency      string   `xml:"agency,omitempty" json:"agency,omitempty"`
	GrantNumber string   `xml:"grant_number,omitempty" json:"grant_number,omitempty"`
	URI         string   `xml:"uri,omitempty" json:"uri,omitempty"`
	ORCID       string   `xml:"orcid,omitempty" json:"orcid,omitempty"`
	Value       string   `xml:",chardata" json:"value,omitempty"`
}

Item is a generic type used by various fields (e.g. Creator, Division, OptionMajor)

func (*Item) MarshalJSON added in v0.0.14

func (item *Item) MarshalJSON() ([]byte, error)

MarshalJSON() is a custom JSON marshaler for Item

func (*Item) UnmarshalJSON added in v0.0.33

func (item *Item) UnmarshalJSON(src []byte) error

type ItemIssueItemList added in v0.0.14

type ItemIssueItemList struct {
	XMLName xml.Name `xml:"item_issues" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

ItemIssueItemList

func (*ItemIssueItemList) AddItem added in v0.0.14

func (issueItemList *ItemIssueItemList) AddItem(item *Item) int

AddItem adds an item to the issue item list and returns the new count of items

type LearningLevelItemList added in v0.0.14

type LearningLevelItemList struct {
	XMLName xml.Name `xml:"learning_level" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

LearningLevelItemList

func (*LearningLevelItemList) AddItem added in v0.0.14

func (learningLevelItemList *LearningLevelItemList) AddItem(item *Item) int

AddItem adds an item to the learningLevel item list and returns the new count of items

type LocalGroupItemList added in v0.0.14

type LocalGroupItemList struct {
	XMLName xml.Name `xml:"local_group" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

LocalGroupItemList holds the related URLs (e.g. doi, aux material doi)

func (*LocalGroupItemList) AddItem added in v0.0.14

func (localGroupItemList *LocalGroupItemList) AddItem(item *Item) int

AddItem adds an item to the local group item list and returns the new count of items

type LyricistItemList added in v0.0.14

type LyricistItemList struct {
	XMLName xml.Name `xml:"lyricists" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

LyricistItemList

func (*LyricistItemList) AddItem added in v0.0.14

func (lyricistItemList *LyricistItemList) AddItem(item *Item) int

AddItem adds an item to the lyricist item list and returns the new count of items

type Metadata added in v1.0.2

type Metadata struct {
	ResourceType           map[string]string    `json:"resource_type,omitempty"` // Resource type id from the controlled vocabulary.
	Creators               []*Creator           `jons:"creators,omitempty"`      //list of creator information (person or organization)
	Title                  string               `json:"title"`
	PublicationDate        string               `json:"publication_date,omitempty"`
	AdditionalTitles       []*TitleDetail       `json:"additional_titles,omitempty"`
	Description            string               `json:"description,omitempty"`
	AdditionalDescriptions []*Description       `json:"additional_descriptions,omitempty"`
	Rights                 []*Right             `json:"rights,omitempty"`
	Contributors           []*Creator           `json:"contributors,omitempty"`
	Subjects               []*Subject           `json:"subjects,omitempty"`
	Languages              []*map[string]string `json:"languages,omitempty"`
	Dates                  []*DateType          `json:"dates,omitempty"`
	Version                string               `json:"version,omitempty"`
	Publisher              string               `json:"publisher,omitempty"`
	Identifiers            []*Identifier        `json:"identifier,omitempty"`
	Funding                []*Funder            `json:"funding,omitempty"`
}

Metadata holds the primary metadata about the record. This is where most of the EPrints 3.3.x data is mapped into.

type Name added in v0.0.14

type Name struct {
	XMLName xml.Name `json:"-"`
	Family  string   `xml:"family,omitempty" json:"family,omitempty"`
	Given   string   `xml:"given,omitempty" json:"given,omitempty"`
	ID      string   `xml:"id,omitempty" json:"id,omitempty"`
	ORCID   string   `xml:"orcid,omitempty" json:"orcid,omitempty"`
	Value   string   `xml:",chardata" json:"value,omitempty"`
}

Name handles the "name" types found in Items.

func (*Name) MarshalJSON added in v0.0.14

func (name *Name) MarshalJSON() ([]byte, error)

MarshalJSON() is a custom JSON marshaler for Name

func (*Name) String added in v0.0.14

func (name *Name) String() string

String() returns a json marshaled *Name as a string

type OptionMajorItemList added in v0.0.14

type OptionMajorItemList struct {
	XMLName xml.Name `xml:"option_major" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

OptionMajorItemList

func (*OptionMajorItemList) AddItem added in v0.0.14

func (optionMajorItemList *OptionMajorItemList) AddItem(item *Item) int

AddItem adds an item to the option major item list and returns the new count of items

type OptionMinorItemList added in v1.0.2

type OptionMinorItemList struct {
	XMLName xml.Name `xml:"option_minor" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

OptionMinorItemList

func (*OptionMinorItemList) AddItem added in v1.0.2

func (optionMinorItemList *OptionMinorItemList) AddItem(item *Item) int

AddItem adds an item to the option minor item list and returns the new count of items

type OtherNumberingSystemItemList added in v0.0.14

type OtherNumberingSystemItemList struct {
	XMLName xml.Name `xml:"other_numbering_system" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

OtherNumberingSystemItemList

func (*OtherNumberingSystemItemList) AddItem added in v0.0.14

func (otherNumberingSystemItemList *OtherNumberingSystemItemList) AddItem(item *Item) int

AddItem adds an item to the other numbering system item list and returns the new count of items

type OtherURLItemList added in v0.0.23

type OtherURLItemList struct {
	XMLName xml.Name `xml:"other_url" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

OtherURLItemList is a legacy Caltech Library field, old records have it new records use RelatedURLItemList RelatedURLItemList holds the related URLs (e.g. doi, aux material doi)

func (*OtherURLItemList) AddItem added in v0.0.23

func (otherURLItemList *OtherURLItemList) AddItem(item *Item) int

AddItem adds an item to the "other" url item list and returns the new count of items, this is a legacy Caltech Library-ism in EPrints

type PatentAssigneeItemList added in v0.0.14

type PatentAssigneeItemList struct {
	XMLName xml.Name `xml:"patent_assignee" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

PatentAssigneeItemList

func (*PatentAssigneeItemList) AddItem added in v0.0.14

func (patentAssigneeItemList *PatentAssigneeItemList) AddItem(item *Item) int

AddItem adds an item to the patent assignee item list and returns the new count of items

type PatentClassificationItemList added in v0.0.14

type PatentClassificationItemList struct {
	XMLName xml.Name `xml:"patent_classification" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

PatentClassificationItemList

func (*PatentClassificationItemList) AddItem added in v0.0.14

func (patentClassificationItemList *PatentClassificationItemList) AddItem(item *Item) int

AddItem adds an item to the patent classification item list and returns the new count of items

type PersistentIdentifier added in v1.0.2

type PersistentIdentifier struct {
	Identifier string `json:"identifier,omitempty"` // The identifier value
	Provider   string `json:"provider,omitempty"`   // The provider idenitifier used internally by the system
	Client     string `json:"client,omitempty"`     // The client identifier used for connecting with an external registration service.
}

PersistentIdentifier holds an Identifier, e.g. ORCID, ROR, ISNI, GND

type PersonOrOrg added in v1.0.2

type PersonOrOrg struct {
	ID   string `json:"cl_identifier,omitempty"` // The Caltech Library internal person or organizational identifier used to cross walk data across library systems. (this is not part of Invenion 3)
	Type string `json:"type,omitempty"`          // The type of name. Either "personal" or "organizational".

	GivenName  string `json:"given_name,omitempty" xml:"given_name,omitempty"`   // GivenName holds a peron's given name, e.g. Jane
	FamilyName string `json:"family_name,omitempty" xml:"family_name,omitempty"` // FamilyName holds a person's family name, e.g. Doe
	Name       string `json:"name,omitempty" xml:"name,omitempty"`               // Name holds a corporate name, e.g. The Unseen University

	// Identifiers holds a list of unique ID like ORCID, GND, ROR, ISNI
	Identifiers []*Identifier `json:"identifiers,omitempty"`
}

PersonOrOrg holds either a person or corporate entity information for the creators associated with the record.

type ProducerItemList added in v0.0.14

type ProducerItemList struct {
	XMLName xml.Name `xml:"producers" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

ProducerItemList

func (*ProducerItemList) AddItem added in v0.0.14

func (producerItemList *ProducerItemList) AddItem(item *Item) int

AddItem adds an item to the producer item list and returns the new count of items

type ProjectItemList added in v0.0.14

type ProjectItemList struct {
	XMLName xml.Name `xml:"projects" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

ProjectItemList

func (*ProjectItemList) AddItem added in v0.0.14

func (projectItemList *ProjectItemList) AddItem(item *Item) int

AddItem adds an item to the project item list and returns the new count of items

type Record

type Record struct {
	Schema       string                           `json:"$schema,omitempty"`
	ID           string                           `json:"id"`                  // Interneral persistent identifier for a specific version.
	PID          map[string]interface{}           `json:"pid,omitempty"`       // Interneral persistent identifier for a specific version.
	Parent       *RecordIdentifier                `json:"parent"`              // The internal persistent identifier for ALL versions.
	ExternalPIDs map[string]*PersistentIdentifier `json:"pids,omitempty"`      // System-managed external persistent identifiers (DOI, Handles, OAI-PMH identifiers)
	RecordAccess *RecordAccess                    `json:"access,omitempty"`    // Access control for record
	Metadata     *Metadata                        `json:"metadata"`            // Descriptive metadata for the resource
	Files        *Files                           `json:"files"`               // Associated files information.
	Tombstone    *Tombstone                       `json:"tombstone,omitempty"` // Tombstone (deasscession) information.
	Created      time.Time                        `json:"created"`             // create time for record
	Updated      time.Time                        `json:"updated"`             // modified time for record
}

Record implements the top level Invenio 3 record structure

func CrosswalkEPrintToRecord added in v1.0.2

func CrosswalkEPrintToRecord(eprint *EPrint) (*Record, error)

RecordFromEPrint takes an EPrint structure and crosswalks it into the Record structure.

func (*Record) ToString added in v1.0.2

func (rec *Record) ToString() []byte

type RecordAccess added in v1.0.2

type RecordAccess struct {
	Record  string   `json:"record,omitempty"`  // "public" or "restricted. Read access to the record.
	Files   string   `json:"files,omitempty"`   // "public" or "restricted". Read access to the record's files.
	Embargo *Embargo `json:"embargo,omitempty"` // Embargo options for the record.
}

RecordAccess implements a datastructure used by Invenio 3 to control record level accesss, e.g. in the REST API.

type RecordIdentifier added in v1.0.2

type RecordIdentifier struct {
	ID     string  `json:"id"`               // The identifier of the parent record
	Access *Access `json:"access,omitempty"` // Access details for the record as a whole
}

RecordIdentifier implements the scheme of "parent", a persistant identifier to the record.

type ReferenceItemList added in v0.0.14

type ReferenceItemList struct {
	XMLName xml.Name `xml:"reference" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

ReferenceItemList

func (*ReferenceItemList) AddItem added in v0.0.14

func (referenceItemList *ReferenceItemList) AddItem(item *Item) int

AddItem adds an item to the reference item list and returns the new count of items

type ReferenceTextItemList added in v0.0.14

type ReferenceTextItemList struct {
	XMLName xml.Name `xml:"referencetext" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

ReferenceTextItemList

func (*ReferenceTextItemList) AddItem added in v0.0.14

func (referenceTextItemList *ReferenceTextItemList) AddItem(item *Item) int

AddItem adds an item to the reference text url item list and returns the new count of items

func (*ReferenceTextItemList) UnmarshalJSON added in v0.0.32

func (referenceTextItemList *ReferenceTextItemList) UnmarshalJSON(src []byte) error

UnmarshJSON takes a reference text list of item and returns an appropriately values to assigned struct.

type RelatedPatentItemList added in v0.0.14

type RelatedPatentItemList struct {
	XMLName xml.Name `xml:"related_patents" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

RelatedPatentItemList

func (*RelatedPatentItemList) AddItem added in v0.0.14

func (relatedPatentItemList *RelatedPatentItemList) AddItem(item *Item) int

AddItem adds an item to the related patent item list and returns the new count of items

type RelatedURLItemList added in v0.0.14

type RelatedURLItemList struct {
	XMLName xml.Name `xml:"related_url" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

RelatedURLItemList holds the related URLs (e.g. doi, aux material doi)

func (*RelatedURLItemList) AddItem added in v0.0.14

func (relatedURLItemList *RelatedURLItemList) AddItem(item *Item) int

AddItem adds an item to the related url item list and returns the new count of items

type Right struct {
	ID          string `json:"id,omitempty"`          // Identifier value
	Title       string `json:"title,omitempty"`       // Localized human readable title e.g., `{"en": "The ACME Corporation License."}`.
	Description string `json:"description,omitempty"` // Localized license description text e.g., `{"en":"This license ..."}`.
	Link        string `json:"link,omitempty"`        // Link to full license.
}

Right holds a specific Rights element for the Metadata's list of Rights.

NOTE: for REST API lookup by ID or Title (but not both) should be supported at the same end point. I.e. they both must be unique with in their set of field values.

type ShelfItemList added in v0.0.14

type ShelfItemList struct {
	XMLName xml.Name `xml:"shelves" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

ShelfItemList

func (*ShelfItemList) AddItem added in v0.0.14

func (shelfItemList *ShelfItemList) AddItem(item *Item) int

AddItem adds an item to the shelf item list and returns the new count of items

type SkillAreaItemList added in v0.0.14

type SkillAreaItemList struct {
	XMLName xml.Name `xml:"skill_areas" json:"-"`
	Items   []*Item  `xml:"item,omitempty" jsons:"item,omitempty"`
}

SkillAreaItemList

func (*SkillAreaItemList) AddItem added in v0.0.14

func (skillAreaItemList *SkillAreaItemList) AddItem(item *Item) int

AddItem adds an item to the skillArea item list and returns the new count of items

type Subject added in v1.0.2

type Subject struct {
	Subject string `json:"subject,omitempty"`
	ID      string `json:"id,omitempty"`
}

Subject element holds one of a list of subjects in the Metadata element.

type SubjectItemList added in v0.0.14

type SubjectItemList struct {
	XMLName xml.Name `xml:"subjects" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

SubjectItemList

func (*SubjectItemList) AddItem added in v0.0.14

func (subjectItemList *SubjectItemList) AddItem(item *Item) int

AddItem adds an item to the subject item list and returns the new count of items

type ThesisAdvisorItemList added in v0.0.14

type ThesisAdvisorItemList struct {
	XMLName xml.Name `xml:"thesis_advisor" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

ThesisAdvisorItemList

func (*ThesisAdvisorItemList) AddItem added in v0.0.14

func (thesisAdvisorItemList *ThesisAdvisorItemList) AddItem(item *Item) int

AddItem adds an item to the thesis advisor item list and returns the new count of items

type ThesisCommitteeItemList added in v0.0.14

type ThesisCommitteeItemList struct {
	XMLName xml.Name `xml:"thesis_committee" json:"-"`
	Items   []*Item  `xml:"item,omitempty" json:"items,omitempty"`
}

ThesisCommitteeItemList

func (*ThesisCommitteeItemList) AddItem added in v0.0.14

func (thesisCommitteeItemList *ThesisCommitteeItemList) AddItem(item *Item) int

AddItem adds an item to the thesis committee item list and returns the new count of items

type TitleDetail added in v1.0.2

type TitleDetail struct {
	Title string `json:"title,omitempty"`
	Type  *Type  `json:"type,omitempty"`
	Lang  *Type  `json:"lang,omitempty"`
}

TitleDetail is used by AdditionalTitles in Metadata.

type Tombstone added in v1.0.2

type Tombstone struct {
	Reason    string    `json:"reason,omitempty"`
	Category  string    `json:"category,omitempty"`
	RemovedBy *User     `json:"removed_by,omitempty"`
	Timestamp time.Time `json:"timestamp,omitempty"`
}

Tombstone

type Type added in v1.0.2

type Type struct {
	ID    string `json:"id,omitempty"`
	Name  string `json:"name,omitempty"`
	Title string `json:"title,omitempty"`
}

Type is an Invenio 3 e.g. ResourceType, title type or language

type TypeDetail added in v1.0.2

type TypeDetail struct {
	ID    string            `json:"id,omitempty"`
	Name  string            `json:"name,omitempty"`
	Title map[string]string `json:"title,omitempty"`
}

Type is an alternate expression of a type where title is map with additional info like language. It is used to describe relationships and resources in Identifiers. It is a variation of Type.

type User added in v1.0.2

type User struct {
	User        int    `json:"user,omitempty"`         // User (integer) identifier
	DisplayName string `json:"display_name,omitempty"` // This is my field to quickly associate the internal integer user id with a name for reporting and display.
	Email       string `json:"email,omitempty"`        // This is my field to quickly display a concact email associated with the integer user id.
}

User is a data structured used in Access to describe record ownership or user actions.

Directories

Path Synopsis
Package eprinttools is a collection of structures, functions and programs// for working with the EPrints XML and EPrints REST API @author R. S. Doiel, <rsdoiel@caltech.edu> Copyright (c) 2021, Caltech All rights not granted herein are expressly reserved by Caltech.
Package eprinttools is a collection of structures, functions and programs// for working with the EPrints XML and EPrints REST API @author R. S. Doiel, <rsdoiel@caltech.edu> Copyright (c) 2021, Caltech All rights not granted herein are expressly reserved by Caltech.
cmd
doi2eprintxml command
Package eprinttools is a collection of structures, functions and programs// for working with the EPrints XML and EPrints REST API @author R. S. Doiel, <rsdoiel@caltech.edu> Copyright (c) 2021, Caltech All rights not granted herein are expressly reserved by Caltech.
Package eprinttools is a collection of structures, functions and programs// for working with the EPrints XML and EPrints REST API @author R. S. Doiel, <rsdoiel@caltech.edu> Copyright (c) 2021, Caltech All rights not granted herein are expressly reserved by Caltech.
ep3apid command
Package eprinttools is a collection of structures, functions and programs// for working with the EPrints XML and EPrints REST API @author R. S. Doiel, <rsdoiel@caltech.edu> Copyright (c) 2021, Caltech All rights not granted herein are expressly reserved by Caltech.
Package eprinttools is a collection of structures, functions and programs// for working with the EPrints XML and EPrints REST API @author R. S. Doiel, <rsdoiel@caltech.edu> Copyright (c) 2021, Caltech All rights not granted herein are expressly reserved by Caltech.
epfmt command
Package eprinttools is a collection of structures, functions and programs// for working with the EPrints XML and EPrints REST API @author R. S. Doiel, <rsdoiel@caltech.edu> Copyright (c) 2021, Caltech All rights not granted herein are expressly reserved by Caltech.
Package eprinttools is a collection of structures, functions and programs// for working with the EPrints XML and EPrints REST API @author R. S. Doiel, <rsdoiel@caltech.edu> Copyright (c) 2021, Caltech All rights not granted herein are expressly reserved by Caltech.
eputil command
Package eprinttools is a collection of structures and functions for working with the EPrints XML and EPrints REST API @author R. S. Doiel, <rsdoiel@caltech.edu> Copyright (c) 2021, Caltech All rights not granted herein are expressly reserved by Caltech.
Package eprinttools is a collection of structures and functions for working with the EPrints XML and EPrints REST API @author R. S. Doiel, <rsdoiel@caltech.edu> Copyright (c) 2021, Caltech All rights not granted herein are expressly reserved by Caltech.

Jump to

Keyboard shortcuts

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