Dataset Viewer
Auto-converted to Parquet Duplicate
text
stringlengths
1.2k
30.9k
As of 4D version 21, the `Blob` class provides functionality for creating and manipulating blob objects (instances of `4D.Blob`). Below is a detailed explanation of its methods and properties, including version history and technical specifications. ### **Blob Class Overview** The `Blob` class allows developers to gene...
As of 4D version 21, the `Class` class in the 4D language environment represents user-defined classes within a project. When a user class is created, it is instantiated as an object of the `Class` class, which provides a set of properties and a function to interact with and manage class definitions. Below is a detailed...
As of 4D version 21, the **Collection** class provides a comprehensive set of methods and properties for managing collection-type expressions. A collection is initialized using the `New collection` or `New shared collection` commands. Below is a detailed description of each method and property, including their syntax, ...
As of 4D version 21, the `CryptoKey` class in the 4D language provides a robust interface for managing asymmetric encryption key pairs, including RSA and ECDSA algorithms. This class is accessible via the 4D class store and facilitates operations such as encryption, decryption, signing, and verification of messages. Be...
As of 4D version 21, the `DataClass` provides an object-oriented interface to interact with a database table within a 4D application. All dataclasses are accessible as properties of the `ds` datastore. ### DataClass Overview The `DataClass` exists since version 17 of 4D, with the `.exposed` attribute added in version ...
As of 4D version 21, the `DataStore` class serves as the primary interface object provided by ORDA (Object-Relational Data Access) for referencing and accessing a database. This class is central to ORDA functionality, enabling interaction with both local and remote datastores. Below is a detailed description of the `Da...
As of 4D version 21, the `Directory` class (also referred to as the `Folder` class in the context of its properties and methods) provides a comprehensive set of attributes and functions for managing folder objects in a file system. The class was initially introduced in version 17 R5, with all documented properties and ...
As of 4D version 21, the **Document** class provides a set of properties and functions to interact with file objects in a relational database context. The class and its members were initially introduced in version 17 R5, with no subsequent modifications to the documented features. Below is a detailed description of eac...
As of 4D version 21, the `EmailObjectClass` (titled "Email") provides a structured approach to creating, sending, and receiving emails within the 4D environment. All operations involving emails—such as composition, transmission, or retrieval—are performed using an `Email` object. This object adheres to the **JMAP (JSON...
As of 4D version 21, the `Entity` class represents an instance of a `DataClass`, analogous to a record in a table associated with a dataclass within its datastore. An entity encompasses the same attributes as its dataclass, alongside data values, and provides specific properties and functions for manipulation. The `Ent...
As of 4D version 21, the `EntitySelection` class is a fundamental component of the ORDA (Object-Relational Data Access) architecture in 4D. An entity selection is an object that contains one or more references to entities belonging to the same dataclass. An entity selection can be empty, contain a single entity, or mul...
As of 4D version 21, the `File` class provides a robust interface for managing disk files programmatically. File objects are instantiated using the `File` command or the `4D.File.new()` function, which are functionally equivalent. These objects serve as references to files that may or may not exist on disk. For instanc...
As of 4D version 21, the `FileHandle` class provides a robust interface for sequentially reading from or appending content to an opened `File` object. This class enables access to any part of a document and is instantiated using the `file.open()` function. For operations requiring the reading or writing of an entire do...
As of 4D version 21, the `Folder` class provides a programmatic interface for managing filesystem folders. Folder objects are instantiated using the `Folder` command (or its equivalent `4D.Folder.new()` function) and represent references to folders that may or may not physically exist on disk. A valid `Folder` object i...
As of 4D version 21, the `Function` class in 4D provides a mechanism to encapsulate executable code within objects, enabling dynamic and flexible execution of logic. A `4D.Function` object represents a piece of code that can be invoked either through the `()` operator or via the `apply()` and `call()` methods. There ar...
As of 4D version 21, the HTTPAgent class provides a mechanism for managing persistent and reusable HTTP connections to servers through HTTPRequest objects. This class is accessible from the 4D class store, enabling developers to create custom HTTPAgent objects using the `4D.HTTPAgent.new()` function. ### Overview of ...
End of preview. Expand in Data Studio

Classes

Clean summary of 4D object language reference.

Example

As of 4D version 21, the Vector class is a built-in component of the 4D language, designed to facilitate the handling of vectors and the execution of distance and similarity calculations between them. This class is accessible via the 4D class store and is particularly relevant in the context of artificial intelligence, where vectors—sequences of numerical values—serve as foundational representations for complex data, enabling machines to interpret and manipulate such data effectively.\n\n### Overview of Vector Computations\nThe 4D.Vector class supports three primary types of vector computations, each suited to distinct analytical needs. Below is a detailed explanation of these computations, their definitions, use cases, and analogies for clarity:\n\n1. Cosine Similarity\n - Definition: Cosine similarity evaluates the orientation of two vectors by measuring the cosine of the angle between them. This metric is indifferent to the magnitude (or length) of the vectors and focuses solely on their direction. Vectors pointing in the same direction yield a high cosine similarity, regardless of their individual magnitudes.\n - Analogy: Consider a scenario where you are selecting movies on a streaming platform. Cosine similarity compares your preferences (e.g., a fondness for action-comedy films) with the descriptions of movies in the platform’s database. The similarity is determined by how closely the characteristics of the movies align with your tastes, irrespective of how frequently you watch movies (i.e., the magnitude of your engagement).\n - Use Case: This computation is ideal for text embeddings, document comparisons, semantic search, and text classification, where the semantic alignment of data is more critical than its scale.\n - Returned Value: The result ranges from -1 (indicating opposite directions) to 1 (indicating identical directions). Higher values denote greater similarity.\n\n2. Dot Product Similarity\n - Definition: The dot product similarity calculates the sum of the products of corresponding components of two vectors. Unlike cosine similarity, this metric is sensitive to both the direction and magnitude of the vectors, effectively serving as a weighted compatibility score.\n - Analogy: Imagine using a search engine to look up "chocolate cake recipe." The dot product can assess not only whether a webpage discusses chocolate cakes (directional similarity) but also the depth of its content (magnitude). A webpage with extensive, detailed information about chocolate cakes will score higher than one with only a brief mention.\n - Use Case: This computation is recommended for models where vector magnitudes are meaningful, such as recommendation engines or relevance scoring systems.\n - Returned Value: The result is dependent on both the magnitudes and directions of the vectors. Higher values indicate greater similarity.\n\n3. Euclidean Distance\n - Definition: Euclidean distance measures the straight-line distance between two vectors in a multi-dimensional space. This metric accounts for all differences between vector components, providing a literal measure of how far apart the vectors are.\n - Analogy: In a dating application, Euclidean distance could be used to compare user profiles based on interests, age, location, and other attributes. If two users share similar interests (e.g., hiking, pop music) and live close to each other, the Euclidean distance between their profiles will be small, suggesting a strong match.\n - Use Case: This computation is well-suited for numeric or structured data embeddings, particularly when the proximity of data points in the vector space directly correlates with their similarity.\n - Returned Value: The result is a non-negative real number. Lower values indicate greater similarity between vectors.\n\nIt is advisable to experiment with these computations to determine which best aligns with your specific data and requirements.\n\n### Vector Object Properties and Methods\nVector objects in 4D are characterized as shared, immutable, and streamable, ensuring consistency and reliability in multi-user and distributed environments.\n\n#### 4D.Vector.new()\n- Availability: This function was introduced in 4D version 20 R10.\n- Purpose: The 4D.Vector.new() function creates and returns a new 4D.Vector object.\n- Parameters:\n - parameter (Collection of reals): A collection of real numbers representing the vector to be created. These values are typically generated by artificial intelligence systems and mathematically represent objects such as words or datasets.\n- Return Value: A new 4D.Vector object.\n- Example: To create a vector, pass a collection of real numbers to 4D.Vector.new(). Individual components of the vector can be accessed directly, or the entire vector can be converted back to a collection using the .toCollection() method.\n\n#### .cosineSimilarity()\n- Purpose: This function calculates the cosine similarity between the current vector and another vector provided as a parameter.\n- Parameters:\n - vector (4D.Vector): The vector to compare with the current vector. Both vectors must be of the same size.\n- Return Value: A real number representing the cosine similarity, ranging from -1 to 1.\n- Syntax: Vector.cosineSimilarity(vector: 4D.Vector): Real\n\n#### .dotSimilarity()\n- Purpose: This function calculates the dot product between the current vector and another vector provided as a parameter.\n- Parameters:\n - vector (4D.Vector): The vector to compare with the current vector. Both vectors must be of the same size.\n- Return Value: A real number representing the dot product, which varies based on the magnitudes and directions of the vectors.\n- Syntax: Vector.dotSimilarity(vector: 4D.Vector): Real\n\n#### .euclideanDistance()\n- Purpose: This function calculates the Euclidean distance between the current vector and another vector provided as a parameter.\n- Parameters:\n - vector (4D.Vector): The vector to compare with the current vector. Both vectors must be of the same size.\n- Return Value: A non-negative real number representing the Euclidean distance. Lower values indicate greater similarity.\n- Syntax: Vector.euclideanDistance(vector: 4D.Vector): Real\n\n#### .length\n- Purpose: This property returns the number of components in the vector.\n- Return Value: An integer representing the vector's dimensionality.\n\n#### .toCollection()\n- Purpose: This function converts the vector into a collection of real numbers, representing its components.\n- Return Value: A collection of real numbers.\n- Syntax: Vector.toCollection(): Collection\n\n### Version History\n- The Vector class was introduced in 4D version 20 R10 with the 4D.Vector.new() function.

Downloads last month
144

Models trained or fine-tuned on keisuke-miyako/text-commands-2026-0423