Skip to content
DuckDB community extension

anofox_similarity

Multi-modal product similarity search for manufacturing supply chain planning. Find similar materials by BOM component overlap (Jaccard), graph-structural similarity (Weisfeiler-Lehman kernel), text embeddings, and transactional patterns, with predecessor detection and cold-start analog matching for demand forecasting. Requirements coverage matching: direction-aware value checks with units (EN/DE), property trees from JSON, a traced coverage kernel with gap lists, catalogue classification with your own vectors, vocabulary review, evaluation, and MinHash/LSH recall.

01 / SETUP

Install and load

Run these commands in a Haybarn SQL session. The extension is available from the community repository.

Haybarn 2.0.0 · SQL
INSTALL anofox_similarity FROM community;
LOAD anofox_similarity FROM community;

This published WASM build cannot load in the current browser session. Use a native Haybarn session for now.

Using upstream DuckDB? Follow the maintainer’s installation instructions.

02 / QUERY

Usage example

Components (BOM) for each product

SQL
-- Components (BOM) for each product
CREATE TABLE bom_items (parent_id VARCHAR, child_id VARCHAR);
INSERT INTO bom_items VALUES
  ('PUMP-A', 'SEAL-001'), ('PUMP-A', 'BEARING-X'), ('PUMP-A', 'MOTOR-M1'),
  ('PUMP-B', 'SEAL-001'), ('PUMP-B', 'BEARING-X'), ('PUMP-B', 'MOTOR-M1'), ('PUMP-B', 'GASKET-Y'),
  ('PUMP-C', 'FILTER-F1'), ('PUMP-C', 'VALVE-V2');

-- Find the 3 materials most similar to PUMP-A by shared components
SELECT material_id, similarity, shared_components, total_components
FROM find_similar_materials_jaccard('PUMP-A', 3, bom_table := 'bom_items')
ORDER BY similarity DESC;
-- PUMP-B   0.75  3  4   (high overlap)
-- PUMP-C   0.0   0  5   (disjoint)

-- Structural similarity that also weighs BOM topology, not just component sets
SELECT wl_kernel_similarity('PUMP-A', 'PUMP-B', iterations := 3, bom_table := 'bom_items');

Provided by DataZooDE. Not yet verified on Haybarn 2.0.0.

Sample data & setup

About this extension

anofox_similarity helps manufacturers answer "which existing product is this new one most like?" directly against ERP master data (SAP, Microsoft Dynamics 365, or a plain bom_items table), which is the key input for cold-start demand forecasting, predecessor detection, and analog-based planning for products with no sales history yet.

SAP (MARA/MAKT/MAST/STKO/STPO) and Dynamics 365 transformation macros (sap_to_bom_items, sap_to_materials_with_desc, ...) normalize common ERP exports into the BOM/material schema the rest of the extension expects, so integration is mostly SELECT * FROM sap_to_bom_items(...).

Project overview from the community descriptor.

Documentation and resources

Project and build details
Repository
DataZooDE/anofox-similarity
License
BSL 1.1
Maintainers
jrosskopf
Written in
C++
Build source
1f34228d15d7
Build definition
Community descriptor