Concepts
Understand concepts and how they are utilized in procedures defined by BDK.
What are Concepts?
Concepts define how data flows in and out of a procedure:
Input concepts represent the inputs that a procedure requires.
Output concepts represent the results that a procedure generates.
Concept Types
Input and output concepts can be defined as either standard or custom types.
Standard Types
The following Python data types can be used to define concepts:
Text
str
Number
float
, int
Boolean
bool
Bytes
bytes
Date
datetime.datetime
, datetime.date
, datetime.time
File
typing.IO
UUID
uuid.UUID
Table
pyarrow.Table
, arro3.core.Table
, nanoarrow.ArrayStream
Lists
List[str]
, List[int]
Dictionary
Dict[str, Any]
Note:
Any
can be any of the other supported types.
Custom Types
Concepts can also be custom types. Custom concepts must be marked with the @concept decorator. Using a dataclass is recommended. For example:
Concepts vs. Parameters
Concepts and parameters are two different entities that are closely related.
Concepts
Concepts are operated on by Kognitos procedures. Some concepts are included in the name of the @procedure decorator.
Parameters
Parameters are operated on by Python functions. They are defined in a function's signature and are specific to the function's implementation.
How Are They Related?
An internal mapping is created between a Python function and a Kognitos procedure. To ensure a correct mapping, concepts and parameters must match.
Concept-Parameter Matching
Concepts and parameter names must match to ensure they are properly mapped internally.
Guidelines
Match concepts to parameters by following these guidelines:
Replace spaces with underscores.
Drop possessive constructions ('s).
Consider each connected noun phrase as a separate parameter. Non-essential noun phrases (e.g., "field," "value") included to clarify context do not require a corresponding parameter.
Don't map articles ('an', 'a', 'the') to parameters; only the nouns they connect should be considered.
Define optional parameters in cases where the input concept is not explicitly defined in the procedure name.
Example 1
In this example, the concept red car maps to the parameter red_car
. The space is replaced with an underscore.
Example 2
In the example below:
servicenow's ticket maps to
ticket
field maps to
field
outlook's standard user maps to
standard_user
Example 3
In this example, the concept ticket maps to the parameter ticket
. The possessive construct ('s) is dropped and the word "field" is ignored.
Example 4
In the example below, the concept of priority is not explicitly stated in the procedure name. It maps to the optional function parameter, priority
.
Example 5
In this example:
the city maps to the parameter
city
the unit maps to the optional parameter
the unit
The output concept, current temperature, is wrapped in parenthesis in the procedure name.
Last updated
Was this helpful?