Quantcast
Channel: DKAL
Viewing all articles
Browse latest Browse all 148

Updated Wiki: Interfaces Module

$
0
0

Interfaces Module


This module defines the following types:

IType Type

Each IType implementation represents a type for AST elements. For instance infons, principals, integers, rules, evidence, ...

Methods

Modifiers Return type Method name Method parameters Description
bool IsSubtypeOfIType Returns true if this type can be seen as the typed passed as parameter

Properties

Return type Property name Description
string Name Short name for this type
string FullName Full name for this type
IType option BaseType Base type

 

ITerm Type

ITerm implementations are the AST elements. They encode everything from variables and constants to asInfon queries, rules, etc.

Methods

Modifiers Return type Method name Method parameters Description
ITermApplyISubstitution Returns a new ITerm which results from applying the given substitution
ITermNormalize Returns a new ITerm which is a normalized version of this one
ISubstitution option UnifyFromISubstitution, ITerm It tries to unify this ITerm with the given one, starting from the given substitution. If the unification is successful, a new substitution (which is a specialization of the given one) is returned. None is returned if unification fails
ISubstitution option UnifyITerm It tries to unify this ITerm with the given one. If unification is successful a substitution that guarantees syntactic equality is returned, otherwise None is returned

Properties

Return type Property name Description
ITypeType The type of this AST element
IVar list Vars The free variables in this AST element
IVar list BoundVars The bound variables in this AST element

 

IVar Type

IVar is used to represent any AST element that is to be treated like a variable

Implemented Interfaces

  • ITerm

Properties

Return type Property name Description
string Name Variable name, which is used as variable identifier

 

IConst Type

IConst is an interface that is implemented by all the AST nodes that represent ground values

Implemented Interfaces

  • ITerm

Properties

Return type Property name Description
Object Value The value of this constant

 

ISubstitution Type

ISubstitution implementations model substitutions that map variables to AST elements (IVar --> ITerm). They are used as results of unification

Methods

Modifiers Return type Method name Method parameters Description
ITermApplyIVar Applies this substitution to the given IVar
ISubstitutionExtendIVar, ITerm Returns a new substitution that results from extending the current substitution so that it maps v to t and leaves the rest unchanged
ISubstitutionComposeWithISubstitution Returns a new substitution that results from first applying s' and then applying the current Substitution
bool DomainContainsIVar Returns true iff v is affected by this substitution
ISubstitutionRestrictToIVar list Returns a new substitution that results from restricting the current one to only modify the variables given in the list
ISubstitutionForgetIVar list Returns a new substitution that results from forgetting the current mapping to the variables given in the list

Properties

Return type Property name Description
IVar list Domain Returns the vars affected by this substitution
bool IsVariableRenaming Returns true if this substitution only renames variables

 

IParser Type

IParser provides an interface for different parsers. All implementations of IParser process input strings and return ITerms

Methods

Modifiers Return type Method name Method parameters Description
ITypeParseType string Parse an IType from the input string
ITermParseTerm string Parse an ITerm from the input string

 

IPrettyPrinter Type

IPrettyPrinter provides an interface to print ITerms back into different concrete syntaxes. An IPrettyPrinter implementation should be bound to an IParser implementation that can parse the output back

Methods

Modifiers Return type Method name Method parameters Description
string PrintTypeIType Returns a string representation for the given IType
string PrintTermITerm Returns a string representation for the given ITerm (infon, rule, etc.)

 

ISubstrateTerm Type

ISubstrateTerm implementations are AST elements which are related to a substrate. Each ISubstrateTerm has a Namespace, each ISubstrate understands a set of Namespaces.

Implemented Interfaces

  • ITerm

Properties

Return type Property name Description
string Namespace Tha namespace for this ISubstrateTerm. This is used to locate an ISubstrate implementation that will understand this ISubstrateTerm

 

ISubstrateUpdateTerm Type

ISubstrateUpdateTerm implementations are substrate terms that perform updates (addition, modification, removal, changing parameters etc.) on a substrate. They are used in "apply" acctions

Implemented Interfaces

  • ISubstrateTerm
  • ITerm
 

ISubstrateQueryTerm Type

ISubstrateQueryTerm implementations are substrate terms that perform queries on a substrate. They are used in asInfon constructs

Implemented Interfaces

  • ISubstrateTerm
  • ITerm
 

ISubstrate Type

ISubstrate implementations give DKAL the ability to query and modify data sitting in various formats and representations (XML, arithmetics, SQL, etc.) Each substrate understand a set of namespaces, which are used to fetch the proper substrate when an ISubstrateTerm is found and needs to be executed

Methods

Modifiers Return type Method name Method parameters Description
ISubstitution seq SolveISubstrateQueryTerm seq, ISubstitution seq Performs the given queries (which must have a namespace understood by this substrate) for each of the given input substitutions (partial results). Returns a sequence of resolved substitutions (more specialized than substs)
bool UpdateISubstrateUpdateTerm seq Applies the given ISubstrateUpdateTerms (which must have a namespace understood by this substrate). Returns true upon success, false otherwise
bool AreConsistentUpdatesISubstrateUpdateTerm seq Given the ISubstrateUpdateTerms (which must have a namespace understood by this substrate) it returns true iff it is safe to apply them in parallel (e.g. no row is being deleted and added at the same time, etc.)
IVar list RequiredVarsISubstrateQueryTerm Given the ISubstrateQueryTerm (which must have a namespace understood by this substrate), it returns which of the query free variables must be instantiated before executing the query. For instance, an arithmetic calculator substrate may require all variables to be instantiated, except for the variable that gets the result (left-hand side can be free)

Properties

Return type Property name Description
HashSet<string> Namespaces Returns the set of namespaces that this ISubstrate implementation understands

 

IInfostrate Type

Provides an interface for a repository of knowledge in the form of infon ITerms

Methods

Modifiers Return type Method name Method parameters Description
bool LearnITerm Adds the given infon ITerm to the infostrate
bool ForgetITerm Removes the given infon ITerm from the infostrate

Properties

Return type Property name Description
ITerm seq Knowledge Returns a sequence of knowledge from the infostrate

 

IMailBox Type

Provides an interface for a repository of incoming infon ITerms

Methods

Modifiers Return type Method name Method parameters Description
unit AddITerm, ITerm Adds the given infon ITerm to the mailbox
unit RemoveITerm, ITerm list option Removes the given infon ITerm from the mailbox
unit Prune Eliminates "old" messages, each mailbox decides how to implement this operation, which should be invoked at the end of each execution round
ISubstitution seq MatchesITerm, ITerm, ISubstitution seq Match an infon to messages in the mailbox. It returns a subset of (possibly specialized) substitutions.

 

IRouter Type

IRouter provides an interface for communication with the environment. Implementations of IRouter handle both incoming and outcoming messages

Methods

Modifiers Return type Method name Method parameters Description
unit Start Must be called to initialize the router
unit Stop Must be called after the router is no longer needed
unit ReceiveITerm -> ITerm -> unit
unit SendITerm, ITerm Sends an infon ITerm to the target principal ITerm

Properties

Return type Property name Description
string Me Returns the current principal name
string list Roster Returns the names of the known principals

 

ISignatureProvider Type

ISignatureProvider provides an interface for implementations to construct and verify signed infons

Methods

Modifiers Return type Method name Method parameters Description
int ConstructSignatureITerm, string Construct a signature for the given ITerm
bool CheckSignatureITerm, string, int Checks if the given signature is correct

 

ILogicEngine Type

ILogicEngine provides an interface for logic reasoning engines that handle the infostrate

Methods

Modifiers Return type Method name Method parameters Description
unit Start Must be called to initialize the engine
unit Stop Must be called after the engine is no longer needed
ISubstitution seq DeriveITerm, ISubstitution seq Given an infon ITerm with (possibly) free variables and an initial sequence of substitutions it returns all those (possibly specialized) substitutions that make the infon hold
ISubstitution seq DeriveJustificationITerm, ITerm, ISubstitution seq Constructs evidence for the given infon ITerm that matches the given proofTemplate, if possible. Works under the given substitutions, returning more concrete ones (to instantiate the proofTemplate when successfull)
ITerm option CheckJustificationITerm Checks if the given evidence is a well-formed justification, if it succeeds it returns the infon that is justified by the evidence; it it does not suceed it returns None
bool CompleteITerm Learns that the knowledge learnt so far for a given relation (wrapped as an infon) is complete (closed)

Properties

Return type Property name Description
IInfostrateInfostrate The knowledge source for the logic engine
ISignatureProviderSignatureProvider The signature checking implementation for this logic engine

 

IExecutor Type

IExecutor provides an interface for the engine driver. IExecutor implementations are in charge of keeping a policy and apply all the rules as their conditions are triggered

Methods

Modifiers Return type Method name Method parameters Description
unit Start Must be called to initialize the executor
unit Stop Must be called when the executor is no longer needed
bool InstallRuleITerm Installs the given rule ITerm on the executor. The rule is followed from this point onwards. Returns false if the rule was already installed
bool UninstallRuleITerm Uninstalls the given rule ITerm on the executor. Returns true if the rule was not present
unit FixedPointCallback unit -> unit
unit WakeUpCallback unit -> unit
unit ActionCallbackITerm -> unit
unit ReceiveCallbackITerm -> ITerm -> unit
unit RoundStartCallback unit -> unit

 

IParsingContext Type

IParsingContext provides an interface for contexts that keep information necessary during the parsing process such as variable types, macro definitions, etc.

Methods

Modifiers Return type Method name Method parameters Description
bool HasVariable string Returns true if there is a variable in the context with the given name
ITypeVariableType string For a variable name in the context, it returns its type
unit AddTypeRename string, IType Adds a type rename by giving a newTypeName to a given targetType
ITypeTypeFromName string Given a type fullname it returns the AST type for it
bool HasMacro string Returns true iff the contexts has a macro definition with the given name
unit AddMacro string, IType, ISubstrateQueryTerm, IVar list Given a macro name, a return type, a body and arguments, it incorporates these as a new macro in the context.
IVar list GetMacroArgs string Given a macro name in the context it returns the macro arguments
ITypeGetMacroRetType string Given a macro name in the context it returns the macro return type
ITerm * ISubstrateQueryTermApplyMacro string, ITerm list Given a macro name and concrete arguments, it returns a tuple (t, sqt) where t is the element that should be inlined (the macro return variable) and sqt is the macro body with the concrete arguments (which should be incorporated as an asInfon(sqt) somewhere before or after t is used)
IVarFreshVarIType Given a type it returns a fresh variable of that type

Properties

Return type Property name Description
string Me Name of the principal for which the policy is being parsed

 

ISubstrateParser Type

ISubstrateParser provides an interface for substrate parsers that interpret substrate queries and update terms

Methods

Modifiers Return type Method name Method parameters Description
unit SetParsingContextIParsingContext Sets the parsing context (that contains type information and macros among others) for this parser
unit SetNamespace string Sets the namespace to be used in all the ISubstrateTerms produced by this parser
unit SetSubstrateISubstrate Sets the ISubstrate implementation that will be used to interpret the ISubstrateTerms produced by this parser. This ISubstrate may be used to obtain extra information during parsing (for instance, the SQL substrate parser uses a SQL ISubstrate implementation to get type information for the columns mentioned in the queries and updates)
ISubstrateTermParseTerm string It produces an ISubstrateTerm from the given string representation

 

ISubstratePrettyPrinter Type

ISubstratePrettyPrinter provides an interface to print substrate AST elements

Methods

Modifiers Return type Method name Method parameters Description
string PrintTermISubstrateTerm Returns a string representation for the given ISubstrateTerm

 

ITranslatedExpr Type

Wraps around a generic translated expression

Methods

Modifiers Return type Method name Method parameters Description
Object getUnderlyingExpr Gets the underlying expression which is completely domain related

 

ITranslator Type

ITranslator provides a mechanism for translating ITerm elements to any other expression

Methods

Modifiers Return type Method name Method parameters Description
ITranslatedExprtranslateITerm Translates an ITerm to an ITranslatedExpr

 

Automatically generated on 7/17/2013 12:17:16 PM
 

Viewing all articles
Browse latest Browse all 148

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>