Documentation
¶
Overview ¶
Package profiles defines editing profiles -- the JSON documents that replace MARC frameworks (Koha's tag/subfield configuration) for the BIBFRAME-native editor. A profile declares which fields a form shows, their cardinality, datatype, value source, and defaults; the framework ships conservative defaults and a deployment overrides or adds its own as git-reviewed JSON. Validate is the "framework test": every profile is checked at load, so a bad profile fails boot, not a cataloger's save.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Field ¶
type Field struct {
// Path is the field's key in the WorkDoc (unique per profile).
Path string `json:"path"`
// Predicates is the property chain from the resource node to the value:
// one IRI for a direct property, two or three for a value hanging off
// intermediate nodes (e.g. bf:title -> bf:mainTitle, or
// bf:contribution -> bf:agent -> rdfs:label).
Predicates []string `json:"predicates"`
Label string `json:"label"`
Help string `json:"help,omitempty"`
// Min/Max bound cardinality; Max 0 = unbounded.
Min int `json:"min,omitempty"`
Max int `json:"max,omitempty"`
ValueSource ValueSource `json:"valueSource"`
// ReadOnly renders the field's values (with provenance) but rejects
// ops against it -- for values living inside typed blank structures
// the op layer cannot rebuild yet (e.g. contributions).
ReadOnly bool `json:"readOnly,omitempty"`
// Annotation is a predicate chain resolved from each value's structure
// node into a display-only qualifier (e.g. a heading's bf:source label,
// MARC's $2). Chained fields only; the annotation's quads stay in
// passthrough, so it never affects the doc round trip.
Annotation []string `json:"annotation,omitempty"`
Default string `json:"default,omitempty"`
Hidden bool `json:"hidden,omitempty"`
// MarcHint names the roughly-equivalent MARC field for copy catalogers.
MarcHint string `json:"marcHint,omitempty"`
}
Field is one editable property.
type Profile ¶
type Profile struct {
ID string `json:"id"`
Label string `json:"label"`
ResourceType ResourceType `json:"resourceType"`
Fields []Field `json:"fields"`
}
Profile is one editing profile.
type ResourceType ¶
type ResourceType string
ResourceType names what a profile edits.
const ( ResourceWork ResourceType = "work" ResourceInstance ResourceType = "instance" ResourceItem ResourceType = "item" ResourceAuthority ResourceType = "authority" )
type Set ¶
Set is a loaded, validated profile collection keyed by id.
func LoadDefaults ¶
LoadDefaults returns the framework's shipped profiles.
func LoadDir ¶
LoadDir loads and validates a deployment's profile overrides on top of the defaults (same id replaces).
func (Set) ForResource ¶
func (s Set) ForResource(rt ResourceType) []*Profile
ForResource returns the set's profiles for one resource type, id-sorted.
type ValueKind ¶
type ValueKind string
ValueKind names how a field's values are entered and validated.
const ( // KindLiteral is a plain string. KindLiteral ValueKind = "literal" // KindLangLiteral is a language-tagged string. KindLangLiteral ValueKind = "langLiteral" // KindDate is an EDTF/ISO date string. KindDate ValueKind = "date" // KindEnum restricts values to the field's Options. KindEnum ValueKind = "enum" // KindVocab is a controlled term picked from the vocabulary index // (Ref = scheme); the stored value is the term URI. KindVocab ValueKind = "vocab" // KindAuthority is a local-authority link (Ref = authority profile id). KindAuthority ValueKind = "authority" // KindEntity is an IRI reference to another catalog entity. KindEntity ValueKind = "entity" )
type ValueSource ¶
type ValueSource struct {
Kind ValueKind `json:"kind"`
// Ref points at the kind's backing set (vocab scheme, authority profile).
Ref string `json:"ref,omitempty"`
// Options inlines the allowed values for enum fields.
Options []string `json:"options,omitempty"`
}
ValueSource declares a field's entry mechanism.