CortexDB implements a 'governed write' model inspired by Palantir Foundry. Instead of allowing agents to perform arbitrary upserts, the system exposes a whitelist of OntologyActionTypes. This ensures all graph edits are auditable and follow strict business logic.
Core Constraints
- Link Creation:
create_link is strictly for many-to-many relationships. For one-to-many or one-to-one relationships, you must use modify_object to update the foreign key property. - Atomicity/Ordering:
modify_object or delete_object cannot reference an object that was just created within the same action. - Validation Scope: Validation only checks parameters and submission criteria; it does not query existing data (e.g., it does not check for primary key uniqueness during the validation phase).
Key Components
- Action Types: A set of governed edits defined by parameters, rules, and submission criteria.
- Rules: Define the actual edits (e.g.,
create_object, modify_object, delete_link). - Submission Criteria: Predicates that gate whether an action can be submitted based on parameter values (e.g., regex matching).
- Value Sources: Determines where a rule gets its data (e.g., from a
parameter, a static value, or current_time).
// Example of an Action Type definition
OntologyActionType{
APIName: "registerAirport",
DisplayName: "Register Airport",
Parameters: []OntologyActionParameter{
{APIName: "iataCode", DataType: OntologyDataType{Kind: OntologyDataString}, Required: true},
{APIName: "airportName", DataType: OntologyDataType{Kind: OntologyDataString}, Required: true},
},
Rules: []OntologyActionRule{
{
Kind: ActionRuleCreateObject,
ObjectType: "Airport",
PropertyValues: map[string]OntologyValueSource{
"iataCode": {Kind: ValueSourceParameter, Parameter: "iataCode"},
"airportName": {Kind: ValueSourceParameter, Parameter: "airportName"},
},
},
},
SubmissionCriteria: []OntologySubmissionCriterion{
{
Parameter: "iataCode",
Op: PredicateContains,
Regex: "^[A-Z]{3}$",
FailureMessage: "IATA code must be three uppercase letters.",
},
},
}