ontoloji.orgOpen Reference Hub
ERP Data Engineering14 min read·Updated: 2026-12-03·Türkçe sürüm →

Logo Tiger & Nebim V3 SQL Schemas: Polymorphic Joins & Turkish Unicode Traps in AI

Solving firm/period table sharding, context-dependent TRCODE/MODULENR routing, 6-column SKU variant keys, and silent İ/ı NFKD failures with an enterprise ontology.

Executive Summary — Key Takeaways
  • 01In Logo Tiger/GO, integer TRCODE values change meaning across tables and MODULENR contexts (e.g., wholesale sales invoice is TRCODE=8 in INVOICE, but TRCODE=38 with MODULENR=4 in CLFLINE).
  • 02In Nebim V3 retail/apparel databases, SKU identity requires a 6-column composite join (ItemTypeCode + ItemCode + ColorCode + ItemDim1..3), and retail PII columns return ciphertext when encryption is licensed.
  • 03Turkish text and locale defects fail silently without throwing exceptions: "İ".lower() produces "i" + U+0307 (breaking ASCII dictionary keys), and 1.000,42 flips Anglo thousand/decimal separators by three orders of magnitude.

1. Logo Tiger / GO: Firm-Period Sharding, Polymorphic Refs & Triple Currency Layers

Logo Tiger and GO organize SQL Server tables across three scopes: firm-and-period transaction tables (LG_001_01_STFICHE, LG_001_01_STLINE, LG_001_01_INVOICE, LG_001_01_CLFLINE, LG_001_01_ORFLINE), firm-level master cards (LG_001_ITEMS, LG_001_CLCARD, LG_001_UNITSETL), and system-wide tables (L_CAPIDEF, L_DAILYEXCHANGES). Raw Text-to-SQL agents routinely break across fiscal rollovers or multi-year comparisons.

Even within a single period, foreign-key references are polymorphic and conditional on type discriminators:

  • Polymorphic STOCKREF: On STLINE and ORFLINE, STOCKREF points to LG_XXX_ITEMS.LOGICALREF only on material lines (LINETYPE = 0); when LINETYPE = 4, the exact same integer column references a service card (SRVCARD), and when LINETYPE = 2, a discount card. Unconditional joins corrupt line-level margins.
  • TRCODE + MODULENR Context Shift: A wholesale sales invoice carries TRCODE = 8 in INVOICE, yet appears in the AR/AP ledger CLFLINE as MODULENR = 4 and TRCODE = 38. Meanwhile CLFLINE.SOURCEFREF routes to INVOICE (MODULENR=4), CLFICHE (MODULENR=5), or BNFLINE (MODULENR=7).
  • Three Parallel Currency Layers: Lines carry transaction currency (TRCURR, TRRATE, TRNET), reporting currency (REPORTRATE, REPORTNET), and pricing currency (PRCURR, PRPRICE) side by side.
Encoding Logo Tiger polymorphic routing & TRCODE rules in an ontology
entity LedgerEntry {
  source: LOGO.LG_{firm}_{period}_CLFLINE where CANCELLED == 0
  polymorphic_link source_document {
    when MODULENR == 4 -> SalesOrPurchaseInvoice via (SOURCEFREF == INVOICE.LOGICALREF)
    when MODULENR == 5 -> CurrentAccountVoucher  via (SOURCEFREF == CLFICHE.LOGICALREF)
    when MODULENR == 7 -> BankTransaction        via (SOURCEFREF == BNFLINE.LOGICALREF)
  }
  metric wholesale_receivable_net: sum(TRNET)
    where MODULENR == 4 and TRCODE == 38 and SIGN == 0
}

2. Nebim V3: 6-Column Variant Keys, Encrypted PII & the Integrator Boundary

Widely deployed across apparel, retail, footwear, and optics, Nebim V3 separates shared report metadata (NebimV3Master), operational logs (NebimV3EventLog), and per-company SQL Server databases using strict table prefixes: cd* (master cards plus language-keyed *Desc twins), pr* (variants, barcodes, attributes), tr* (orders, reservations, shipments, invoices), and st* (stOrder, stReserve open quantities).

A variant SKU across prItemVariant, prItemBarcode, trStock, and ItemInventory is uniquely keyed by six columns: ItemTypeCode + ItemCode + ColorCode + ItemDim1Code (Size) + ItemDim2Code + ItemDim3Code (with unused dimensions stored as empty strings). Joining on ItemCode alone triggers massive 1:N fan-out across colors and sizes. Furthermore, writes must flow through the official Nebim V3 Integrator API rather than raw SQL inserts that bypass validation.

3. Six Silent Turkish Unicode & Number-Parsing Traps in AI Pipelines

Multilingual AI pipelines processing Turkish ERP headers, PDFs, and spreadsheets encounter bugs that never raise an exception—they simply return empty lookups or numbers off by 1,000x:

  • Dotted Capital İ (U+0130) Combining Mark: Standard .lower() maps "İ" to "i" + U+0307 (combining dot above), not plain "i". A header like "AÇIKLAMA GEREKSİNİMİ" silently misses every plain-ASCII dictionary key unless you normalize with NFKD and strip combining marks.
  • Non-Invertible Case Folding (i ↔ İ, ı ↔ I): Calling locale-unaware .upper() on "belirlenecek" yields dotless "BELIRLENECEK", failing to match "BELİRLENECEK" status sentinels.
  • NFD Filesystem & PDF Extraction: macOS paths and PDF extractors emit decomposed UTF-8 ("u" + U+0308 instead of "ü"). Normalize to NFC at the ingestion boundary.
  • Inverted Thousand/Decimal Separators (1.000.000 vs 0,4210): Period marks thousands and comma marks decimals, while regex \d matches non-ASCII digits. Parse explicitly with [0-9] rules.
  • Never Verify Fidelity Through a Match Fold: Keep the folded lookup key separate from the verbatim display string—otherwise an ASCII-mangled quote passes verification as "exact".
Post-Condition Defense Rule

Never trust string normalization without post-conditions: assert every schema key lookup returns non-empty, and assert both sides of any cross-source reconciliation read non-empty before interpreting differences.

Glossary Concepts Referenced in This Guide

Open License (CC BY 4.0) · Cite This Page

Free to reference in engineering docs, ADRs, articles, and course syllabi with attribution.

[Logo Tiger & Nebim V3 SQL Schemas: Polymorphic Joins & Turkish Unicode Traps in AI — Ontoloji.org](https://ontoloji.org/en/guides/logo-tiger-nebim-v3-sql-schema-and-turkish-unicode-traps)

More Guides in This Series

Core Architecture
How AI Uses an Ontology
9 min read
Agent Engineering
Agent Harness vs. Ontology
8 min read
Data Engineering
ERP, CRM & MES Patterns
10 min read
Strategy & Governance
30-Day Ontology Strategy
7 min read
ERP Integration
ERP Ontology Integration Guide
11 min read
Agent Governance
Adversarial Verification, Permissions & Compaction
13 min read
Verification Engineering
Absence-Aware Gates & Ratio Reconstruction
13 min read
Provenance & Governance
Draft vs. Normative Provenance Hygiene
12 min read
SAP & Protocol Architecture
SAP BTP, Cloud Connector & ORD Ontology
11 min read
ERP Write-Safety
Logo REST, Nebim Integrator & UBL-TR Safety
12 min read
Platform Architecture Comparison
Cortex, Genie, dbt & Cube vs. Ontology
12 min read
Systems Engineering & Forensics
ERP Integrator Anti-Patterns & Forensics
13 min read
Platform Architecture Comparison
Fabric IQ, D365 MCP & SAP Joule vs. Ontology
12 min read
Retrieval & RAG Architecture
PageIndex Vectorless Tree RAG vs. Vector DBs
11 min read
Platform Architecture Comparison
Atlan, Stardog & Neo4j vs. Ontology
12 min read
Statutory & Financial Governance
GİB UBL-TR, VUK/TMS 29 & KVKK Ontology
13 min read
Agent Memory & Ontology Architecture
Cognee & Zep Graphiti vs. Ontology
11 min read
Protocol & Multi-Agent Architecture
MCP vs. OpenAPI & Specialist Agents
12 min read
Protocols & Standards
MCP 2026-07-28: Tasks, Events & Apps
13 min read
Agent Architecture & Governance
Agent Harness Engineering Rubric
12 min read
Agent Architecture & Governance
Multi-Agent Task Boards & Mailboxes
12 min read
Verification & Security
Generate-Evaluate-Repair & Observers
12 min read
Verification & Security
NSA MCP Security & CIMD vs. DCR
13 min read
Agent Architecture & Governance
OpenTelemetry for AI Agents & MCP
11 min read