Hiperspace.SQL 2.5.21

Prefix Reserved
dotnet add package Hiperspace.SQL --version 2.5.21
                    
NuGet\Install-Package Hiperspace.SQL -Version 2.5.21
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Hiperspace.SQL" Version="2.5.21" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Hiperspace.SQL" Version="2.5.21" />
                    
Directory.Packages.props
<PackageReference Include="Hiperspace.SQL" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Hiperspace.SQL --version 2.5.21
                    
#r "nuget: Hiperspace.SQL, 2.5.21"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Hiperspace.SQL@2.5.21
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Hiperspace.SQL&version=2.5.21
                    
Install as a Cake Addin
#tool nuget:?package=Hiperspace.SQL&version=2.5.21
                    
Install as a Cake Tool

Hiperspace.SQL

Hiperspace.SQL is a full SQL query engine for Hiperspace, supporting the full range of joins, aggregations, and subqueries.

Hiperspace.SQL provides the same query functionality as a .NET client can use with LINQ queries, but without the need to write code in C#/F#

Hiperspace fully supports point-in-time "time travel" queries that are not possible with Python Data-Frames or DuckDB

Features

  • Hiperspace.SQL is not limited to queries of columns within a table, but supports the full navigation of properties of Hiperspace elements
  • Where a column is a complex object, it is returned as a JSON object
  • Executing a batch of SQL statements return columnar data frames (dictionary of column-name and array of values)
  • Explain SQL returns the execution plan, detailing the SetSpaces accessed and keys used for search (Key, Index, Scan)
  • The Parquet method returns a Parquet file that can be used with any Apache Parquet library, or added to DuckDB OLAP store

Data Dictionary

SCHEMA_TABLE

Column Name Data Type Description
TABLE_NAME string The name of the table
TABLE_TYPE string The type of the table in SCHEMA_PROPERTY

SCHEMA_COLUMN

Column Name Data Type Description
TABLE_NAME string The name of the table
COLUMN_NAME string The name of the column
COLUMN_TYPE string The type of the table in SCHEMA_PROPERTY

SCHEMA_PROPERTY

Column Name Data Type Description
TYPE_NAME string The Type Name
PROPERTY_NAME string The name of each property
PROPERTY_TYPE string reference to SCHEMA_PROPERTY.TYPE_NAME

Examples

Simple query

SELECT p.Name, p.Gender FROM Persons as p WHERE p.Name = 'Lucy'

Query parameters

SELECT p.Name, p.Gender FROM Persons as p WHERE p.Name = :name

Query batches

SELECT p.Name, p.Gender FROM Persons as p WHERE p.Name = :name;
SELECT Name as name, Father as father from   Persons ;

Joins

SELECT  p.Name, f.Name as Father, f.Father as GrandFather
FROM    Persons as p 
join    Persons as f on p.Father.Name = f.Name
WHERE   p.Name = :name

Aggregates

select  p.Father.Name, count(p.Name) as Children
from    Persons as p
group by p.Father.Name as f
having count(*) > 1;

Like expressions

select  p.Father.Name, count(p.Name) as Children
from    Persons as p
where   Name like 'L%' and Name like '%y' or (Name like '%u%' and Name like '_uc_')
group by p.Father.Name as f
having count(*) > 1;

Null handling

select  p.Name, p.Father.Name
from    Persons as p
where   Name is not null

in query

SELECT p.Name, p.Gender 
FROM Persons as p 
WHERE p.Gender in (select p2.Gender from Persons as p2 where p2.Name = 'Lucy')

union

SELECT p.Name, p.Gender 
FROM Persons as p 
WHERE p.Name in ('Lucy', 'Mark')
union 
SELECT p.Name, p.Gender 
FROM Persons as p 
WHERE p.Name in ('Eve', 'Mary')

inline view

SELECT p.Name, p.Gender 
FROM Persons as p 
join (select p2.Gender from Persons as p2 where p2.Name = 'Lucy') as p3 on p.Gender = p3.Gender

dictionary query

select * from SCHEMA_TABLES;
select * from SCHEMA_COLUMNS;
select * from SCHEMA_PROPERTIES;

Hierarchy query

select  p.Name as Parent, c.Name as Child
from    Persons as p, p.MotherChild as c
where   p.Name = :name;

is equivalent to

select  p.Name as Parent, c.Name as Child
from    Persons as p JOIN Persons as c ON p.Name = c.Mother.Name
where   p.Name = :name;

since MotherChild is a set (of person) with each Person element, and any set can be joined with another set. In this case there is an implicit join between the set MotherChild and the Person p.

Graph

The Cousins example includes the property AllRelatives = allrelation(this) which uses the Cousins.Helper.AllRelations function to return the set of HiperEdge for all graph nodes that can be recursively found in Hiperspace for each person.

The following query finds all the relations for a person

select  p.Name as Person, 
        r.To.Name as Relation, 
        r.TypeName as Relationship,
        r.Length as Length,
        r.Width as Width
from    Persons as p,
        p.AllRelatives as r
where   p.Name = :name;

NB : There is no need to use a JOIN clause as p.AllRelatives includes the implicit join to Person.

the ability to navigate graph relationships is a unique feature of Hiperspace.SQL

API

The Hiperspace.SQL API can be called from any language that supports DOTNET interop, including Python (using pythonnet). Access via the Hiperspace.SQL.Engine object that is constructed with reference to any domain space.

Explain

Provides a detailed breakdown of the query execution plan

member engine.Explain (source, parameters : IDictionary<string,obj>) : string array = 

Execute

Executes the SQL queries and returns an array of Data Frames

member engine.Execute (source , parameters : IDictionary<string,obj>) : IDictionary<string, obj array> array  =

Parquet

Executes the SQL queries will an array of filenames (one for each statement) and returns the filenames after writing the results to the Apache Parquet files.

member this.Parquet (source, fileNames, parameters : IDictionary<string,obj>): string array = 
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.5.21 373 12/10/2025
2.5.18 650 12/3/2025
2.5.8 155 11/15/2025
2.5.2 181 11/6/2025
2.5.0 171 10/20/2025
2.4.6 179 9/23/2025
2.4.4 255 8/7/2025
2.4.2 144 7/28/2025
2.4.0 175 7/10/2025
2.3.8 165 7/1/2025
2.3.4 166 6/5/2025
2.2.2 183 5/5/2025
2.2.1 235 4/14/2025
2.2.0 118 3/29/2025
2.1.9 252 3/5/2025
2.1.6 149 2/15/2025
2.0.0 121 1/14/2025
1.0.5 141 11/15/2024
1.0.2 143 11/1/2024
1.0.1 181 10/18/2024

https://www.cepheis.com/hiperspace/20251210
# Overview
This release introduces GPU optimization for graph searches involving `HiperEdge` and other vector operations used in nearest-neighbor searches (*commonly required when providing information for AI prompts*).

It also enhances *Hiperspace* functions for LINQ queries by adding automatic null-coalescing for values selected from Hiperspace, supporting non-sargable join conditions, and improving performance for multi-table joins and **HiperspaceDB** cube aggregation.

-----

## CalculationGPU
[Graph Theory](https://en.wikipedia.org/wiki/Graph_theory) is a branch of Mathematics that can be used to describe all knowledge as `Node` and `Edge`'s  between them; because there is a simple consistent model across domains it has wide application for visualizing information, but has the downside that many graph views appear as a tangled web of nodes and lines: *often* conveying complexity, *but not* clarity.

[HyperGraph](https://en.wikipedia.org/wiki/Hypergraph)  is a generalization of [Graph](https://en.wikipedia.org/wiki/Graph_theory) that replaces the tangle of edges with a *hyperedge* that encapsulates all the intermediate nodes that are not interesting: I have a *cousin* (Robert), which can be described as "`Me->(cousin)->Robert`", but *cousin* is actually a *hyperedge* that is derived from "`me->mother2->mother1->daughter->son where mother2 is not daughter`"

[HiperEdge](https://www.cepheis.com/hiperspace/hiperedge) is a *HiperSpace* implementation of *hyperedge* that encapsulates the source of the *hyperedge* for a simple view of connections ***or*** the intermediate nodes in the path. When viewed graphically a `HiperEdge` view looks like a tree of connections extending out from the subject `Node`.

Hiperspace provides functions to query  [HiperEdge](https://www.cepheis.com/hiperspace/hiperedge)s using rules that project {*source node type, edge type, end node type*} to create [HiperEdge](https://www.cepheis.com/hiperspace/hiperedge)s whenever needed (*e.g. as a member function of a `Node`*).

### *Graph support*
This version introduces `ICalculationGPU` for optional acceleration of Graph Queries using the hardware created for [Ray Tracing](https://en.wikipedia.org/wiki/Ray_tracing_(graphics)),

### *Calculation support*

Search for *Nearest* node proximity in a [Vector Space](https://en.wikipedia.org/wiki/Vector_space) is supported via GPU, together with aggregation of Vectors used for complex calculation.

-----

### Null Coalesce
Consider a cube analytics model with {*Sector, Customer, Account, Trade*} with dimensions *Customer* and *Sector*; with *Trade* Facts aggregated. Null-coalescing is necessary when querying dimensions associated with a *Trade* fact.
```
@CubeDimension, CubeHierarchy(Parent), Versioned
entity Sector
 (Id : Int32)
 {Name : String, Parent : Sector}
 [Children : Sector (Parent = this), Customers : Customer (Sector = this)];

@CubeDimension, DeltaIndex
entity Customer
 (Id : String)
 {Sector : Sector}
 [Name : String, Accounts : Account (Customer = this)];
entity Instrument;

entity Account
 (Id : String)
 {Name : String, Customer : Customer};

@CubeFact, DeltaIndex
entity Trade : Versioned
 (id : Int64)
 {@CubeMeasure(Aggregation.Sum) Quantity : Decimal, Instrument : Instrument, Account : Account};
```
[image]Sites/hiperspace/sample/trade-null.png[/image]

The query  `from trade in Space.Trades select trade.Account.Customer.Sector` provides the *Sector* for a trade, but if any {*Trade.Account, Account.Customer, Customer.Sector*} is missing the expression will break.  The work around is to manually add null-coalesce to the query:
```
from trade in Space.Trades
select trade.Account ==  null ? null :  
      trade.Account.Customer == null ? null :
      trade.Account.Customer.Sector;
```
**This release adds coalesce automatically**. This is especially useful when Hiperspace.SQL is used to query a *hiperspace* from a scripting language where null-coalesce is not available, but we want to access the *graph* of properties.
```
select c.Id as SectorId, a.Id as AccountId
from Account as a join
    Customer as c on a.Customer.Id = c.Id
group by c.Sector.Id, a.Id;
```
This query would have ***previously*** failed if `a.Customer` is missing.

-----

### Non-Saragable predicates
In *Hiperspace* the following query cannot be [Sargable](https://en.wikipedia.org/wiki/Sargable) since *Customer* does not contain a *Sector* but a `KeyRef<Sector.KeyType, Sector>` with *lazy* loading of the element if needed.
```
select Sector.Name as "Sector Name", c.Name as "Customer Name"
from   Sector join
      Customer on Sector.Name = Customer.Sector.Name
order by Sector.Name, Customer.Name;
```
This query would ***previously*** have failed since `Customer.Sector` is a derived property of *Customer* and cannot be applied to a template for a `Find()` request of matching *Customers*

This release splits join processing into [Sargable](https://en.wikipedia.org/wiki/Sargable) predicates and residual conditions and is constructed dynamically as compiled expressions.