2023-11-17 20:51:13 +03:00
|
|
|
/**
|
|
|
|
* Module: Models for formal representation for systems of concepts.
|
|
|
|
*/
|
|
|
|
|
2023-12-13 14:32:57 +03:00
|
|
|
import { Graph } from '@/utils/Graph'
|
|
|
|
|
2023-11-30 02:14:24 +03:00
|
|
|
import { ILibraryItemEx, ILibraryUpdateData } from './library'
|
2023-11-06 20:21:30 +03:00
|
|
|
import { IArgumentInfo, ParsingStatus, ValueClass } from './rslang'
|
2023-07-29 03:31:21 +03:00
|
|
|
|
2023-11-17 20:51:13 +03:00
|
|
|
/**
|
|
|
|
* Represents Constituenta type.
|
|
|
|
*/
|
2023-07-26 23:11:00 +03:00
|
|
|
export enum CstType {
|
|
|
|
BASE = 'basic',
|
|
|
|
STRUCTURED = 'structure',
|
|
|
|
TERM = 'term',
|
|
|
|
AXIOM = 'axiom',
|
|
|
|
FUNCTION = 'function',
|
|
|
|
PREDICATE = 'predicate',
|
|
|
|
CONSTANT = 'constant',
|
|
|
|
THEOREM = 'theorem'
|
|
|
|
}
|
|
|
|
|
2023-12-26 14:23:51 +03:00
|
|
|
// CstType constant for category dividers in TemplateSchemas. TODO: create separate structure for templates
|
2023-11-04 01:29:21 +03:00
|
|
|
export const CATEGORY_CST_TYPE = CstType.THEOREM;
|
|
|
|
|
2023-11-17 20:51:13 +03:00
|
|
|
/**
|
|
|
|
* Represents Constituenta classification in terms of system of concepts.
|
|
|
|
*/
|
2023-08-16 00:39:16 +03:00
|
|
|
export enum CstClass {
|
|
|
|
BASIC = 'basic',
|
|
|
|
DERIVED = 'derived',
|
|
|
|
STATEMENT = 'statement',
|
|
|
|
TEMPLATE = 'template'
|
|
|
|
}
|
|
|
|
|
2023-11-17 20:51:13 +03:00
|
|
|
/**
|
|
|
|
* Represents formal expression Status.
|
|
|
|
*/
|
2023-09-11 20:31:54 +03:00
|
|
|
export enum ExpressionStatus {
|
2023-09-26 00:24:50 +03:00
|
|
|
VERIFIED = 'verified',
|
2023-09-11 20:31:54 +03:00
|
|
|
INCORRECT = 'incorrect',
|
2023-09-26 00:24:50 +03:00
|
|
|
INCALCULABLE = 'incalculable',
|
2023-10-02 23:43:29 +03:00
|
|
|
PROPERTY = 'property',
|
2023-09-26 00:24:50 +03:00
|
|
|
UNDEFINED = 'undefined',
|
|
|
|
UNKNOWN = 'unknown',
|
2023-09-11 20:31:54 +03:00
|
|
|
}
|
|
|
|
|
2023-11-17 20:51:13 +03:00
|
|
|
/**
|
2023-12-26 14:23:51 +03:00
|
|
|
* Represents word form for natural language.
|
2023-11-17 20:51:13 +03:00
|
|
|
*/
|
2023-08-29 15:17:16 +03:00
|
|
|
export interface TermForm {
|
|
|
|
text: string
|
|
|
|
tags: string
|
2023-07-20 17:11:03 +03:00
|
|
|
}
|
|
|
|
|
2023-11-17 20:51:13 +03:00
|
|
|
/**
|
|
|
|
* Represents Constituenta basic persistent data.
|
|
|
|
*/
|
2023-07-26 23:11:00 +03:00
|
|
|
export interface IConstituentaMeta {
|
2023-08-22 22:38:27 +03:00
|
|
|
id: number
|
|
|
|
schema: number
|
2023-07-26 23:11:00 +03:00
|
|
|
order: number
|
|
|
|
alias: string
|
|
|
|
convention: string
|
|
|
|
cst_type: CstType
|
|
|
|
definition_formal: string
|
|
|
|
definition_raw: string
|
|
|
|
definition_resolved: string
|
|
|
|
term_raw: string
|
|
|
|
term_resolved: string
|
2023-08-29 15:17:16 +03:00
|
|
|
term_forms: TermForm[]
|
|
|
|
}
|
|
|
|
|
2023-11-17 20:51:13 +03:00
|
|
|
/**
|
|
|
|
* Represents Constituenta.
|
|
|
|
*/
|
2023-08-29 15:17:16 +03:00
|
|
|
export interface IConstituenta
|
|
|
|
extends IConstituentaMeta {
|
|
|
|
cst_class: CstClass
|
|
|
|
status: ExpressionStatus
|
|
|
|
is_template: boolean
|
|
|
|
parse: {
|
|
|
|
status: ParsingStatus
|
|
|
|
valueClass: ValueClass
|
|
|
|
typification: string
|
|
|
|
syntaxTree: string
|
2023-11-06 02:20:16 +03:00
|
|
|
args: IArgumentInfo[]
|
2023-08-29 15:17:16 +03:00
|
|
|
}
|
2023-07-26 23:11:00 +03:00
|
|
|
}
|
|
|
|
|
2023-11-17 20:51:13 +03:00
|
|
|
/**
|
|
|
|
* Represents Constituenta list.
|
|
|
|
*/
|
2023-07-26 23:11:00 +03:00
|
|
|
export interface IConstituentaList {
|
2023-09-22 23:26:22 +03:00
|
|
|
items: number[]
|
2023-07-26 23:11:00 +03:00
|
|
|
}
|
|
|
|
|
2023-11-17 20:51:13 +03:00
|
|
|
/**
|
|
|
|
* Represents constituenta data, used in creation process.
|
|
|
|
*/
|
2023-08-16 18:32:37 +03:00
|
|
|
export interface ICstCreateData
|
2023-10-25 21:21:43 +03:00
|
|
|
extends Pick<
|
|
|
|
IConstituentaMeta,
|
|
|
|
'alias' | 'cst_type' | 'definition_raw' | 'term_raw' |
|
|
|
|
'convention' | 'definition_formal' | 'term_forms'
|
|
|
|
> {
|
2023-08-22 22:38:27 +03:00
|
|
|
insert_after: number | null
|
2023-07-26 23:11:00 +03:00
|
|
|
}
|
|
|
|
|
2023-11-17 20:51:13 +03:00
|
|
|
/**
|
|
|
|
* Represents data, used in ordering constituents in a list.
|
|
|
|
*/
|
2023-07-26 23:11:00 +03:00
|
|
|
export interface ICstMovetoData extends IConstituentaList {
|
|
|
|
move_to: number
|
|
|
|
}
|
|
|
|
|
2023-11-17 20:51:13 +03:00
|
|
|
/**
|
|
|
|
* Represents data, used in updating persistent attributes in {@link IConstituenta}.
|
|
|
|
*/
|
2023-07-26 23:11:00 +03:00
|
|
|
export interface ICstUpdateData
|
2023-09-25 14:17:52 +03:00
|
|
|
extends Pick<IConstituentaMeta, 'id'>,
|
|
|
|
Partial<Pick<IConstituentaMeta, | 'alias' | 'convention' | 'definition_formal' | 'definition_raw' | 'term_raw' | 'term_forms'>> {}
|
2023-07-26 23:11:00 +03:00
|
|
|
|
2023-11-17 20:51:13 +03:00
|
|
|
/**
|
|
|
|
* Represents data, used in renaming {@link IConstituenta}.
|
|
|
|
*/
|
2023-08-22 20:29:07 +03:00
|
|
|
export interface ICstRenameData
|
|
|
|
extends Pick<IConstituentaMeta, 'id' | 'alias' | 'cst_type' > {}
|
|
|
|
|
2023-11-17 20:51:13 +03:00
|
|
|
/**
|
|
|
|
* Represents data response when creating {@link IConstituenta}.
|
|
|
|
*/
|
2023-07-26 23:11:00 +03:00
|
|
|
export interface ICstCreatedResponse {
|
|
|
|
new_cst: IConstituentaMeta
|
|
|
|
schema: IRSFormData
|
|
|
|
}
|
|
|
|
|
2023-11-17 20:51:13 +03:00
|
|
|
/**
|
|
|
|
* Represents {@link IRSForm} statistics.
|
|
|
|
*/
|
2023-07-20 17:11:03 +03:00
|
|
|
export interface IRSFormStats {
|
2023-07-25 20:27:29 +03:00
|
|
|
count_all: number
|
|
|
|
count_errors: number
|
|
|
|
count_property: number
|
2023-12-26 14:23:51 +03:00
|
|
|
count_incalculable: number
|
2023-07-25 20:27:29 +03:00
|
|
|
|
2023-12-26 14:23:51 +03:00
|
|
|
count_text_term: number
|
2023-08-27 15:39:49 +03:00
|
|
|
count_definition: number
|
|
|
|
count_convention: number
|
2023-07-25 20:27:29 +03:00
|
|
|
|
|
|
|
count_base: number
|
|
|
|
count_constant: number
|
|
|
|
count_structured: number
|
|
|
|
count_axiom: number
|
|
|
|
count_term: number
|
|
|
|
count_function: number
|
|
|
|
count_predicate: number
|
|
|
|
count_theorem: number
|
2023-07-20 17:11:03 +03:00
|
|
|
}
|
|
|
|
|
2023-11-17 20:51:13 +03:00
|
|
|
/**
|
|
|
|
* Represents formal explication for set of concepts.
|
|
|
|
*/
|
2023-08-25 22:51:20 +03:00
|
|
|
export interface IRSForm
|
2023-11-30 02:14:24 +03:00
|
|
|
extends ILibraryItemEx {
|
2023-07-26 23:11:00 +03:00
|
|
|
items: IConstituenta[]
|
|
|
|
stats: IRSFormStats
|
2023-07-29 21:23:18 +03:00
|
|
|
graph: Graph
|
2023-07-20 17:11:03 +03:00
|
|
|
}
|
|
|
|
|
2023-11-17 20:51:13 +03:00
|
|
|
/**
|
|
|
|
* Represents data for {@link IRSForm} provided by backend.
|
|
|
|
*/
|
2023-07-30 00:47:07 +03:00
|
|
|
export interface IRSFormData extends Omit<IRSForm, 'stats' | 'graph'> {}
|
2023-07-26 23:11:00 +03:00
|
|
|
|
2023-11-17 20:51:13 +03:00
|
|
|
/**
|
|
|
|
* Represents data, used for creating {@link IRSForm}.
|
|
|
|
*/
|
2023-07-26 23:11:00 +03:00
|
|
|
export interface IRSFormCreateData
|
2023-08-25 22:51:20 +03:00
|
|
|
extends ILibraryUpdateData {
|
2023-07-25 20:27:29 +03:00
|
|
|
file?: File
|
2023-07-26 23:11:00 +03:00
|
|
|
fileName?: string
|
2023-07-20 17:11:03 +03:00
|
|
|
}
|
|
|
|
|
2023-11-17 20:51:13 +03:00
|
|
|
/**
|
|
|
|
* Represents data, used for uploading {@link IRSForm} as file.
|
|
|
|
*/
|
2023-07-27 22:04:25 +03:00
|
|
|
export interface IRSFormUploadData {
|
|
|
|
load_metadata: boolean
|
|
|
|
file: File
|
|
|
|
fileName: string
|
2023-11-06 20:21:30 +03:00
|
|
|
}
|