resource

package
Version: v0.0.0-...-e87e52a Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2020 License: MIT Imports: 9 Imported by: 0

README

FYI

This package contains common types and functions to handle them. This package should not have dependencies to any other package in this application.

Documentation

Index

Constants

View Source
const (
	// Srcs
	ModelSrcEuler  = "euler"
	ModelSrcSparQl = "sparQl"

	// katalog
	TypeCompositionType = "compositionType"
	TypeCorporation     = "corporation"
	TypeEvent           = "event"
	TypeGenre           = "genre"
	TypeInstrument      = "instrument"
	TypePerson          = "person"
	TypePlace           = "place"
	TypePublication     = "publication"
	TypeSerial          = "serial"
	TypeSubject         = "subject"
	TypeWork            = "work"
	TypeWorkseries      = "workSeries"

	// website deichman.no
	TypeExtendedPublication = "extendedPublication"

	// tjenestekatalog
	TypeCampaign             = "campaign"
	TypePage                 = "page"
	TypeLibraryEventInstance = "libraryEventInstance"
	TypeBranch               = "branch"

	// editorial content
	TypeLike            = "like"
	TypePublicationList = "publicationList"
	TypeRecommendation  = "recommendation"
	TypeService         = "service"

	// Namespaces
	NsContent   = "https://content.deichman.no/ontology/"
	NsKatalog   = "http://data.deichman.no/ontology#"
	NsTjenester = "https://tjenester.deichman.no/ontology/"
)

Variables

Functions

func GetResourceTypeGraph

func GetResourceTypeGraph(resourceType string) (string, error)

func GetResourceTypeURI

func GetResourceTypeURI(resourceType string) string

assumes we're dealing with Deich authorities, excluding authorized values

func GetTypeAndIdFromURI

func GetTypeAndIdFromURI(uri string) (string, string)

assumes URIs on the form http://data.deichman.no/type/id (which holds for authorities that are not authorized values)

func IsSupportedResourceType

func IsSupportedResourceType(resourceType string) bool

func NewPublicationModel

func NewPublicationModel(constructedModel []byte) (publication.IndexedPublication, error)

func TypeToClass

func TypeToClass(resourceType string) string

Types

type ConstructedModel

type ConstructedModel struct {
	Graph           []json.RawMessage `json:"@graph"`
	ReverseLinkData map[RawResourceType]json.RawMessage
	ResourceType    RawResourceType
	ModelSource     ModelSrc
}

func (*ConstructedModel) IsEmpty

func (c *ConstructedModel) IsEmpty() bool

type ModelSrc

type ModelSrc string

type RawResourceId

type RawResourceId struct {
	IRI          string
	Namespace    string
	ResourceType string
	Id           string
}

func NewRawResourceId

func NewRawResourceId(iri string) RawResourceId

type RawResourceType

type RawResourceType struct {
	Namespace    string
	Class        string
	ResourceType string
	SynteticType string
}

func NewRawResourceType

func NewRawResourceType(iri string, requestedType string) (RawResourceType, error)

type SibylModel

type SibylModel struct {
	AlternativeName                  doc.FlexArray `json:"alternativeName,omitempty"`
	Audience                         doc.FlexArray `json:"audience,omitempty"`
	BirthPlace                       string        `json:"birthPlace,omitempty"`
	BirthYear                        *int          `json:"birthYear,omitempty"`
	Branch                           string        `json:"branch,omitempty"`
	BranchID                         string        `json:"branchId,omitempty"`
	CampaignType                     string        `json:"campaignType,omitempty"`
	Created                          string        `json:"created,omitempty"`
	CreatedBy                        string        `json:"createdBy,omitempty"`
	Date                             string        `json:"date,omitempty"`
	DeathYear                        *int          `json:"deathYear,omitempty"`
	Description                      string        `json:"description,omitempty"`
	Ean                              doc.FlexArray `json:"ean,omitempty"`
	Edition                          string        `json:"edition,omitempty"`
	Email                            string        `json:"email,omitempty"`
	EndTime                          string        `json:"endTime,omitempty"`
	ExternalPublicationIdentificator string        `json:"externalPublicationIdentificator,omitempty"`
	FirstName                        string        `json:"firstName,omitempty"`
	Format                           doc.FlexArray `json:"format,omitempty"`
	Gender                           string        `json:"gender,omitempty"`
	HeroImage                        string        `json:"heroImage,omitempty"`
	Highlight                        string        `json:"highlight,omitempty"`
	ID                               string        `json:"id"`
	ImageAltName                     string        `json:"imageAltName,omitempty"`
	ImageCredits                     string        `json:"imageCredits,omitempty"`
	ImageLicense                     string        `json:"imageLisence,omitempty"`
	ImageUrl                         string        `json:"imageUrl,omitempty"`
	Ingress                          string        `json:"ingress,omitempty"`
	Intro                            string        `json:"intro,omitempty"`
	Isbn                             doc.FlexArray `json:"isbn,omitempty"`
	IsbnIncorrect                    doc.FlexArray `json:"isbnIncorrect,omitempty"`
	IsHiddenFromPublic               string        `json:"isHiddenFromPublic,omitempty"`
	Ismn                             string        `json:"ismn,omitempty"`
	Issn                             string        `json:"issn,omitempty"`
	Label                            string        `json:"label,omitempty"`
	LastName                         string        `json:"lastName,omitempty"`
	LinkName                         string        `json:"linkName,omitempty"`
	LinkUrl                          string        `json:"linkUrl,omitempty"`
	LiteraryForm                     doc.FlexArray `json:"literaryForm,omitempty"`
	MainContributor                  string        `json:"mainContributor,omitempty"`
	MainTitle                        string        `json:"mainTitle,omitempty"`
	MediaType                        string        `json:"mediaType,omitempty"`
	Modified                         string        `json:"modified,omitempty"`
	ModifiedBy                       string        `json:"modifiedBy,omitempty"`
	Name                             string        `json:"name"`
	Nationality                      doc.FlexArray `json:"nationality,omitempty"`
	NormalizedName                   string        `json:"normalizedName,omitempty"`
	Ordinal                          string        `json:"ordinal,omitempty"`
	Pages                            doc.FlexArray `json:"pages,omitempty"`
	PartNumber                       doc.FlexArray `json:"partNumber,omitempty"`
	PartTitle                        doc.FlexArray `json:"partTitle,omitempty"`
	Place                            doc.FlexArray `json:"place,omitempty"`
	Placement                        string        `json:"placement,omitempty"`
	Preamble                         string        `json:"preamble,omitempty"`
	PrefLabel                        string        `json:"prefLabel,omitempty"`
	PublicationStart                 string        `json:"publicationStart,omitempty"`
	PublicationEnd                   string        `json:"publicationEnd,omitempty"`
	PublicationYear                  doc.FlexArray `json:"publicationYear,omitempty"`
	PublishedBy                      doc.FlexArray `json:"publishedBy,omitempty"`
	RecordID                         string        `json:"recordId,omitempty"`
	Roles                            string        `json:"roles,omitempty"`
	SeeAlso                          doc.FlexArray `json:"seeAlso,omitempty"`
	SerialNumber                     string        `json:"serialNumber,omitempty"`
	SerialPartnumber                 doc.FlexArray `json:"serialPartnumber,omitempty"`
	SerialParttitle                  doc.FlexArray `json:"serialParttitle,omitempty"`
	SerialSubtitle                   doc.FlexArray `json:"serialSubtitle,omitempty"`
	SerialTitle                      doc.FlexArray `json:"serialTitle,omitempty"`
	ServiceForm                      string        `json:"serviceForm,omitempty"`
	Specification                    string        `json:"specification,omitempty"`
	StartTime                        string        `json:"startTime,omitempty"`
	Status                           string        `json:"status,omitempty"`
	Subdivision                      string        `json:"subdivision,omitempty"`
	Subtitle                         doc.FlexArray `json:"subtitle,omitempty"`
	Tags                             doc.FlexArray `json:"tags,omitempty"`
	Theme                            string        `json:"theme,omitempty"`
	Title                            string        `json:"title,omitempty"`
	Type                             string        `json:"type"`
	URI                              string        `json:"uri,omitempty"`
	VariantTitle                     doc.FlexArray `json:"variantTitle,omitempty"`
	WorkType                         doc.FlexArray `json:"workType,omitempty"`
}

func NewSibylModel

func NewSibylModel(constructedModel []byte) (SibylModel, error)

type TransformablePublication

type TransformablePublication struct {
	ID        string        `json:"id"`
	URI       string        `json:"uri"`
	RecordID  string        `json:"recordId"`
	MediaType string        `json:"mediaType"`
	MainTitle string        `json:"mainTitle"`
	IDs       doc.FlexArray `json:"ids"`
	Created   string        `json:"created"`
	AgeLimit  int           `json:"ageLimit"`

	WritingSystem      string        `json:"writingSystem"`
	TitleAll           doc.FlexArray `json:"titleAll"`
	PartTitle          string        `json:"partTitle"`
	PartNumber         string        `json:"partNumber"`
	Subtitle           doc.FlexArray `json:"subtitle"`
	UntranscribedTitle string        `json:"untranscribedTitle"`
	PublicationYear    string        `json:"publicationYear"`
	W150               string        `json:"imageW150"`
	W270               string        `json:"imageW270"`
	W420               string        `json:"imageW420"`
	WFull              string        `json:"imageFull"`
	Formats            doc.FlexArray `json:"formats"`
	Languages          doc.FlexArray `json:"languages"`
	OtherLanguages     doc.FlexArray `json:"otherLanguages"`
	FormatAdaptations  doc.FlexArray `json:"formatAdaptations"`
	PublishedBy        doc.FlexArray `json:"publishedBy"`
	Parts              doc.FlexArray `json:"parts"`
	Subtitles          doc.FlexArray `json:"subtitles"`
	Various            doc.FlexArray `json:"various"`

	Actors              doc.FlexArray `json:"actor"`
	Adaptors            doc.FlexArray `json:"adaptor"`
	Authors             doc.FlexArray `json:"author"`
	Composers           doc.FlexArray `json:"composer"`
	Conductors          doc.FlexArray `json:"conductor"`
	Contributors        doc.FlexArray `json:"contributor"`
	Coreographers       doc.FlexArray `json:"coreographer"`
	Directors           doc.FlexArray `json:"director"`
	Editors             doc.FlexArray `json:"editor"`
	Featuring           doc.FlexArray `json:"featuring"`
	Illustrators        doc.FlexArray `json:"illustrator"`
	Lyricists           doc.FlexArray `json:"lyricist"`
	MusicalArrangers    doc.FlexArray `json:"musicalArranger"`
	Performers          doc.FlexArray `json:"performer"`
	Photographers       doc.FlexArray `json:"photographer"`
	Producers           doc.FlexArray `json:"producer"`
	ProductionCompanies doc.FlexArray `json:"productionCompany"`
	Publishers          doc.FlexArray `json:"publisher"`
	Readers             doc.FlexArray `json:"reader"`
	Scriptwriters       doc.FlexArray `json:"scriptWriter"`
	Translators         doc.FlexArray `json:"translator"`

	WorkURI                string        `json:"workUri"`
	MainEntry              string        `json:"mainEntry"`
	MainEntryNationalities doc.FlexArray `json:"mainEntryNationalities"`
	WorkType               string        `json:"workType"`
	WorkMainTitle          string        `json:"workMainTitle"`
	WorkPublicationYear    string        `json:"workPublicationYear"`
	WorkLanguages          doc.FlexArray `json:"workLanguages"`
	FictionNonfiction      string        `json:"fictionNonfiction"`
	ContentAdaptations     doc.FlexArray `json:"contentAdaptations"`
	Biography              doc.FlexArray `json:"biography"`

	WorkActors              doc.FlexArray `json:"work_actor"`
	WorkAdaptors            doc.FlexArray `json:"work_adaptor"`
	WorkAuthors             doc.FlexArray `json:"work_author"`
	WorkComposers           doc.FlexArray `json:"work_composer"`
	WorkConductors          doc.FlexArray `json:"work_conductor"`
	WorkContributors        doc.FlexArray `json:"work_contributor"`
	WorkCoreographers       doc.FlexArray `json:"work_coreographer"`
	WorkDirectors           doc.FlexArray `json:"work_director"`
	WorkEditors             doc.FlexArray `json:"work_editor"`
	WorkFeaturing           doc.FlexArray `json:"work_featuring"`
	WorkIllustrators        doc.FlexArray `json:"work_illustrator"`
	WorkLyricists           doc.FlexArray `json:"work_lyricist"`
	WorkMusicalArrangers    doc.FlexArray `json:"work_musicalArranger"`
	WorkPerformers          doc.FlexArray `json:"work_performer"`
	WorkPhotographers       doc.FlexArray `json:"work_photographer"`
	WorkProducers           doc.FlexArray `json:"work_producer"`
	WorkProductionCompanies doc.FlexArray `json:"work_productionCompany"`
	WorkPublishers          doc.FlexArray `json:"work_publisher"`
	WorkReaders             doc.FlexArray `json:"work_reader"`
	WorkScriptwriters       doc.FlexArray `json:"work_scriptWriter"`
	WorkTranslators         doc.FlexArray `json:"work_translator"`

	LiteraryForms     doc.FlexArray `json:"literaryForms"`
	Genres            doc.FlexArray `json:"genres"`
	Subjects          doc.FlexArray `json:"subjects"`
	Audiences         doc.FlexArray `json:"audiences"`
	CompositionTypes  doc.FlexArray `json:"compositionTypes"`
	CountriesOfOrigin doc.FlexArray `json:"countriesOfOrigin"`
	DeweyNumbers      doc.FlexArray `json:"deweyNumbers"`
	Series            doc.FlexArray `json:"series"`
	DisplaySeries     doc.FlexArray `json:"displaySeries"`
	Instruments       doc.FlexArray `json:"instruments"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL