Struct polar_core::kb::KnowledgeBase[][src]

pub struct KnowledgeBase {
    pub constants: Bindings,
    pub loaded_files: HashMap<String, u64>,
    pub loaded_content: HashMap<String, String>,
    pub sources: Sources,
    pub inline_queries: Vec<Term>,
    pub resource_blocks: ResourceBlocks,
    // some fields omitted
}

Fields

constants: Bindings

A map of bindings: variable name → value. The VM uses a stack internally, but can translate to and from this type.

loaded_files: HashMap<String, u64>

Map from loaded files to the source ID

loaded_content: HashMap<String, String>

Map from source code loaded to the filename it was loaded as

sources: Sourcesinline_queries: Vec<Term>resource_blocks: ResourceBlocks

Resource block bookkeeping.

Implementations

Return a monotonically increasing integer ID.

Wraps around at 52 bits of precision so that it can be safely coerced to an IEEE-754 double-float (f64).

Generate a temporary variable prefix from a variable name.

Generate a new symbol.

Validate that all rules loaded into the knowledge base are valid based on rule types.

Define a constant variable.

Add the Method Resolution Order (MRO) list for a registered class. The mro argument is a list of the instance_id associated with a registered class.

Return true if a constant with the given name has been defined.

Removes a file from the knowledge base by finding the associated Source and removing all rules for that source, and removes the file from loaded files.

Optionally return the source for the file, returning None if the file was not in the loaded files.

Removes a source from the knowledge base by finding the associated Source and removing all rules for that source. Will also remove the loaded files if the source was loaded from a file.

Trait Implementations

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.