mirror of
https://github.com/ruvnet/RuVector.git
synced 2026-05-23 21:25:02 +00:00
* fix(rvlite): Resolve getrandom WASM conflict with hnsw_rs patch Resolves the getrandom version conflict that prevented rvlite from compiling to WASM. The issue was caused by hnsw_rs 0.3.3 using rand 0.9 -> getrandom 0.3, while the workspace uses rand 0.8 -> getrandom 0.2. Changes: - Add [patch.crates-io] to workspace Cargo.toml for hnsw_rs - Include patched hnsw_rs 0.3.3 with rand 0.8 dependency - Modify hnsw_rs/Cargo.toml: rand = "0.8" (was "0.9") Note: This patch is applied but not actively used since rvlite disables the HNSW feature via default-features = false. The patch ensures compatibility if HNSW is enabled in the future. Build Status: ✅ WASM compiles successfully ✅ Bundle size: 96 KB gzipped (with ruvector-core) ✅ Full vector operations working ✅ No getrandom conflicts Related: - rvlite uses ruvector-core with memory-only feature - Avoids hnsw_rs dependency via default-features = false - Target-specific getrandom dependency enables "js" feature 🤖 Generated with Claude Code * feat(rvlite): Add multi-query language support (SPARQL, SQL, Cypher) This comprehensive update adds support for three query languages to rvlite, making it a versatile WASM-powered vector database with knowledge graph capabilities. The implementation includes full parsers, AST representations, and executors for each language. ## SPARQL Implementation - W3C SPARQL 1.1 compliant query parser - Triple pattern matching with subject/predicate/object - SELECT, CONSTRUCT, ASK, and DESCRIBE query forms - FILTER expressions with comparison and logical operators - OPTIONAL patterns and UNION support - ORDER BY, LIMIT, OFFSET modifiers - Built-in RDF triple store with in-memory indexing ## SQL Implementation - Standard SQL SELECT with projections and aliases - WHERE clause with complex boolean expressions - JOIN support (INNER, LEFT, RIGHT, FULL, CROSS) - Aggregate functions (COUNT, SUM, AVG, MIN, MAX) - GROUP BY and HAVING clauses - ORDER BY with ASC/DESC, LIMIT/OFFSET - Subqueries and nested expressions - Vector similarity search via special syntax ## Cypher Implementation - Neo4j-compatible Cypher query language - MATCH patterns with node and relationship traversal - CREATE, MERGE, SET, DELETE operations - WHERE clause filtering - RETURN with aliases and expressions - ORDER BY, SKIP, LIMIT modifiers - Variable-length path patterns - Property graph store with adjacency indexing ## Additional Changes - Interactive React dashboard with visualization - Supply chain simulation demo - Graph visualization components - IndexedDB persistence layer for browser storage - WASM getrandom conflict resolution for hnsw_rs - SONA time compatibility for cross-platform builds - NPM package for rvlite distribution - Documentation for all query implementations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
54 lines
1.7 KiB
SQL
54 lines
1.7 KiB
SQL
-- RuVector-Postgres Initialization Script
|
|
-- Creates extension and verifies basic functionality
|
|
|
|
-- Create the extension
|
|
CREATE EXTENSION IF NOT EXISTS ruvector;
|
|
|
|
-- Create test schema
|
|
CREATE SCHEMA IF NOT EXISTS ruvector_test;
|
|
|
|
-- Test table for basic usage
|
|
CREATE TABLE ruvector_test.test_basic (
|
|
id SERIAL PRIMARY KEY,
|
|
name TEXT NOT NULL,
|
|
category TEXT,
|
|
metadata JSONB,
|
|
created_at TIMESTAMP DEFAULT NOW()
|
|
);
|
|
|
|
-- Create ruvector role if it doesn't exist (optional app user)
|
|
DO $$
|
|
BEGIN
|
|
IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = 'ruvector') THEN
|
|
CREATE ROLE ruvector WITH LOGIN PASSWORD 'ruvector';
|
|
END IF;
|
|
END $$;
|
|
|
|
-- Grant permissions to ruvector role and public
|
|
GRANT USAGE ON SCHEMA ruvector_test TO PUBLIC;
|
|
GRANT ALL ON SCHEMA ruvector_test TO ruvector;
|
|
GRANT ALL ON ALL TABLES IN SCHEMA ruvector_test TO ruvector;
|
|
GRANT ALL ON ALL SEQUENCES IN SCHEMA ruvector_test TO ruvector;
|
|
|
|
-- Log initialization and test basic functions
|
|
DO $$
|
|
DECLARE
|
|
version_info TEXT;
|
|
simd_info TEXT;
|
|
BEGIN
|
|
-- Test version function
|
|
SELECT ruvector_version() INTO version_info;
|
|
RAISE NOTICE 'RuVector-Postgres initialized successfully';
|
|
RAISE NOTICE 'Extension version: %', version_info;
|
|
|
|
-- Test SIMD info function
|
|
SELECT ruvector_simd_info() INTO simd_info;
|
|
RAISE NOTICE 'SIMD info: %', simd_info;
|
|
|
|
-- Test distance functions with array functions
|
|
RAISE NOTICE 'Testing distance functions...';
|
|
RAISE NOTICE 'Inner product: %', inner_product_arr(ARRAY[1.0, 2.0, 3.0]::real[], ARRAY[1.0, 2.0, 3.0]::real[]);
|
|
RAISE NOTICE 'Cosine distance: %', cosine_distance_arr(ARRAY[1.0, 0.0, 0.0]::real[], ARRAY[0.0, 1.0, 0.0]::real[]);
|
|
|
|
RAISE NOTICE 'All basic tests passed!';
|
|
END $$;
|