aat

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

README

go-aat

Go package for working with Getty Art & Architecture Thesaurus (AAT) XML data

tools

$> make cli
go build -mod vendor -ldflags="-s -w" -o bin/aat2csv cmd/aat2csv/main.go
aat2csv

Parse Getty AAT XML data and emit as CSV data to STDOUT with following columns: id, term, preferred, languages.

$> ./bin/aat2csv -h
Parse Getty AAT XML data and emit as CSV data to STDOUT with following columns: id, term, preferred, languages.
Usage:
	 ./bin/aat2csv [options]
  -terms string
    	The path to a local file on disk containing Getty AAT XML vocabulary data. If empty that data will be retrieved from the Getty servers.

For example:

./bin/aat2csv | less
preferred,id,term,languages
1,300000000,Top of the AAT hierarchies,70051/English
0,300000000,AAT Root,70051/English
0,300000000,Top van de AAT-hiërarchieën,70261/Dutch
0,300000000,藝術與建築詞典根目錄,72551/Chinese (traditional)
0,300000000,i shu yü chien chu tz'u tien ken mu lu,72582/Chinese (transliterated Wade-Giles)
0,300000000,yi shu yu jian zhu ci dian gen mu lu,72586/Chinese (transliterated Pinyin without tones)
0,300000000,yì shù yǔ jiàn zhú cí diǎn gēn mù lù,72584/Chinese (transliterated Hanyu Pinyin)
0,300000000,藝術和建築索引典之最高層級,72551/Chinese (traditional)
0,300000000,藝術與建築索引典最上層,72551/Chinese (traditional)
1,300189559,male,70051/English
0,300189559,masculino,70641/Spanish
0,300189559,mannelijk,70261/Dutch
0,300189559,雄性,72551/Chinese (traditional)
0,300189559,hsiung hsing,72582/Chinese (transliterated Wade-Giles)
0,300189559,xiong xing,72586/Chinese (transliterated Pinyin without tones)
0,300189559,xióng xìng,72584/Chinese (transliterated Hanyu Pinyin)
1,300189557,female,70051/English
... and so on

Notes

This package does not use a streaming XML parser so the entirety of the AAT XML data is read in to memory before parsing occurs.

See also

Documentation

Overview

This file is automatically generated by the twpayne/go-xmlstruct package

Index

Constants

View Source
const AAT_XML string = "http://aatdownloads.getty.edu/VocabData/aat_xml_0622.zip"

AAT_XML is a URI pointing to AAT XML data stored on the Getty servers.

Variables

This section is empty.

Functions

func FetchTerms

func FetchTerms() (io.ReadCloser, error)

FetchTerms returns an `io.ReadCloser` instance containing AAT XML data derived from the URI defined in `AAT_XML`.

func TermsReader

func TermsReader(uri string) (io.ReadCloser, error)

TermsReader returns an `io.ReadCloser` instance containing AAT XML data. If 'uri' is not empty that read will be read from 'uri' which is assumed to be a local file on disk. If 'uri' is empty then the data will returned using the `FetchTerms` function.

Types

type Vocabulary

type Vocabulary struct {
	Subject []struct {
		SubjectID                int `xml:"Subject_ID,attr"`
		AssociativeRelationships *struct {
			AssociativeRelationship []struct {
				ARDate *struct {
					DisplayDate string `xml:"Display_Date"`
					EndDate     int    `xml:"End_Date"`
					StartDate   int    `xml:"Start_Date"`
				} `xml:"AR_Date"`
				HistoricFlag     string `xml:"Historic_Flag"`
				RelatedSubjectID struct {
					VPSubjectID int `xml:"VP_Subject_ID"`
				} `xml:"Related_Subject_ID"`
				RelationshipType string `xml:"Relationship_Type"`
			} `xml:"Associative_Relationship"`
		} `xml:"Associative_Relationships"`
		DescriptiveNotes *struct {
			DescriptiveNote []struct {
				NoteContributors struct {
					NoteContributor []struct {
						ContributorID string `xml:"Contributor_id"`
					} `xml:"Note_Contributor"`
				} `xml:"Note_Contributors"`
				NoteLanguage string `xml:"Note_Language"`
				NoteSources  *struct {
					NoteSource []struct {
						Source struct {
							SourceID string `xml:"Source_ID"`
						} `xml:"Source"`
					} `xml:"Note_Source"`
				} `xml:"Note_Sources"`
				NoteText string `xml:"Note_Text"`
			} `xml:"Descriptive_Note"`
		} `xml:"Descriptive_Notes"`
		Hierarchy           string `xml:"Hierarchy"`
		MergedStatus        string `xml:"Merged_Status"`
		ParentRelationships struct {
			NonPreferredParent []struct {
				HierRelType  string `xml:"Hier_Rel_Type"`
				HistoricFlag string `xml:"Historic_Flag"`
				ParentDate   *struct {
					DisplayDate string `xml:"Display_Date"`
					EndDate     int    `xml:"End_Date"`
					StartDate   int    `xml:"Start_Date"`
				} `xml:"Parent_Date"`
				ParentString     string `xml:"Parent_String"`
				ParentSubjectID  int    `xml:"Parent_Subject_ID"`
				RelationshipType string `xml:"Relationship_Type"`
			} `xml:"Non-Preferred_Parent"`
			PreferredParent struct {
				HierRelType  string `xml:"Hier_Rel_Type"`
				HistoricFlag string `xml:"Historic_Flag"`
				ParentDate   *struct {
					DisplayDate string `xml:"Display_Date"`
					EndDate     int    `xml:"End_Date"`
					StartDate   int    `xml:"Start_Date"`
				} `xml:"Parent_Date"`
				ParentString     string `xml:"Parent_String"`
				ParentSubjectID  int    `xml:"Parent_Subject_ID"`
				RelationshipType string `xml:"Relationship_Type"`
			} `xml:"Preferred_Parent"`
		} `xml:"Parent_Relationships"`
		RecordType          string `xml:"Record_Type"`
		SortOrder           int    `xml:"Sort_Order"`
		SubjectContributors struct {
			SubjectContributor []struct {
				ContributorID string `xml:"Contributor_id"`
			} `xml:"Subject_Contributor"`
		} `xml:"Subject_Contributors"`
		SubjectSources *struct {
			SubjectSource []struct {
				Source struct {
					SourceID string `xml:"Source_ID"`
				} `xml:"Source"`
			} `xml:"Subject_Source"`
		} `xml:"Subject_Sources"`
		Terms struct {
			NonPreferredTerm []struct {
				DisplayName      string `xml:"Display_Name"`
				HistoricFlag     string `xml:"Historic_Flag"`
				TermContributors struct {
					TermContributor []struct {
						ContributorID string `xml:"Contributor_id"`
						Preferred     string `xml:"Preferred"`
					} `xml:"Term_Contributor"`
				} `xml:"Term_Contributors"`
				TermID        int `xml:"Term_ID"`
				TermLanguages *struct {
					TermLanguage []struct {
						LangStat     string `xml:"Lang_Stat"`
						Language     string `xml:"Language"`
						PartOfSpeech string `xml:"Part_of_Speech"`
						Preferred    string `xml:"Preferred"`
						Qualifier    string `xml:"Qualifier"`
						TermType     string `xml:"Term_Type"`
					} `xml:"Term_Language"`
				} `xml:"Term_Languages"`
				TermSources *struct {
					TermSource []struct {
						Page      string `xml:"Page"`
						Preferred string `xml:"Preferred"`
						Source    struct {
							SourceID string `xml:"Source_ID"`
						} `xml:"Source"`
					} `xml:"Term_Source"`
				} `xml:"Term_Sources"`
				TermText   string `xml:"Term_Text"`
				Vernacular string `xml:"Vernacular"`
			} `xml:"Non-Preferred_Term"`
			PreferredTerm struct {
				DisplayName      string `xml:"Display_Name"`
				HistoricFlag     string `xml:"Historic_Flag"`
				TermContributors struct {
					TermContributor []struct {
						ContributorID string `xml:"Contributor_id"`
						Preferred     string `xml:"Preferred"`
					} `xml:"Term_Contributor"`
				} `xml:"Term_Contributors"`
				TermID        int `xml:"Term_ID"`
				TermLanguages struct {
					TermLanguage []struct {
						LangStat     string `xml:"Lang_Stat"`
						Language     string `xml:"Language"`
						PartOfSpeech string `xml:"Part_of_Speech"`
						Preferred    string `xml:"Preferred"`
						Qualifier    string `xml:"Qualifier"`
						TermType     string `xml:"Term_Type"`
					} `xml:"Term_Language"`
				} `xml:"Term_Languages"`
				TermSources *struct {
					TermSource []struct {
						Page      string `xml:"Page"`
						Preferred string `xml:"Preferred"`
						Source    struct {
							SourceID string `xml:"Source_ID"`
						} `xml:"Source"`
					} `xml:"Term_Source"`
				} `xml:"Term_Sources"`
				TermText   string `xml:"Term_Text"`
				Vernacular string `xml:"Vernacular"`
			} `xml:"Preferred_Term"`
		} `xml:"Terms"`
	} `xml:"Subject"`
}

Vocabulary is a struct that maps to the data structure of the Getty AAT vocabulary file.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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