mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-30 01:25:30 +00:00
Akteure beginning
This commit is contained in:
@@ -3,6 +3,7 @@ package xmlprovider
|
||||
import (
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Work struct {
|
||||
@@ -10,11 +11,20 @@ type Work struct {
|
||||
URLs []URL `xml:"url"`
|
||||
Citation Citation `xml:"zitation"`
|
||||
PreferredTitle string `xml:"preferred"`
|
||||
Akteur []AgentRef `xml:"akteur"`
|
||||
AgentRefs []AgentRef `xml:"akteur"`
|
||||
Identifier
|
||||
AnnotationNote
|
||||
}
|
||||
|
||||
func (p Work) ReferencesAgent(a string) (*AgentRef, bool) {
|
||||
for _, i := range p.AgentRefs {
|
||||
if strings.HasPrefix(i.Ref, a) {
|
||||
return &i, true
|
||||
}
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
|
||||
type Citation struct {
|
||||
XMLName xml.Name `xml:"zitation"`
|
||||
Title string `xml:"title"`
|
||||
@@ -24,5 +34,5 @@ type Citation struct {
|
||||
}
|
||||
|
||||
func (w Work) String() string {
|
||||
return fmt.Sprintf("URLs: %v, Citation: %v, PreferredTitle: %s, Akteur: %v, Identifier: %v, AnnotationNote: %v\n", w.URLs, w.Citation, w.PreferredTitle, w.Akteur, w.Identifier, w.AnnotationNote)
|
||||
return fmt.Sprintf("URLs: %v, Citation: %v, PreferredTitle: %s, Akteur: %v, Identifier: %v, AnnotationNote: %v\n", w.URLs, w.Citation, w.PreferredTitle, w.AgentRefs, w.Identifier, w.AnnotationNote)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user