States in KnowLang are specified as intrinsic, yet explicit properties of concepts. States
are specified as Boolean expressions and are evaluated at runtime by the KnowLang Reasoner.
States are not specified as single concepts, but as part of the specification of a single concept.
In general, a concept may occupy a new state when concept properties have been changed or some events or
actions have occurred in the system or environment. The following example demonstrates the specification
of a concept along with its intrinsic states.
//Science Clouds SCP
CONCEPT SCP {
PARENTS {ScCl.ScCloud.CONCEPT_TREES.Cloud_Platform}
CHILDREN {}
STATES {
STATE Running {
ScCl.ScCloud.CONCEPT_TREES.SCP.PROPS.platform_API.STATES.Running AND
ScCl.ScCloud.CONCEPT_TREES.SCP.PROPS.platform_Library.STATES.Running }
STATE Executing { IS_PERFORMING{ScCl.ScCloud.CONCEPT_TREES.SCP.FUNCS.runApp} }
STATE Observing { IS_PERFORMING{ScCl.ScCloud.CONCEPT_TREES.SCP.FUNCS.runApp} AND
IS_PERFORMING{ScCl.ScCloud.CONCEPT_TREES.SCP.FUNCS.observeApp} }
STATE Down { NOT ScCl.ScCloud.CONCEPT_TREES.SCP.STATES.Running }
STATE Overloaded { ScCl.ScCloud.CONCEPT_TREES.SCP.STATES.OverloadedCPU OR
ScCl.ScCloud.CONCEPT_TREES.SCP.STATES.OverloadedStorage OR
ScCl.ScCloud.CONCEPT_TREES.SCP.STATES.OverloadedMemory }
STATE OverloadedCPU { ScCl.ScCloud.CONCEPT_TREES.CPU_Usage > 95 }
STATE OverloadedMemory { ScCl.ScCloud.CONCEPT_TREES.Memory_Usage > 95 }
STATE OverloadedStorage { ScCl.ScCloud.CONCEPT_TREES.Hard_Disk_Usage > 95 }
STATE ApplicationTransferred { LAST_PERFORMED{ ScCl.ScCloud.CONCEPT_TREES.SCP,
ScCl.ScCloud.CONCEPT_TREES.SCP.FUNCS.transferApp} }
STATE InCommunication { ScCl.ScCloud.CONCEPT_TREES.SCP.FUNCS.hasActiveCommunication = 1 }
STATE InCommunicationLatency { ScCl.ScCloud.CONCEPT_TREES.SCP.STATES.InCommunication AND
ScCl.ScCloud.CONCEPT_TREES.SCP.FUNCS.getCommunicationLatency > 50 }
STATE InLowTrafic { ScCl.ScCloud.CONCEPT_TREES.SCP.FUNCS.getDataTrafic <= 50 }
STATE Started { LAST_PERFORMED{ScCl.ScCloud.CONCEPT_TREES.SCP,
ScCl.ScCloud.CONCEPT_TREES.SCP.FUNCS.start} }
STATE Stopped { LAST_PERFORMED{ScCl.ScCloud.CONCEPT_TREES.SCP,
ScCl.ScCloud.CONCEPT_TREES.SCP.FUNCS.stop} }
}
PROPS {
PROP platform_API { TYPE {ScCl.ScCloud.CONCEPT_TREES.API} CARDINALITY {1} }
PROP platform_Library { TYPE {ScCl.ScCloud.CONCEPT_TREES.Library} CARDINALITY {1} }
}
FUNCS {
FUNC run { TYPE { ScCl.ScCloud.CONCEPT_TREES.RunSCP } }
FUNC down { TYPE { ScCl.ScCloud.CONCEPT_TREES.StopSCP } }
FUNC runApp { TYPE { ScCl.ScCloud.CONCEPT_TREES.RunApplication } }
FUNC observeApp { TYPE { ScCl.ScCloud.CONCEPT_TREES.ObserveApplication } }
FUNC transferApp { TYPE { ScCl.ScCloud.CONCEPT_TREES.TransferApplication } }
FUNC hasActiveCommunication { TYPE { ScCl.ScCloud.CONCEPT_TREES.CheckForActiveCommunication } }
FUNC getCommunicationLatency { TYPE { ScCl.ScCloud.CONCEPT_TREES.GetCommunicationLatency } }
FUNC getDataTrafic { TYPE { ScCl.ScCloud.CONCEPT_TREES.GetDataTrafic } }
FUNC start { TYPE { ScCl.ScCloud.CONCEPT_TREES.RunSCP } }
FUNC stop { TYPE { ScCl.ScCloud.CONCEPT_TREES.StopSCP } }
FUNC leaveSCPe { TYPE { ScCl.ScCloud.CONCEPT_TREES.LeaveSCPe } }
FUNC joinSCPe { TYPE { ScCl.ScCloud.CONCEPT_TREES.JoinSCPe } }
}
}
As shown in the example above, the state Executing is true while the SCP is performing the runApp
function. The KnowLang operator IS_PERFORMING evaluates actions and returns true if an action is
currently performing. Similarly, the operator LAST_PERFORMED evaluates actions and returns true if an action
is the last successfully performed action by a concept or its realization (object). As shown in the examples, a
complex state might be expressed as a Boolean function of other states. For example, the Running state is
expressed as a Boolean function of two other states, particularly, states of concept's properties, e.g., the SCP
is running if both its API and Library are running.
States are extremely important to the specification of GOALS, SITUATIONS, and POLICIES.
For example, states help the KnowLang Reasoner determine at runtime whether the system is in a
particular situation or a particular goal has been achieved. Note that to specify states, we may also
use METRICS.
|