class innerclass-expression~ class_expression
Source: class_expression.
Methods
new class_expression(in_type)
Core constructor.
The argument "in_type" may be:
- a class id (string)
- a JSON blob as described from Minerva
- another
- null (user will load or interactively create one)
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
in_type |
(String, Object, class_expression, or null) |
|
the raw type description (see above) |
Methods
staticcls(id) → class_expression
"Static" function that creates a class_expression from a class ID.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
id |
String |
|
string id |
- Returns
-
class_expressionobject
staticcomplement(cls_expr) → class_expression
"Static" function that creates the complement of a given class expression.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
cls_expr |
(class_expression or String) |
|
thing |
- Returns
-
class_expressionobject
staticintersection(list) → class_expression
"Static" function that creates an intersection from a list of whatever.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
list |
Array |
|
list of conformant whatever |
- Returns
-
class_expressionobject
staticsvf(prop_id, cls_expr) → class_expression
"Static" function that creates a SomeValueFrom from a property ID and a class_expression (or string or whatever).
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
prop_id |
String |
|
ID |
|
cls_expr |
(class_expression or String) |
|
thing |
- Returns
-
class_expressionobject
staticunion(list) → class_expression
"Static" function that creates a union from a list of whatever.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
list |
Array |
|
list of conformant whatever |
- Returns
-
class_expressionobject
as_class() → this
Parse a JSON blob into the current instance, clobbering anything in there, except id.
- Returns
-
thisself
as_complement() → this
Convert a null class_expression into an arbitrary complement.
- Returns
-
thisself
as_set() → this
Convert a null class_expression into a set of class expressions.
- Returns
-
thisself
as_svf() → this
Convert a null class_expression into an arbitrary SVF.
- Returns
-
thisself
category() → String
Try to put an instance type into some kind of rendering category.
- Returns
-
Stringstring (default 'unknown')
class_id() → (String or null)
The considered class id.
- Returns
-
(String or null)string or null
class_label() → (String or null)
The considered class label, defaults to ID if not found.
- Returns
-
(String or null)string or null
complement_class_expression() → (String or null)
The class expression when we are dealing with a ComplementOf.
- Returns
-
(String or null)type or null
frame() → Array
If the type has a recursive frame, a list of the cls expr it contains.
- Returns
-
Arraylist of {class_expression}
id() → String
Get the unique ID of this class expression.
- Returns
-
Stringstring
nested_p() → Boolean
If the type has a recursive frame.
- Returns
-
Booleantrue or false
parse() → this
Parse a JSON blob into the current instance, clobbering anything in there, except id.
- Returns
-
thisself
property_id() → (String or null)
The considered class property id. Not defined for 'class' types.
- Returns
-
(String or null)string or null
property_label() → (String or null)
The considered class property label. Not defined for 'class' types.
- Returns
-
(String or null)string or null
signature() → String
A cheap way of identifying if two class_expressions are the same. This essentially returns a string of the main attributes of a type. It is meant to be semi-unique and collide with dupe inferences.
BUG/WARNING: At this point, colliding signatures should mean a dupe, but non-colliding signatures does not guarantee that they are not dupes (think different intersection orderings).
- Returns
-
Stringstring
structure() → Object
Hm. Essentially dump out the information contained within into a JSON object that is appropriate for consumption my Minerva requests.
- Returns
-
ObjectJSON object
svf_class_expression() → (String or null)
The class expression when we are dealing with SVF.
- Returns
-
(String or null)type or null
to_string(front_str, back_str) → String
An attempt to have a simple attempt at a string representation for a class expression.
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
front_str |
String |
|
(optional) start the output string with (default '') |
|
back_str |
String |
|
(optional) end the output string with (default '') |
- Returns
-
Stringsimple string rep
type() → (String or null)
The "type" of the type.
- Returns
-
(String or null)string or null