gosudoc

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2017 License: MIT Imports: 4 Imported by: 0

README

gosudoc

A Golang client for the Web Services available for the Union Catalog of French University libraries - SUDOC - as documented at [http://documentation.abes.fr/sudoc/manuels/administration/aidewebservices/index.html]

See the (Godoc for this package)[https://godoc.org/github.com/nicomo/gosudoc]

Covered

  • merged
  • multiwhere
  • frbn2ppn
  • ocn2ppn
  • dnb2ppn
  • Ucatb2ppn
  • frcairninfo2ppn
  • springerln2ppn
  • isbn2ppn
  • ean2ppn

Partially covered

  • issn2ppn : we manage all the returned PPNs, but not the additional NoHoldings information associated with some PPNs

Not covered

  • metaperiodical which isn't really an API as it returns a file rather than data

Documentation

Overview

Package gosudoc is a set of client functions for the web services available on top of the Library Catalog of French University libraries named Sudoc. see http://documentation.abes.fr/sudoc/manuels/administration/aidewebservices/

Index

Examples

Constants

This section is empty.

Variables

View Source
var ID2 = []string{
	"frbn2ppn",
	"ocn2ppn",
	"dnb2ppn",
	"ucatb2ppn",
	"frcairninfo2ppn",
	"springerln2ppn",
	"isbn2ppn",
	"ean2ppn",
}

Functions

func GetMerged

func GetMerged(input []string) (map[string]string, error)

GetMerged takes any number of Sudoc ID numbers (PPN) and matches them with the ID of the merged marc record it echoes the IDs you input, then outputs the returned PPNs Sudoc responds with an error if there's nothing to return

Example
input := []string{"071860576"}
result, _ := GetMerged(input)
for k, v := range result {
	fmt.Println(k, v)
}
Output:
071860576 007527446

func GetMultiwhere

func GetMultiwhere(input []string) (map[string][]Library, error)

GetMultiwhere, given a record ID in the Sudoc catalog will return the list of libraries that hold this item

Example
myInput := []string{"154923206"}
result, _ := GetMultiwhere(myInput)
for k, v := range result {
	fmt.Println(k)
	for _, lib := range v {
		fmt.Printf("RCR: %v / Shortname: %v / Latitude: %v / Longitude: %v\n", lib.RCR, lib.Shortname, lib.Latitude, lib.Longitude)
	}
}
Output:
154923206
RCR: 751052105 / Shortname: PARIS-Bib. de la Sorbonne - BIS / Latitude: 48.8517361 / Longitude: 2.3484821
RCR: 751052116 / Shortname: PARIS-Bib. Sainte Geneviève / Latitude: 48.8467139 / Longitude: 2.3463854

func ID2ppn

func ID2ppn(input []string, id2 string) (map[string][]string, error)

ID2ppn is used for several related web services: given one or more IDs such as isbns, OCLC ocn, etc. and given the appropriate service to try (isbn, ocn, etc) will return the corresponding sudoc record IDs

Example
myIDService := "frbn2ppn"
myInput := []string{"00000051X"}

result, _ := ID2ppn(myInput, myIDService)
for k, v := range result {
	fmt.Println(k)
	for _, value := range v {
		fmt.Println(value)
	}
}
Output:
00000051X
000000167
02635778X

func Issn2ppn

func Issn2ppn(input []string) (map[string][]string, error)

Issn2ppn takes 1 or more ISSNs and will return the corresponding sudoc record IDs

Example
myInput := []string{"02672472"}

result, _ := Issn2ppn(myInput)
for k, v := range result {
	fmt.Println(k)
	for _, value := range v {
		fmt.Println(value)
	}
}
Output:
02672472
013630687

Types

type ID2ppnData

type ID2ppnData struct {
	Err   string `xml:"error"`
	Pairs []struct {
		Frbn        string   `xml:"frbn,omitempty"`
		Ocn         string   `xml:"ocn,omitempty"`
		Dnb         string   `xml:"dnb,omitempty"`
		Ucatb       string   `xml:"ucatb,omitempty"`
		FrCairnInfo string   `xml:"frcairninfo,omitempty"`
		SpringerLN  string   `xml:"springerln,omitempty"`
		Isbn        string   `xml:"isbn,omitempty"`
		Ean         string   `xml:"ean,omitempty"`
		PPNs        []string `xml:"result>ppn"`
	} `xml:"query"`
}

ID2ppnData: used to unmarshal the XML returned by Sudoc will populate the appropriate field given a service, e.g. Ocn for the ocn2ppn web service, and ignore the other fields

type Issn2ppnData

type Issn2ppnData struct {
	Err   string `xml:"error"`
	Pairs []struct {
		Issn          string   `xml:"issn,omitempty"`
		PPNs          []string `xml:"result>ppn"`
		PPNsNoHolding []string `xml:"resultNoHolding>ppn"`
	} `xml:"query"`
}

Issn2ppnData: used to unmarshal the XML returned by Sudoc for the issn2ppn web service

type Library

type Library struct {
	RCR       string `xml:"rcr"`
	Shortname string `xml:"shortname"`
	Latitude  string `xml:"latitude"`
	Longitude string `xml:"longitude"`
}

Library is used when we unmarshal the library info embedded in the returned XML i.e. library ID, name, lat and longitude.

type MergedData

type MergedData struct {
	Err   string `xml:"error"`
	Pairs []struct {
		Queried string `xml:"ppn"`
		Merged  string `xml:"result>ppn"`
	} `xml:"query"`
}

MergedData is used to parse xml response

type MultiwhereData

type MultiwhereData struct {
	Err     string `xml:"error"`
	Results []struct {
		Queried   string    `xml:"ppn"`
		Libraries []Library `xml:"result>library"`
	} `xml:"query"`
}

MultiwhereData is used to parse xml response for the multiwhere web service

Jump to

Keyboard shortcuts

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