core

package
v0.0.0-...-eb15970 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConceptAdded             = NatureOfChange(1)
	ConceptChanged           = NatureOfChange(2)
	ConceptRemoved           = NatureOfChange(3)
	OwningConceptChanged     = NatureOfChange(4)
	ReferencedConceptChanged = NatureOfChange(5)
	AbstractConceptChanged   = NatureOfChange(6)
	RefinedConceptChanged    = NatureOfChange(7)
	OwnedConceptChanged      = NatureOfChange(8)
	IndicatedConceptChanged  = NatureOfChange(9)
	Tickle                   = NatureOfChange(10)
)

ConceptChanged indicates that an attribute of the concept that is NOT an element reference has changed OwningConceptChanged indicates that the ownership of the concept has changed ReferencedConceptChanged indicates that a different Element is being referenced AbstractConceptChanged indicates that a different Element is now the abstract concept RefinedConceptChanged indicates that a different Element is now the refined concept ConceptAdded and ConceptRemoved are notifications with respect to the UniverseOfDiscourse OwnedConceptChanged indicates that a notification has been received that one of the Owned Concepts has changed IndicatedConceptChanged indicates that the object being referenced has changed Tickle does not indicate a change: it is intended to trigger any functions associated with the Element being tickled

View Source
const (
	NoAttribute         = AttributeName(0)
	OwningConceptID     = AttributeName(1)
	ReferencedConceptID = AttributeName(2)
	AbstractConceptID   = AttributeName(3)
	RefinedConceptID    = AttributeName(4)
	LiteralValue        = AttributeName(5)
	Label               = AttributeName(6)
	Definition          = AttributeName(7)
)

NoAttribute indicates that no attribute is being referenced OwningConceptID indicates that the OwningConceptID is being referenced ReferencedConceptID indicates that the ReferencedConceptID is being referenced AbstractConceptID indicates that the AbstractConceptID is being referenced RefinedConceptID indicates that the RefinedConceptID is being referenced LiteralValue indicates that the LiteralValue is being referenced

Variables

View Source
var AdHocTrace = false

AdHocTrace is a global variable used in troubleshooting. Generally debugging logic is wrapped in a conditional expression contingent on the value of this variable

View Source
var CoreDomainURI = CorePrefix + "CoreDomain"

CoreDomainURI is the URI for the core concept space

View Source
var CorePrefix = "http://activeCrl.com/core/"

CorePrefix is a string that prefixes all URIs for the core concepts

View Source
var ElementURI = CorePrefix + "Element"

ElementURI is the URI for the Element core concept

View Source
var EnableNotificationPrint bool

EnableNotificationPrint turns on the printing of notifications during tracing.

View Source
var LiteralURI = CorePrefix + "Literal"

LiteralURI is the URI for the Literal core concept

View Source
var OmitDiagramRelatedCalls bool

OmitDiagramRelatedCalls is a boolean that indicates whether diagram management calls should be omitted when TraceChanve is enabled.

View Source
var OmitHousekeepingCalls bool

OmitHousekeepingCalls is a boolean that indicates whether housekeeping calls should be omitted when TraceChanve is enabled.

View Source
var OmitManageTreeNodesCalls bool

OmitManageTreeNodesCalls is a boolean that indicates whether tree node management calls should be omitted when TraceChanve is enabled.

View Source
var ReferenceURI = CorePrefix + "Reference"

ReferenceURI is the URI for the Reference core concept

View Source
var RefinementURI = CorePrefix + "Refinement"

RefinementURI is the URI for the Refinement core concept

View Source
var TraceChange bool

TraceChange is a boolean that, when true, turns on the tracing of ChangeNotifications

View Source
var TraceLocks = false

TraceLocks is a boolean that, when true, turns on the tracing of locks

View Source
var TransientURI = CorePrefix + "Transient"

TransientURI is the URI for transient information that needs to have undo/redo It is never saved and does not appear in the UniverseOfDiscourse.GetRootElements() set

View Source
var UniverseOfDiscourseURI = CorePrefix + "UniverseOfDiscourse"

UniverseOfDiscourseURI is the URI for the UniverseOfDiscourse core concept

Functions

func ClearFunctionCallGraphs

func ClearFunctionCallGraphs()

ClearFunctionCallGraphs deletes all existing FunctionCallGraphs

func ClearNotificationGraphs

func ClearNotificationGraphs()

ClearNotificationGraphs deletes all existing NotificationGraphs

func ConceptTypeToString

func ConceptTypeToString(conceptType ConceptType) string

ConceptTypeToString returns the string representation of the ConceptType

func Equivalent

func Equivalent(be1 Concept, hl1 *Transaction, be2 Concept, hl2 *Transaction, printExceptions ...bool) bool

Equivalent returns true if the two elements are equivalent

func GetConceptTypeString

func GetConceptTypeString(el Concept) string

GetConceptTypeString returns the string representing the reflected type

func Print

func Print(el Concept, prefix string, trans *Transaction)

Print prints the indicated element and its ownedConcepts, recursively

func PrintStackEntry

func PrintStackEntry(entry *undoRedoStackEntry, trans *Transaction)

PrintStackEntry prints the entry on the stack. It is intended for use only in debugging

func PrintURIIndex

func PrintURIIndex(uOfD *UniverseOfDiscourse, trans *Transaction)

PrintURIIndex prints the URI index of the uOfD with full Element information

func PrintUndoStack

func PrintUndoStack(s undoStack, stackName string, uOfD *UniverseOfDiscourse)

PrintUndoStack prints the undo stack. It is intended only for debugging.

func RecursivelyEquivalent

func RecursivelyEquivalent(e1 Concept, hl1 *Transaction, e2 Concept, hl2 *Transaction, printExceptions ...bool) bool

RecursivelyEquivalent returns true if two elements and all of their children are equivalent

Types

type AttributeName

type AttributeName int

AttributeName indicates the attribute being referenced (if any):

func FindAttributeName

func FindAttributeName(stringName string) (AttributeName, error)

FindAttributeName takes a string version of the name and returns the corresponding AttributeName enumeration value

func (AttributeName) String

func (an AttributeName) String() string

type ChangeNotification

type ChangeNotification struct {
	// contains filtered or unexported fields
}

ChangeNotification records the data and metadata regarding a change to a Element. It provides the nature of the change, the old and new values, and the reporting Element. It also provides the underlying change that triggered this one (if any)

func (*ChangeNotification) GetAfterConceptState

func (cnPtr *ChangeNotification) GetAfterConceptState() *ConceptState

GetAfterConceptState returns the state of the Element after the change

func (*ChangeNotification) GetBeforeConceptState

func (cnPtr *ChangeNotification) GetBeforeConceptState() *ConceptState

GetBeforeConceptState returns the state of the Element before the change

func (*ChangeNotification) GetChangedConceptID

func (cnPtr *ChangeNotification) GetChangedConceptID() string

GetChangedConceptID returns the ID of the Element impacted by the change

func (*ChangeNotification) GetChangedConceptLabel

func (cnPtr *ChangeNotification) GetChangedConceptLabel() string

GetChangedConceptLabel returns the label of the Element impacted by the change

func (*ChangeNotification) GetChangedConceptType

func (cnPtr *ChangeNotification) GetChangedConceptType() string

GetChangedConceptType returns the typeString of the Element impacted by the change

func (*ChangeNotification) GetDepth

func (cnPtr *ChangeNotification) GetDepth() int

GetDepth returns the depth of the nested notifications within the current notification

func (*ChangeNotification) GetNatureOfChange

func (cnPtr *ChangeNotification) GetNatureOfChange() NatureOfChange

GetNatureOfChange returns the NatureOFChange

func (*ChangeNotification) GetReportingElementID

func (cnPtr *ChangeNotification) GetReportingElementID() string

GetReportingElementID returns the ID of the element sending the notification. For all notifications except ConceptRemoved, this will be the ConceptID from the notification's reportingElementState. For ConceptRemoved, it is the ConceptID of the beforeConceptState, which is the only populated portion of the notification

func (*ChangeNotification) GetReportingElementLabel

func (cnPtr *ChangeNotification) GetReportingElementLabel() string

GetReportingElementLabel returns the Label of the element sending the notification

func (*ChangeNotification) GetReportingElementState

func (cnPtr *ChangeNotification) GetReportingElementState() *ConceptState

GetReportingElementState returns the State of the element sending the notification If this is nil, the report is coming from the uOfD

func (*ChangeNotification) GetReportingElementType

func (cnPtr *ChangeNotification) GetReportingElementType() string

GetReportingElementType returns the Type of the element sending the notification

func (*ChangeNotification) GetUnderlyingChange

func (cnPtr *ChangeNotification) GetUnderlyingChange() *ChangeNotification

GetUnderlyingChange returns the change notification that triggered the change being reported in this ChangeNotification

func (*ChangeNotification) IsReferenced

func (cnPtr *ChangeNotification) IsReferenced(el Concept) bool

IsReferenced returns true if the element is either the changed concept or the reporting element in the change notification, including underlying changes.

func (*ChangeNotification) Print

func (cnPtr *ChangeNotification) Print(prefix string, trans *Transaction)

Print prints the change notification for diagnostic purposes to the log

type Concept

type Concept interface {
	Subject

	// editableError(*HeldLocks) error
	FindAbstractions(map[string]Concept, *Transaction)
	FindImmediateAbstractions(map[string]Concept, *Transaction)
	GetConceptID(*Transaction) string

	GetConceptType() ConceptType
	GetDefinition(*Transaction) string
	GetFirstOwnedConceptRefinedFrom(Concept, *Transaction) Concept
	GetFirstOwnedConceptRefinedFromURI(string, *Transaction) Concept
	GetFirstOwnedLiteralRefinementOf(Concept, *Transaction) Concept
	GetFirstOwnedLiteralRefinementOfURI(string, *Transaction) Concept
	GetFirstOwnedReferenceRefinedFrom(Concept, *Transaction) Concept
	GetFirstOwnedReferenceRefinedFromURI(string, *Transaction) Concept
	GetFirstOwnedRefinementRefinedFrom(Concept, *Transaction) Concept
	GetFirstOwnedRefinementRefinedFromURI(string, *Transaction) Concept
	GetFirstOwnedConceptWithURI(string, *Transaction) Concept
	GetFirstOwnedLiteralRefinedFrom(Concept, *Transaction) Concept
	GetFirstOwnedLiteralRefinedFromURI(string, *Transaction) Concept
	GetFirstOwnedLiteralWithURI(string, *Transaction) Concept
	GetFirstOwnedReferenceWithURI(string, *Transaction) Concept
	GetFirstOwnedRefinementWithURI(string, *Transaction) Concept
	GetIsCore(*Transaction) bool
	GetLabel(*Transaction) string

	// getListeners(*HeldLocks) (mapset.Set, error)
	// GetOwnedConcepts(*HeldLocks) mapset.Set
	GetOwnedConcepts(trans *Transaction) map[string]Concept
	GetOwnedConceptIDs(trans *Transaction) mapset.Set
	GetOwnedConceptsRefinedFrom(Concept, *Transaction) map[string]Concept
	GetOwnedConceptsRefinedFromURI(string, *Transaction) map[string]Concept
	GetOwnedDescendantsRefinedFrom(Concept, *Transaction) map[string]Concept
	GetOwnedDescendantsRefinedFromURI(string, *Transaction) map[string]Concept
	GetOwnedLiteralsRefinedFrom(Concept, *Transaction) map[string]Concept
	GetOwnedLiteralsRefinedFromURI(string, *Transaction) map[string]Concept
	GetOwnedReferencesRefinedFrom(Concept, *Transaction) map[string]Concept
	GetOwnedReferencesRefinedFromURI(string, *Transaction) map[string]Concept
	GetOwnedRefinementsRefinedFrom(Concept, *Transaction) map[string]Concept
	GetOwnedRefinementsRefinedFromURI(string, *Transaction) map[string]Concept
	GetOwningConceptID(*Transaction) string
	GetOwningConcept(*Transaction) Concept

	GetUniverseOfDiscourse(*Transaction) *UniverseOfDiscourse

	GetURI(*Transaction) string

	GetVersion(*Transaction) int

	IsRefinementOf(Concept, *Transaction) bool
	IsRefinementOfURI(string, *Transaction) bool
	IsOwnedConcept(Concept, *Transaction) bool
	IsReadOnly(*Transaction) bool
	MarshalJSON() ([]byte, error)

	SetDefinition(string, *Transaction) error
	SetIsCore(*Transaction) error
	SetIsCoreRecursively(*Transaction) error
	SetLabel(string, *Transaction) error
	SetOwningConcept(Concept, *Transaction) error
	SetOwningConceptID(string, *Transaction) error
	SetReadOnly(bool, *Transaction) error
	SetReadOnlyRecursively(bool, *Transaction) error

	SetURI(string, *Transaction) error

	TraceableReadLock(*Transaction)
	TraceableWriteLock(*Transaction)
	TraceableReadUnlock(*Transaction)
	TraceableWriteUnlock(*Transaction)
	// Literal
	GetLiteralValue(*Transaction) string
	SetLiteralValue(string, *Transaction) error
	// Reference
	GetReferencedConcept(*Transaction) Concept
	GetReferencedConceptID(*Transaction) string
	GetReferencedAttributeName(*Transaction) AttributeName
	GetReferencedAttributeValue(*Transaction) string

	SetReferencedConcept(Concept, AttributeName, *Transaction) error
	SetReferencedConceptID(string, AttributeName, *Transaction) error
	// Refinement
	GetAbstractConceptID(*Transaction) string

	GetAbstractConcept(*Transaction) Concept

	GetRefinedConceptID(*Transaction) string

	GetRefinedConcept(*Transaction) Concept

	SetAbstractConcept(Concept, *Transaction) error
	SetAbstractConceptID(string, *Transaction) error
	SetRefinedConcept(Concept, *Transaction) error
	SetRefinedConceptID(string, *Transaction) error
	// contains filtered or unexported methods
}

Concept is the representation of a concept

var Transient Concept

Transient is the instantiated Transient element

type ConceptState

type ConceptState struct {
	// Element fields
	ConceptID       string
	ConceptType     string
	OwningConceptID string
	Label           string
	Definition      string
	URI             string
	Version         string
	IsCore          string
	ReadOnly        string
	// Literal fields
	LiteralValue string
	// Reference fields
	ReferencedConceptID     string
	ReferencedAttributeName string
	// Refinement Fields
	AbstractConceptID string
	RefinedConceptID  string
}

ConceptState is a flattened representation of all concept types. It is used to capture the current state of a concept

func NewConceptState

func NewConceptState(el Concept) (*ConceptState, error)

NewConceptState copies the state of an Element into a ConceptState struct

type ConceptType

type ConceptType int

ConceptType indicates the type of the core concept being represented

const (
	Element ConceptType = iota
	Literal
	Reference
	Refinement
)

Element is the representation of a simple concept Literal is the representatio of a literal string Reference is the representation of a reference to another concept Refinement is the representation of an abstraction-refinement relationship

func StringToConceptType

func StringToConceptType(s string) (ConceptType, error)

StringToConceptType returns the ConceptType corresponding to the string

type CrlGraph

type CrlGraph struct {
	// contains filtered or unexported fields
}

CrlGraph is a graphviz representation of a specified set of CRL data structures. At present, Refinements cannot be the referencedConcept of a Reference.

func NewCrlGraph

func NewCrlGraph(graphName string) *CrlGraph

NewCrlGraph returns an initialized CrlGraph

func (*CrlGraph) AddConceptRecursively

func (graphPtr *CrlGraph) AddConceptRecursively(concept Concept, trans *Transaction) error

AddConceptRecursively will add the given concept and all its child descendants to the graph. it will also add any referenced concepts, but not recursively. Existing concepts will not be duplicated.

func (*CrlGraph) ExportDOT

func (graphPtr *CrlGraph) ExportDOT(pathname string, filename string) error

ExportDOT writes a file containing the DOT representation of the graph

type FunctionCallGraph

type FunctionCallGraph struct {
	// contains filtered or unexported fields
}

FunctionCallGraph is a graphical representation of the function calls made when HeldLocks.ReleaseLocks is called

func GetFunctionCallGraphs

func GetFunctionCallGraphs() []*FunctionCallGraph

GetFunctionCallGraphs returns the array of FunctionCallGraphs that have been created

func NewFunctionCallGraph

func NewFunctionCallGraph(functionID string, executingElement Concept, notification *ChangeNotification, trans *Transaction) *FunctionCallGraph

NewFunctionCallGraph creates a function call graph for the indicated function, executing element, and notifications

func (*FunctionCallGraph) GetGraph

func (bgPtr *FunctionCallGraph) GetGraph() *gographviz.Graph

GetGraph returns the grqaphviz.Graph

type NatureOfChange

type NatureOfChange int

NatureOfChange indicates the type of base element change:

func (NatureOfChange) String

func (noc NatureOfChange) String() string

type NotificationGraph

type NotificationGraph struct {
	// contains filtered or unexported fields
}

NotificationGraph is a graphviz graphical representation of the structure of a ChangeNotification

func GetNotificationGraphs

func GetNotificationGraphs() []*NotificationGraph

GetNotificationGraphs returns the array of NotificationGraphs that have been created

func NewNotificationGraph

func NewNotificationGraph(notification *ChangeNotification, trans *Transaction) *NotificationGraph

NewNotificationGraph creates a graphviz graph of the information in the ChangeNotification The prefix parameter provides the opportunity for the caller to insert a string prefix into the node identifier.

func (*NotificationGraph) GetGraph

func (bgPtr *NotificationGraph) GetGraph() *gographviz.Graph

GetGraph returns the grqaphviz.Graph

type Observer

type Observer interface {
	Update(notification *ChangeNotification, heldLocks *Transaction) error
}

Observer receives ChangeNotifications when the observed subject changes

type OneToNStringMap

type OneToNStringMap struct {
	sync.Mutex
	// contains filtered or unexported fields
}

OneToNStringMap is a map from a string (a string) to a set of strings. In most usages the string is a UUID

func NewOneToNStringMap

func NewOneToNStringMap() *OneToNStringMap

NewOneToNStringMap creates and initializes a stringElementMap

func (*OneToNStringMap) Clear

func (onMap *OneToNStringMap) Clear()

Clear clears the map

func (*OneToNStringMap) ContainsMappedValue

func (onMap *OneToNStringMap) ContainsMappedValue(key string, value string) bool

ContainsMappedValue adds the Element UUID as a child of the owner UUID

func (*OneToNStringMap) CopyMap

func (onMap *OneToNStringMap) CopyMap() map[string]mapset.Set

CopyMap returns a copy of the map

func (*OneToNStringMap) DeleteKey

func (onMap *OneToNStringMap) DeleteKey(key string)

DeleteKey removes the map entry for the indicated UUID

func (*OneToNStringMap) GetKeys

func (onMap *OneToNStringMap) GetKeys() []string

GetKeys returns an array of the string keys

func (*OneToNStringMap) GetMappedValues

func (onMap *OneToNStringMap) GetMappedValues(key string) mapset.Set

GetMappedValues returns the set of strings corresponding to the key

func (*OneToNStringMap) GetSortedKeys

func (onMap *OneToNStringMap) GetSortedKeys() []string

GetSortedKeys returns an array of the string keys, sorted by string value

func (*OneToNStringMap) IsEquivalent

func (onMap *OneToNStringMap) IsEquivalent(sem *OneToNStringMap) bool

IsEquivalent returns true if the map contains the same number of elements and each has the same set of keys. No comparison is performed on the elements themselves

func (*OneToNStringMap) SetMappedValues

func (onMap *OneToNStringMap) SetMappedValues(key string, newValues mapset.Set)

SetMappedValues sets the mapped values for the given key

func (*OneToNStringMap) TraceableLock

func (onMap *OneToNStringMap) TraceableLock()

TraceableLock locks the map. If TraceLocks is true in logs the acquisition of the lock

func (*OneToNStringMap) TraceableUnlock

func (onMap *OneToNStringMap) TraceableUnlock()

TraceableUnlock unlocks the map. If TraceLocks is true it logs the release of the lock

type StringElementMap

type StringElementMap struct {
	sync.Mutex
	// contains filtered or unexported fields
}

StringElementMap is a map from a UUID (a string) to the Element that represents it

func NewStringElementMap

func NewStringElementMap() *StringElementMap

NewStringElementMap creates and initializes a stringElementMap

func (*StringElementMap) Clear

func (seMap *StringElementMap) Clear()

Clear clears the map

func (*StringElementMap) CopyMap

func (seMap *StringElementMap) CopyMap() map[string]Concept

CopyMap returns a copy of the map

func (*StringElementMap) DeleteEntry

func (seMap *StringElementMap) DeleteEntry(key string)

DeleteEntry removes the map entry for the indicated UUID

func (*StringElementMap) GetEntry

func (seMap *StringElementMap) GetEntry(key string) Concept

GetEntry returns the Element corresponding to the UUID

func (*StringElementMap) IsEquivalent

func (seMap *StringElementMap) IsEquivalent(sem *StringElementMap) bool

IsEquivalent returns true if the map contains the same number of elements and each has the same set of keys. No comparison is performed on the elements themselves

func (*StringElementMap) Print

func (seMap *StringElementMap) Print(trans *Transaction)

Print prints the map. The function is intended for use in debugging

func (*StringElementMap) PrintJustIdentifiers

func (seMap *StringElementMap) PrintJustIdentifiers(trans *Transaction)

PrintJustIdentifiers prints just the UUIDs (keys) of the map. It is intended for use in debugging

func (*StringElementMap) SetEntry

func (seMap *StringElementMap) SetEntry(key string, value Concept)

SetEntry sets the Element corresponding to the given UUID

func (*StringElementMap) TraceableLock

func (seMap *StringElementMap) TraceableLock()

TraceableLock locks the map. If TraceLocks is true in logs the acquisition of the lock

func (*StringElementMap) TraceableUnlock

func (seMap *StringElementMap) TraceableUnlock()

TraceableUnlock unlocks the map. If TraceLocks is true it logs the release of the lock

type StringStringMap

type StringStringMap struct {
	sync.Mutex
	// contains filtered or unexported fields
}

StringStringMap is a map from a URI (a string) to the UUID of an Element that represents it

func NewStringStringMap

func NewStringStringMap() *StringStringMap

NewStringStringMap creates and initializes a stringElementMap

func (*StringStringMap) Clear

func (seMap *StringStringMap) Clear()

Clear clears the map

func (*StringStringMap) CopyMap

func (seMap *StringStringMap) CopyMap() map[string]string

CopyMap returns a copy of the map

func (*StringStringMap) DeleteEntry

func (seMap *StringStringMap) DeleteEntry(key string)

DeleteEntry removes the map entry for the indicated UUID

func (*StringStringMap) GetEntry

func (seMap *StringStringMap) GetEntry(key string) string

GetEntry returns the Element corresponding to the UUID

func (*StringStringMap) IsEquivalent

func (seMap *StringStringMap) IsEquivalent(sem *StringStringMap, printExceptions ...bool) bool

IsEquivalent returns true if the map contains the same number of entries and each key same value

func (*StringStringMap) Print

func (seMap *StringStringMap) Print(trans *Transaction)

Print prints the map. The function is intended for use in debugging

func (*StringStringMap) SetEntry

func (seMap *StringStringMap) SetEntry(key string, value string)

SetEntry sets the UUID corresponding to the given URI

func (*StringStringMap) TraceableLock

func (seMap *StringStringMap) TraceableLock()

TraceableLock locks the map. If TraceLocks is true in logs the acquisition of the lock

func (*StringStringMap) TraceableUnlock

func (seMap *StringStringMap) TraceableUnlock()

TraceableUnlock unlocks the map. If TraceLocks is true it logs the release of the lock

type Subject

type Subject interface {
	Register(observer Observer) error
	Deregister(observer Observer) error
	// contains filtered or unexported methods
}

Subject notifies Observers when changes occur

type Transaction

type Transaction struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Transaction maintains a record of which elements are currently read and write locked and provides facilities for locking additional elements. It also manages function calls. Part of the management is the suppression of circular function calls.

func (*Transaction) GetUniverseOfDiscourse

func (transPtr *Transaction) GetUniverseOfDiscourse() *UniverseOfDiscourse

GetUniverseOfDiscourse returns the UniverseOfDiscourse to which this HeldLocks belongs

func (*Transaction) ReadLockElement

func (transPtr *Transaction) ReadLockElement(el Concept)

ReadLockElement checks to see whether this HeldLocks structure already has a record of the Element being locked, either read or write. If it does, it simply returns. If not, it attempts to acquire the read on the Element and makes a record of the fact that the read lock has been obtained.

func (*Transaction) ReleaseLocks

func (transPtr *Transaction) ReleaseLocks()

ReleaseLocks releases all pending functions for execution (asynchronously) and releases all currently held locks

func (*Transaction) WriteLockElement

func (transPtr *Transaction) WriteLockElement(el Concept) error

WriteLockElement checks to see whether this HeldLocks structure already has a record of the Element being write locked. If it does, it simply returns. If not, it attempts to acquire the write lock on the Element and makes a record of the fact that the lock has been obtained.

type UndoChangeType

type UndoChangeType int

UndoChangeType identifies the type of undo change

const (
	// Marker marks the point on the stack at which an undo or redo operation will stop
	Marker UndoChangeType = iota
	// Creation marks the creation of a new Element
	Creation
	// Deletion marks the deletion of an Element
	Deletion
	// Change marks a change to an element
	Change
)

type UniverseOfDiscourse

type UniverseOfDiscourse struct {
	// contains filtered or unexported fields
}

UniverseOfDiscourse represents the scope of relevant concepts

func NewUniverseOfDiscourse

func NewUniverseOfDiscourse() *UniverseOfDiscourse

NewUniverseOfDiscourse creates and initializes a new UniverseOfDiscourse

func (*UniverseOfDiscourse) AddAbstractionToConcept

func (uOfDPtr *UniverseOfDiscourse) AddAbstractionToConcept(con Concept, abstraction Concept, trans *Transaction) error

AddAbstractionToConcept creates a refinement with the concept being the refined concept. The new refinement is a child of the supplied concept.

func (*UniverseOfDiscourse) AddAbstractionURIToConcept

func (uOfDPtr *UniverseOfDiscourse) AddAbstractionURIToConcept(con Concept, abstractionURI string, trans *Transaction) error

AddAbstractionURIToConcept creates a refinement with the concept being the refined concept. The new refinement is a child of the supplied concept.

func (*UniverseOfDiscourse) AddFunction

func (uOfDPtr *UniverseOfDiscourse) AddFunction(uri string, function crlExecutionFunction)

AddFunction registers a function with the indicated uri

func (*UniverseOfDiscourse) Clone

func (uOfDPtr *UniverseOfDiscourse) Clone(trans *Transaction) *UniverseOfDiscourse

Clone makes an exact copy of the UniverseOfDiscourse and all its contents except for the undo/redo stack. All Elements are new objects, but all the identifiers are retained from the original uOfD.

func (*UniverseOfDiscourse) CreateOwnedRefinementOfConcept

func (uOfDPtr *UniverseOfDiscourse) CreateOwnedRefinementOfConcept(original Concept, owner Concept, label string, trans *Transaction, newURI ...string) (Concept, error)

CreateOwnedRefinementOfConcept creates a refinement of the concept identified by the URI, setting its owner and label

func (*UniverseOfDiscourse) CreateOwnedRefinementOfConceptURI

func (uOfDPtr *UniverseOfDiscourse) CreateOwnedRefinementOfConceptURI(originalURI string, owner Concept, label string, trans *Transaction, newURI ...string) (Concept, error)

CreateOwnedRefinementOfConceptURI creates a refinement of the concept identified by the URI, setting its owner and label

func (*UniverseOfDiscourse) CreateRefinementOfConcept

func (uOfDPtr *UniverseOfDiscourse) CreateRefinementOfConcept(original Concept, label string, trans *Transaction, newURI ...string) (Concept, error)

CreateRefinementOfConcept creates a new concept of the same type as the original and makes the new concept a refinement of the original

func (*UniverseOfDiscourse) CreateRefinementOfConceptURI

func (uOfDPtr *UniverseOfDiscourse) CreateRefinementOfConceptURI(uri string, label string, trans *Transaction, newURI ...string) (Concept, error)

CreateRefinementOfConceptURI creates a new concept of the same type as the indicated URI and makes the new concept a refinement of it

func (*UniverseOfDiscourse) CreateReplicateAsRefinement deprecated

func (uOfDPtr *UniverseOfDiscourse) CreateReplicateAsRefinement(original Concept, trans *Transaction, newURI ...string) (Concept, error)

CreateReplicateAsRefinement replicates the indicated Element and all of its descendent Elements except that descendant Refinements are not replicated. For each replicated Element, a Refinement is created with the abstractElement being the original and the refinedElement being the replica. The root replicated element is returned.

Deprecated: Create specific New<type>() functions instead that construct the desired concept with expected children

func (*UniverseOfDiscourse) CreateReplicateAsRefinementFromURI deprecated

func (uOfDPtr *UniverseOfDiscourse) CreateReplicateAsRefinementFromURI(originalURI string, trans *Transaction, newURI ...string) (Concept, error)

CreateReplicateAsRefinementFromURI replicates the Element indicated by the URI

Deprecated: Create specific New<type>() functions instead that construct the desired concept with expected children

func (*UniverseOfDiscourse) CreateReplicateLiteralAsRefinement deprecated

func (uOfDPtr *UniverseOfDiscourse) CreateReplicateLiteralAsRefinement(original Concept, trans *Transaction, newURI ...string) (Concept, error)

CreateReplicateLiteralAsRefinement replicates the supplied Literal and makes all elements of the replicate refinements of the original elements

Deprecated: Create specific New<type>() functions instead that construct the desired concept with expected children

func (*UniverseOfDiscourse) CreateReplicateLiteralAsRefinementFromURI deprecated

func (uOfDPtr *UniverseOfDiscourse) CreateReplicateLiteralAsRefinementFromURI(originalURI string, trans *Transaction, newURI ...string) (Concept, error)

CreateReplicateLiteralAsRefinementFromURI replicates the Literal indicated by the URI

Deprecated: Create specific New<type>() functions instead that construct the desired concept with expected children

func (*UniverseOfDiscourse) CreateReplicateReferenceAsRefinement deprecated

func (uOfDPtr *UniverseOfDiscourse) CreateReplicateReferenceAsRefinement(original Concept, trans *Transaction, newURI ...string) (Concept, error)

CreateReplicateReferenceAsRefinement replicates the supplied reference and makes all elements of the replicate refinements of the original elements

Deprecated: Create specific New<type>() functions instead that construct the desired concept with expected children

func (*UniverseOfDiscourse) CreateReplicateReferenceAsRefinementFromURI deprecated

func (uOfDPtr *UniverseOfDiscourse) CreateReplicateReferenceAsRefinementFromURI(originalURI string, trans *Transaction, newURI ...string) (Concept, error)

CreateReplicateReferenceAsRefinementFromURI replicates the Reference indicated by the URI

Deprecated: Create specific New<type>() functions instead that construct the desired concept with expected children

func (*UniverseOfDiscourse) CreateReplicateRefinementAsRefinement deprecated

func (uOfDPtr *UniverseOfDiscourse) CreateReplicateRefinementAsRefinement(original Concept, trans *Transaction, newURI ...string) (Concept, error)

CreateReplicateRefinementAsRefinement replicates the supplied refinement and makes all elements of the replicate refinements of the original elements

Deprecated: Create specific New<type>() functions instead that construct the desired concept with expected children

func (*UniverseOfDiscourse) CreateReplicateRefinementAsRefinementFromURI deprecated

func (uOfDPtr *UniverseOfDiscourse) CreateReplicateRefinementAsRefinementFromURI(originalURI string, trans *Transaction, newURI ...string) (Concept, error)

CreateReplicateRefinementAsRefinementFromURI replicates the Refinement indicated by the URI

Deprecated: Create specific New<type>() functions instead that construct the desired concept with expected children

func (*UniverseOfDiscourse) DeleteElement

func (uOfDPtr *UniverseOfDiscourse) DeleteElement(element Concept, trans *Transaction) error

DeleteElement removes a single element and its descentants from the uOfD. Pointers to the elements from other elements are set to nil.

func (*UniverseOfDiscourse) DeleteElements

func (uOfDPtr *UniverseOfDiscourse) DeleteElements(elements mapset.Set, trans *Transaction) error

DeleteElements removes the elements whose IDs are in the set from the uOfD. Pointers to the elements from elements not being deleted are set to nil.

func (*UniverseOfDiscourse) Deregister

func (uOfDPtr *UniverseOfDiscourse) Deregister(observer Observer) error

Deregister removes the registration of an Observer

func (*UniverseOfDiscourse) GetConceptsOwnedConceptIDs

func (uOfDPtr *UniverseOfDiscourse) GetConceptsOwnedConceptIDs(id string) mapset.Set

GetConceptsOwnedConceptIDs returns the set of owned concepts for the indicated ID

func (*UniverseOfDiscourse) GetConceptsOwnedConceptIDsRecursively

func (uOfDPtr *UniverseOfDiscourse) GetConceptsOwnedConceptIDsRecursively(rootID string, descendants mapset.Set, trans *Transaction)

GetConceptsOwnedConceptIDsRecursively returns the IDs of owned concepts

func (*UniverseOfDiscourse) GetElement

func (uOfDPtr *UniverseOfDiscourse) GetElement(conceptID string) Concept

GetElement returns the Element with the conceptID

func (*UniverseOfDiscourse) GetElementLabel

func (uOfDPtr *UniverseOfDiscourse) GetElementLabel(conceptID string) string

GetElementLabel returns the label of the Element with the conceptID

func (*UniverseOfDiscourse) GetElementWithURI

func (uOfDPtr *UniverseOfDiscourse) GetElementWithURI(uri string) Concept

GetElementWithURI returns the Element with the given URI

func (*UniverseOfDiscourse) GetElements

func (uOfDPtr *UniverseOfDiscourse) GetElements() map[string]Concept

GetElements returns the Elements in the uOfD mapped by their ConceptIDs

func (*UniverseOfDiscourse) GetIDForURI

func (uOfDPtr *UniverseOfDiscourse) GetIDForURI(uri string) string

GetIDForURI returns a V5 UUID derived from the given URI. If the given URI is not valid it returns the empty string.

func (*UniverseOfDiscourse) GetListenerIDs

func (uOfDPtr *UniverseOfDiscourse) GetListenerIDs(id string) mapset.Set

GetListenerIDs returns the set of listener IDs for the indicated ID

func (*UniverseOfDiscourse) GetLiteral

func (uOfDPtr *UniverseOfDiscourse) GetLiteral(conceptID string) Concept

GetLiteral returns the literal with the indicated ID (if found)

func (*UniverseOfDiscourse) GetLiteralWithURI

func (uOfDPtr *UniverseOfDiscourse) GetLiteralWithURI(uri string) Concept

GetLiteralWithURI returns the literal with the indicated URI (if found)

func (*UniverseOfDiscourse) GetReference

func (uOfDPtr *UniverseOfDiscourse) GetReference(conceptID string) Concept

GetReference returns the reference with the indicated ID (if found)

func (*UniverseOfDiscourse) GetReferenceWithURI

func (uOfDPtr *UniverseOfDiscourse) GetReferenceWithURI(uri string) Concept

GetReferenceWithURI returns the reference with the indicated URI (if found)

func (*UniverseOfDiscourse) GetRefinement

func (uOfDPtr *UniverseOfDiscourse) GetRefinement(conceptID string) Concept

GetRefinement returns the refinement with the indicated ID (if found)

func (*UniverseOfDiscourse) GetRefinementWithURI

func (uOfDPtr *UniverseOfDiscourse) GetRefinementWithURI(uri string) Concept

GetRefinementWithURI returns the refinement with the indicated URI (if found)

func (*UniverseOfDiscourse) GetRootElementIDs

func (uOfDPtr *UniverseOfDiscourse) GetRootElementIDs() []string

GetRootElementIDs returns all elements that do not have owners

func (*UniverseOfDiscourse) GetRootElements

func (uOfDPtr *UniverseOfDiscourse) GetRootElements(trans *Transaction) map[string]Concept

GetRootElements returns all elements that do not have owners

func (*UniverseOfDiscourse) IsEquivalent

func (uOfDPtr *UniverseOfDiscourse) IsEquivalent(hl1 *Transaction, uOfD2 *UniverseOfDiscourse, hl2 *Transaction, printExceptions ...bool) bool

IsEquivalent returns true if all of the root elements in the uOfD are recursively equivalent

func (*UniverseOfDiscourse) IsRecordingUndo

func (uOfDPtr *UniverseOfDiscourse) IsRecordingUndo() bool

IsRecordingUndo reveals whether undo recording is on

func (*UniverseOfDiscourse) MarkUndoPoint

func (uOfDPtr *UniverseOfDiscourse) MarkUndoPoint()

MarkUndoPoint marks a point on the undo stack. The next undo operation will undo everything back to this point.

func (*UniverseOfDiscourse) MarshalDomain

func (uOfDPtr *UniverseOfDiscourse) MarshalDomain(el Concept, trans *Transaction) ([]byte, error)

MarshalDomain creates a JSON representation of an element and all of its descendants

func (*UniverseOfDiscourse) NewCompleteRefinement

func (uOfDPtr *UniverseOfDiscourse) NewCompleteRefinement(abstractElement Concept, refinedElement Concept, label string, trans *Transaction, uri ...string) (Concept, error)

NewCompleteRefinement creates a refinement (with optional URI) and sets its abstract and refined references, sets the label, and makes the refined element the owner

func (*UniverseOfDiscourse) NewConcept

func (uOfDPtr *UniverseOfDiscourse) NewConcept(conceptType ConceptType, trans *Transaction, uri ...string) (Concept, error)

NewConcept creates and initializes a new Concept

func (*UniverseOfDiscourse) NewElement

func (uOfDPtr *UniverseOfDiscourse) NewElement(trans *Transaction, uri ...string) (Concept, error)

NewElement creates and initializes a new Element

func (*UniverseOfDiscourse) NewForwardingChangeNotification

func (uOfDPtr *UniverseOfDiscourse) NewForwardingChangeNotification(reportingElement Concept, natureOfChange NatureOfChange, underlyingChange *ChangeNotification, trans *Transaction) (*ChangeNotification, error)

NewForwardingChangeNotification creates a ChangeNotification that records the reason for the change to the element, including the nature of the change, an indication of which component originated the change, and whether there was a preceeding notification that triggered this change.

func (*UniverseOfDiscourse) NewLiteral

func (uOfDPtr *UniverseOfDiscourse) NewLiteral(trans *Transaction, uri ...string) (Concept, error)

NewLiteral creates and initializes a new Literal

func (*UniverseOfDiscourse) NewOwnedElement

func (uOfDPtr *UniverseOfDiscourse) NewOwnedElement(owner Concept, label string, trans *Transaction, uri ...string) (Concept, error)

NewOwnedElement creates an element (with optional URI) and sets its owner and label

func (*UniverseOfDiscourse) NewOwnedLiteral

func (uOfDPtr *UniverseOfDiscourse) NewOwnedLiteral(owner Concept, label string, trans *Transaction, uri ...string) (Concept, error)

NewOwnedLiteral creates a literal (with optional URI) and sets its owner and label

func (*UniverseOfDiscourse) NewOwnedReference

func (uOfDPtr *UniverseOfDiscourse) NewOwnedReference(owner Concept, label string, trans *Transaction, uri ...string) (Concept, error)

NewOwnedReference creates a reference (with optional URI) and sets its owner and label

func (*UniverseOfDiscourse) NewOwnedRefinement

func (uOfDPtr *UniverseOfDiscourse) NewOwnedRefinement(owner Concept, label string, abstractConcept Concept, refinedConcept Concept, trans *Transaction, uri ...string) (Concept, error)

NewOwnedRefinement creates a refinement (with optional URI) and sets its owner and label

func (*UniverseOfDiscourse) NewReference

func (uOfDPtr *UniverseOfDiscourse) NewReference(trans *Transaction, uri ...string) (Concept, error)

NewReference creates and initializes a new Reference

func (*UniverseOfDiscourse) NewRefinement

func (uOfDPtr *UniverseOfDiscourse) NewRefinement(trans *Transaction, uri ...string) (Concept, error)

NewRefinement creates and initializes a new Refinement

func (*UniverseOfDiscourse) NewTransaction

func (uOfDPtr *UniverseOfDiscourse) NewTransaction() *Transaction

NewTransaction creates and initializes a HeldLocks structure utilizing the supplied WaitGroup

func (*UniverseOfDiscourse) NotifyUofDObservers

func (uOfDPtr *UniverseOfDiscourse) NotifyUofDObservers(notification *ChangeNotification, trans *Transaction) error

NotifyUofDObservers passes the notification to all registered Observers

func (*UniverseOfDiscourse) RecoverDomain

func (uOfDPtr *UniverseOfDiscourse) RecoverDomain(data []byte, trans *Transaction) (Concept, error)

RecoverDomain reconstructs a concept space from its JSON representation

func (*UniverseOfDiscourse) RecoverElement

func (uOfDPtr *UniverseOfDiscourse) RecoverElement(data []byte, trans *Transaction) (Concept, error)

RecoverElement reconstructs an Element (or subclass) from its JSON representation

func (*UniverseOfDiscourse) Redo

func (uOfDPtr *UniverseOfDiscourse) Redo(trans *Transaction)

Redo redoes the last undo, if any

func (*UniverseOfDiscourse) Register

func (uOfDPtr *UniverseOfDiscourse) Register(observer Observer) error

Register adds the registration of an Observer

func (*UniverseOfDiscourse) SendConceptChangeNotification

func (uOfDPtr *UniverseOfDiscourse) SendConceptChangeNotification(reportingElement Concept, beforeState *ConceptState, afterState *ConceptState, trans *Transaction) error

SendConceptChangeNotification creates a ConceptChangeNotification

func (*UniverseOfDiscourse) SendPointerChangeNotification

func (uOfDPtr *UniverseOfDiscourse) SendPointerChangeNotification(reportingElement Concept, natureOfChange NatureOfChange, beforeConceptState *ConceptState, afterConceptState *ConceptState, trans *Transaction) error

SendPointerChangeNotification creates a PointerChangeNotification and sends it to the relevant parties

func (*UniverseOfDiscourse) SendTickleNotification

func (uOfDPtr *UniverseOfDiscourse) SendTickleNotification(reportingElement Concept, targetElement Concept, trans *Transaction) error

SendTickleNotification creates a Tickle notification and sends it to the indicated target element. Its purpose is to trigger the execution of any functions associated with the target element

func (*UniverseOfDiscourse) SetRecordingUndo

func (uOfDPtr *UniverseOfDiscourse) SetRecordingUndo(newSetting bool)

SetRecordingUndo turns undo/redo recording on and off

func (*UniverseOfDiscourse) SetUniverseOfDiscourse

func (uOfDPtr *UniverseOfDiscourse) SetUniverseOfDiscourse(el Concept, trans *Transaction) error

SetUniverseOfDiscourse sets the uOfD of which this element is a member. Strictly speaking, this is not an attribute of the elment, but rather a context in which the element is operating in which the element may be able to locate other objects by id.

func (*UniverseOfDiscourse) StartDebugUndo

func (uOfDPtr *UniverseOfDiscourse) StartDebugUndo()

StartDebugUndo starts the logging of undo/redo activity

func (*UniverseOfDiscourse) StopDebugUndo

func (uOfDPtr *UniverseOfDiscourse) StopDebugUndo()

StopDebugUndo ends the logging of undo/redo activity

func (*UniverseOfDiscourse) Undo

func (uOfDPtr *UniverseOfDiscourse) Undo(trans *Transaction)

Undo undoes all the changes up to the last UndoMarker or the beginning of Undo, whichever comes first.

type UofDInitializationFunction

type UofDInitializationFunction func(uOFD *UniverseOfDiscourse, trans *Transaction) error

UofDInitializationFunction is a function that adds core elements to the uOfD during its initialization process. These functions are called by the UofDManager after a new UniverseOfDiscourse has been created

type UofDManager

type UofDManager struct {
	UofD *UniverseOfDiscourse
	// contains filtered or unexported fields
}

UofDManager manages a universe of discourse and the functions used to initialize it

func (*UofDManager) AddInitializationFunction

func (mgr *UofDManager) AddInitializationFunction(function UofDInitializationFunction)

AddInitializationFunction adds a function that will be called during the UniverseOfDiscourse initialization. The function is intended to be used by applications to add core concepts to the uOfD before any application data is added

func (*UofDManager) AddPostInitializationFunction

func (mgr *UofDManager) AddPostInitializationFunction(function UofDInitializationFunction)

AddPostInitializationFunction adds a function that will be called during the UniverseOfDiscourse initialization. The function is intended to be used by applications to perform activities after all core concepts have been added to the uOfD

func (*UofDManager) Initialize

func (mgr *UofDManager) Initialize() error

Initialize establishes an initialized UniverseOfDiscourse. It creates the uOfD, calls all of the initialization functions, and then calls all of the post-initialization functions.

type UofDPostInitializationFunction

type UofDPostInitializationFunction func(uOfD *UniverseOfDiscourse, trans *Transaction) error

UofDPostInitializationFunction is an application-specific function that is called after a UofD has been created and all UofDInitializationFunctions have been invoked.

Jump to

Keyboard shortcuts

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