-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge Feature/4 create card typetemplate (#23)
* Add next() for platform inconsistency * the Android cursor implementation does not prime the cursor to the first row of the returned data set * Fix LadyBug default toolchain using JDK 21 * Add code note * remove top app bar colors * Ignore db file * Remove unused naive Graph type * Move empty Module * Create system types * Create simple Record type * Mark all types except Int as experimental
- Loading branch information
Showing
9 changed files
with
220 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
core/entities/src/commonMain/kotlin/org/pointyware/commonsense/core/entities/Field.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.pointyware.commonsense.core.entities | ||
|
||
/** | ||
* A Field is a part of a Record that defines a property of a Concept. | ||
*/ | ||
data class Field( | ||
val name: String, | ||
val type: Type | ||
) { | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
core/entities/src/commonMain/kotlin/org/pointyware/commonsense/core/entities/Record.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.pointyware.commonsense.core.entities | ||
|
||
/** | ||
* A form of Schema that is used to define the structure of a Concept. | ||
* | ||
* Each Concept belongs to a Class and has a set of Properties. | ||
*/ | ||
data class Record( | ||
val title: String, | ||
val properties: Set<Field> = emptySet() | ||
): Type { | ||
} |
186 changes: 186 additions & 0 deletions
186
core/entities/src/commonMain/kotlin/org/pointyware/commonsense/core/entities/Type.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
package org.pointyware.commonsense.core.entities | ||
|
||
@RequiresOptIn( | ||
message = "This API is experimental and may change in the future.", | ||
level = RequiresOptIn.Level.WARNING | ||
) | ||
annotation class ExperimentalType | ||
|
||
/** | ||
* Describes the range of types that values can take on in the Common Sense system. | ||
* | ||
* Theoretical types conform to a type-hierarchy that is based on set membership. | ||
* | ||
* [Type.Int] is the only non-experimental type. | ||
*/ | ||
sealed interface Type { | ||
// region Theoretical Types | ||
|
||
/** | ||
* A number is an object used for counting, measuring, or labeling. | ||
* | ||
* [Number definitions](https://www.oed.com/dictionary/number_n) | ||
*/ | ||
@ExperimentalType | ||
interface Number: Type { | ||
|
||
} | ||
|
||
/** | ||
* A complex number is a value composed of a real part and an imaginary part. | ||
*/ | ||
@ExperimentalType | ||
interface Complex: Number { | ||
|
||
} | ||
|
||
/** | ||
* An imaginary number is a value that can be represented as a real number multiplied by the square root of -1. | ||
*/ | ||
@ExperimentalType | ||
interface Imaginary: Complex { | ||
|
||
} | ||
|
||
/** | ||
* A real number is a value that can be represented on a number line. | ||
*/ | ||
@ExperimentalType | ||
interface Real: Complex { | ||
|
||
} | ||
|
||
@ExperimentalType | ||
interface Natural: Real { | ||
|
||
} | ||
|
||
@ExperimentalType | ||
interface Integer: Natural { | ||
|
||
} | ||
|
||
/** | ||
* A rational number is a value that can be represented as a fraction of two integers. | ||
*/ | ||
@ExperimentalType | ||
interface Rational: Real { | ||
|
||
} | ||
|
||
/** | ||
* An irrational number is a value that cannot be represented as a fraction of two integers. | ||
*/ | ||
@ExperimentalType | ||
interface Irrational: Real { | ||
|
||
} | ||
|
||
/** | ||
* A transcendental number is a value that cannot be represented as a fraction of two integers. | ||
*/ | ||
@ExperimentalType | ||
interface Transcendental: Real { | ||
|
||
} | ||
|
||
// endregion | ||
|
||
// region Computing Types | ||
|
||
/** | ||
* A singular value that represents the absence of any other value. Derived from the Latin | ||
* word "nullus" meaning "none", associated with the concept of zero<sup>(1)</sup>. | ||
* When used in combination with other types, it represents the absence of a value of that | ||
* type. When used in combination with numbers, it - somewhat confusingly - does not represent zero. | ||
* | ||
* <sup>(1)</sup> - [null etymology](https://www.etymonline.com/word/null) | ||
*/ | ||
@ExperimentalType | ||
data object Null: Type | ||
|
||
/** | ||
* A boolean is a value that can be either true or false. | ||
*/ | ||
@ExperimentalType | ||
data object Boolean: Type | ||
|
||
/** | ||
* An integer is a value that can be represented as a whole number. | ||
*/ | ||
data object Int: Type // Add min, max constraints or define as further type? | ||
|
||
/** | ||
* A floating point number is composed of a sign bit, mantissa, and an exponent. | ||
*/ | ||
@ExperimentalType | ||
data object Float: Type // Add min, max constraints or define as further type? | ||
|
||
// Collections | ||
/** | ||
* A collection is a group of objects that are treated as a single entity. | ||
*/ | ||
@ExperimentalType | ||
data object Collection: Type | ||
|
||
// Homogenous Collections | ||
/** | ||
* A sequence is an ordered collection of objects. | ||
*/ | ||
@ExperimentalType | ||
data object Sequence: Type | ||
|
||
/** | ||
* An array is a fixed-size collection of objects. | ||
*/ | ||
@ExperimentalType | ||
data object Array: Type // Add size min, max constraints or define as further type? | ||
|
||
/** | ||
* A string is a special case sequence of characters. | ||
*/ | ||
@ExperimentalType | ||
data object String: Type // Add pattern constraints or define as further type? | ||
|
||
/** | ||
* A set is collection of unique objects. | ||
*/ | ||
@ExperimentalType | ||
data object Set: Type | ||
|
||
/** | ||
* A bag is a special case of a set where each element can appear more than once. | ||
*/ | ||
@ExperimentalType | ||
data object Bag: Type | ||
|
||
/** | ||
* A map is a special case of a set where each element is a key-value pair. | ||
*/ | ||
@ExperimentalType | ||
data object Map: Type | ||
|
||
// Heterogeneous Collections | ||
|
||
/** | ||
* An object is a collection of properties, similar to key-value pairs, with associated | ||
* behaviors that can be invoked. | ||
* | ||
* In the Common Sense system, an object is a collection of properties that are defined by a | ||
* type template. | ||
* | ||
* - See concepts: Struct, Record, Class, Object vs Instance | ||
* @see Record | ||
*/ | ||
@ExperimentalType | ||
data object Object: Type | ||
|
||
/** | ||
* An interface is a collection of properties that define a contract for objects that implement | ||
* the interface. | ||
*/ | ||
@ExperimentalType | ||
data object Interface: Type | ||
|
||
// endregion | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters