Hiperspace.SQL 2.2.0

dotnet add package Hiperspace.SQL --version 2.2.0
                    
NuGet\Install-Package Hiperspace.SQL -Version 2.2.0
                    
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.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Hiperspace.SQL" Version="2.2.0" />
                    
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.2.0
                    
#r "nuget: Hiperspace.SQL, 2.2.0"
                    
#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.
#addin nuget:?package=Hiperspace.SQL&version=2.2.0
                    
Install Hiperspace.SQL as a Cake Addin
#tool nuget:?package=Hiperspace.SQL&version=2.2.0
                    
Install Hiperspace.SQL 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;

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 a 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 a n 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. 
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.2.0 75 3/29/2025
2.1.9 199 3/5/2025
2.1.6 99 2/15/2025
2.0.0 50 1/14/2025
1.0.5 108 11/15/2024
1.0.2 98 11/1/2024
1.0.1 146 10/18/2024

https://www.cepheis.com/hiperspace/20250329
     # Overview
     This release introduces transitive edges, which extend the Graph model provided by `Node` and `Edge` views to include transitive traversal of an entire graph without the need for recursive queries of esoteric query languages and integrated with the data views provided by `Hiperspace`.  `Graph.TransitiveEdge` encapsulates all the Edges that can be projected as a Transitive Edge using a simple set of rules.

     [Transitive Edge blog](https://www.cepheis.com/blog/blog/transitive-edge)  and [Enterprise Transitive Edge](https://www.cepheis.com/blog/blog/enterprise-transitive-edge) goes into the details of our model of `Transitive Edge`, but the [graph-automorphic](https://en.wikipedia.org/wiki/Graph_automorphism) view is that a `Transitive Edge` encapsulates all the edges between *nodes* and allows the user to focus on the ends rather than the intermediate steps between them, and view the data as relations using commodity business intelligence software without *esoteric* graph query languages.

     ## Hiperspace

     The [Hiperspace](Hiperspace) package includes the additional `Graph` package types

     | Name |░| Notes |
     |-|-|-|
     | GraphFunctions || static functions that can be sued directly, or via import in a *.hilang* schema |
     | Route || Value type that defines name and rules for projecting `Edge` as `Transitive Edge` and extending to all related nodes |
     | Rule || The rules for matching {From node type, edge type, to node type} Edges, to the transititive edge projection |

     ### SubSpace
     * `SubSpace` includes an  additional *view* `SetSpace` `TransitiveEdges` that includes all elements that implement this view
     * `FindPaths` inteface function provides a method that matches the `Graph.GraphFunctions.Paths` function, but in a way that *domain spaces* can send the graph search to a server for parallel execution on computers that have many CPU cores.

     ### Fix PartitionSpace and GenerationSpace
     These two Space interceptors provide the partitioning of data by *hash-bucket* and *date-range*, but fault in the implementation of state-machine to implement `IAsyncEnumerable<>` in .NET9, can result in the *map/reduce* channel being disposed before the last message is processed (*warning to the wise: don't use AI generated suggestions without considering the stress-environments that it doesn't have a clue about*)

     # Hilang
     The [HiLang](HiLang) schema compiler has been enhanced to include the additional {**function**, **value**,**view**,**segment**}  declarations for  features of  `Hiperspace`.

     There are three ways that an element can project a view in Hilang:
     * `entity Person = Node (From = member/this, To = member/this, Name="value", TypeName = "Person")` where each member of the view is mapped to a specific member of the element
     * `entity Person = Node()` where the view members are automatically matched by name with members of the element
     * `entity Name =  View_Name = member`  **This language element has been enhanced to include a set of values** e.g. the set returned from `TransitativeEdge` function

     # Hiperspace.SQL
     The [Hiperspace.SQL](Hiperspace.SQL) already includes the ability to access deep structure methods like `SELECT p.Father.Name AS Father FROM Persons AS p  WHERE p.Name = :parameter;', but now also allows deep structure to members to be used in `FROM` clauses to join to segments and sets within each row.

     e.g. `Person` has an extension segment `MotherChild` and property `AllRelatives` that yields a `HashSet<TransitiveEdge>`, which can now be joined to in a SQL query.

     ```
     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;

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