GS1 Application Identifiers Architecture & Succession Guide
0. Developer Quick-Reference & Cheat Sheet Card
Instant high-frequency terminal commands, routing rules, and API invocation patterns for maintaining the GS1 Application Identifiers tool:
php -S localhost:8080 index.php
curl -s -H "Accept: text/turtle" "http://localhost:8080/01"
curl -s -H "Accept: application/ld+json" "http://localhost:8080/01"
php -l index.php && php -l AIRepository.php
1. Technical Purpose & Standards Enforced
The GS1 Application Identifiers (AI) Reference Tool (published canonically at https://ref.gs1.org/ai) provides an authoritative, dereferenceable Linked Data catalog and interactive browser for all GS1 Application Identifiers. AIs are 2-to-4 digit numerical prefixes defined by the GS1 standard to qualify the meaning, format, and encoding rules of data attributes in 1D and 2D barcodes, RFID EPC tags, and GS1 Digital Link URIs.
https://ref.gs1.org/ai/01). The upgraded tool provides dual-mode server-side rendering with HTTP content negotiation, guaranteeing that web browsers receive high-performance HTML shells with instant First Contentful Paint (<100ms) while software agents and semantic parsers receive RFC-compliant RDF Turtle or JSON-LD graph streams.
Normative Standards Comparison
| Standard Specification | Issuing Body & Release | Clause / Section | Implementation in Codebase |
|---|---|---|---|
| GS1 General Specifications | GS1 AISBL, Release 26 (Jan 2026) | Section 3 (AIs) & Section 5.5 | GS1_Application_Identifiers.jsonld: AI formats, title, regex, and FNC1 delimiter requirements. |
| GS1 Digital Link Standard | GS1 AISBL, Release 1.2 | Section 4.2 & Section 7 | gs1DigitalLinkPrimaryKey and gs1DigitalLinkQualifiers mapping in AIRepository::getAI(). |
| ISO/IEC 15417 | ISO/IEC JTC 1/SC 31 | Code 128 & FNC1 Rules | separatorRequired boolean flag controlling variable-length field FNC1 termination. |
| RFC 7231 / RFC 9110 | IETF | Section 5.3 (Content Negotiation) | getBestMediaType() evaluating Accept header quality values (q= factor). |
| W3C JSON-LD 1.1 | W3C Recommendation | Section 4.1 (@context, @graph) | AIRepository::getAIJsonLd() outputting canonical @context and @graph. |
2. Tech Stack, Dependency BOM & Project Tree
The application implements a clean zero-build, offline-first architecture designed for standard Apache / PHP webservers without Node.js server runtimes or npm compilation steps.
| Component | Version | Role in Architecture | Offline Resilience |
|---|---|---|---|
| PHP Runtime | 8.1+ | Server-side router, content negotiation, graph parser, disk caching, semantic HTML rendering. | Server native |
| Vue.js (Global Build) | 3.2.47 | Client-side reactivity, interactive search/filter, language switching, in-memory SPA navigation. | Vendored locally in vue.min.js |
| GS1 Base Stylesheet | Latest | GS1 brand styles, typography, corporate header layout. | Loaded with fallback inline variables |
| Canonical AI Catalog | 1.2 (Jan 2026) | 541 Application Identifiers, formats, regexes, and Digital Link semantics. | Local GS1_Application_Identifiers.jsonld |
| Multi-Lingual TSV | 2026-07-13 | 15 languages (ar, az, zh-CN, zh-Hant, nl, de, el, en, it, ja, lv, pt, es, th, tr). | Local translatedText2026-07-13.tsv |
Repository Directory Tree Layout
/Users/mgh128/Desktop/ServerSideRendering-ai_ata_tool/
├── .htaccess # Apache clean URL routing & MIME type declarations
├── index.php # SSR bootstrapper, conneg engine & semantic HTML shell
├── AIRepository.php # Graph parser, cache manager, search scorer & Turtle serializer
├── developer-guide.html # Comprehensive architectural handover PWA (this file)
├── user-guide.html # Task-oriented end-user guide PWA
├── GS1_Application_Identifiers.jsonld # Canonical authoritative AI dataset (546 KB)
├── translatedText2026-07-13.tsv # Multi-lingual translations (15 languages, 226 KB)
├── vue.min.js # Local Vue 3.2.47 production build (168 KB, zero CDN)
└── data/
└── ai.cache.json # High-speed pre-indexed JSON binary-like disk cache (1.7 MB)
| AI Code | Data Title | Format String | Description | DL Key | Action |
|---|---|---|---|---|---|
| ({{ ai.code }}) | {{ ai.title }} | {{ ai.format }} |
{{ ai.desc }} | {{ ai.isDL ? 'Yes' : 'No' }} |
3. Inputs, Outputs & Normative Test Vectors
The following table formalizes the syntax levels and accepted representations supported by the tool:
| Syntax Level | Identifier Format | Example Input | Semantic Representation |
|---|---|---|---|
| Numeric Path AI | ^(\d{2,4})$ |
/01 or /3103 |
Resolves specific AI record, renders SSR HTML or streams conneg triples. |
| AI Range Token | ^(\d{3})[ns]$ |
310n (3100–3105) |
Variable measure weight/dimension range with 4th digit decimal index. |
| Element String | \((\d{2,4})\)([^()]+) |
(01)00012345678905(10)ABC123 |
Human-readable interpretation on barcode carrier. |
| GS1 Digital Link URI | /01/{gtin}/10/{batch} |
https://id.gs1.org/01/00012345678905 |
Canonical Web URI representing the trade item using primary key AI (01). |
Normative Test Vectors Matrix & In-Browser Test Runner
| AI | Standard Title | Expected Format | Expected Regex | FNC1 | DL Primary | Validation Status |
|---|---|---|---|---|---|---|
({{ vec.code }}) |
{{ vec.title }} | {{ vec.format }} |
{{ vec.regex }} |
{{ vec.fnc1 ? 'Yes' : 'No' }} | {{ vec.dl ? 'Yes' : 'No' }} | {{ vectorResults[vec.code].pass ? 'PASS (' + vectorResults[vec.code].ms + 'ms)' : 'FAIL' }} Ready |
4. Dual-Mode SSR Lifecycle & Content Negotiation Architecture
The following sequence diagram details the dual-path execution pipeline for crawlers, semantic agents, and interactive web browsers:
HTTP GET Request (e.g. GET /01 or GET /?search=gtin)
│
▼
Apache (.htaccess)
├── 1. Clean Path Rewrite: RewriteRule ^([0-9]{2,4})$ index.php?ai=$1 [QSA,L]
└── 2. MIME Declaration: AddType text/turtle .ttl / AddType application/ld+json .jsonld
│
▼
index.php Bootstrapper & Router
├── Dynamic Base Path Calculation: $basePath = rtrim(dirname($_SERVER['SCRIPT_NAME']), '/')
├── Content Negotiation Evaluator: getBestMediaType($_SERVER['HTTP_ACCEPT']) with q-factor
└── AIRepository Instantiation: In-memory cache restoration via data/ai.cache.json
│
├────────────────────────────────────────┬────────────────────────────────────────┐
▼ ▼ ▼
Accept: text/turtle Accept: app/ld+json Accept: text/html
│ │ │
▼ ▼ ▼
Stream Turtle Triples Stream JSON-LD Graph Render Semantic HTML Shell
│ │ ├── Pre-render Title & Meta
▼ ▼ ├── Pre-render Table Rows
HTTP 200 (text/turtle) HTTP 200 (application/ld+json) ├── Inject __INITIAL_STATE__
│ (basePath, aiData, msgs)
▼
Client Browser Paints Fast FCP
│
▼
Vue 3 Mounts & Hydrates
├── isHydrated = true
├── Hide SSR tbody
└── Setup Click Interception
Regex Constants & Character Set Deconstruction
| Regex Constant | Pattern Breakdown | Character Class Scope | GS1 Standard Rationale |
|---|---|---|---|
^(\d{2,4})$ |
2 to 4 decimal digits | ASCII 0–9 |
Validates Application Identifier numeric key codes (GS1 General Specs §3.2). |
(\d{14}) |
Exact 14 numeric digits | Fixed-length 14-digit GTIN | Enforces GTIN-14 structure including Modulo-10 check digit. |
([!%-?A-Z_a-z\x22]{1,28}) |
1 to 28 characters from GS1 set 82 | !, % through ?, A–Z, _, a–z, " |
Matches GS1 Table 7.1.1-1 alphanumeric character set 82 for variable data. |
\b(\d{2,4})\b |
Word-boundary bounded AI token | Exact 2-4 digit token | Extracts AI codes from logic expressions (e.g. 01 OR 02) to hyperlink them. |
5. Engine Codecs & Algorithmic Mechanics
GS1 Application Identifiers implement specific data processing mechanics, including dynamic decimal place indexing and Modulo-10 check digit validation.
Dynamic Decimal Indexing Algorithm for Ranges (AIs 310n–369n)
In GS1 measurement AIs (such as AI 310n for net weight in kilograms), the fourth digit n is a variable indicator representing the number of decimal positions:
- Integer digits count:
6 − n - Fractional decimal digits count:
n(valid range: 0 through 5) - Example: AI
3102→n = 2→ 4 integer digits, 2 decimal digits →nnnn.nn kilograms.
{{ activePlaygroundRecord.formatString }}
{{ generatedTurtleOutput }}
6. Complete Codebase Reference Index
Exhaustive method catalog detailing all public and internal routines across AIRepository.php and client controllers:
{{ method.desc }}
| Parameter | Type | Description |
|---|---|---|
{{ param.name }} |
{{ param.type }} |
{{ param.desc }} |
{{ method.returnType }} — {{ method.returnDesc }}
{{ method.snippet }}
7. UI Components & Reactive State Exploration
Dictionary of reactive state properties managed by the Vue 3 Options API application:
| Property | Type | Default Value | Reactive Role |
|---|---|---|---|
basePath |
String | "" |
Base directory path dynamically resolved from server environment. |
selectedAI |
String | "" |
Currently selected AI code for single-term inspection (e.g. "01"). |
searchKeyword |
String | "" |
Live keyword/AI numeric search query. |
rangeCollapseExpand |
String | "expanded" |
Controls whether ranges are displayed individually or collapsed into ranges. |
preferredLanguage |
String | "en" |
Current active UI translation language code. |
isHydrated |
Boolean | false |
Controls transition from server-rendered HTML to reactive client DOM. |
8. Maintenance, Extension & Succession Guide
How to Add a New GS1 Application Identifier
- Open
GS1_Application_Identifiers.jsonldin an editor. - Locate the
applicationIdentifiersarray. - Add a new JSON node with:
applicationIdentifier,formatString,description,regex,title,separatorRequired,components,requires,excludes,gs1DigitalLinkPrimaryKey. - If translations are available, add a new row in
translatedText2026-07-13.tsvwith matching AI code in column 1. - Delete or touch
data/ai.cache.json; the repository will auto-detect the modification and rebuild the cache on the next request.
Troubleshooting & Error Matrix
| Symptom / Error | Root Cause | Resolution Procedure |
|---|---|---|
| Stale AI records after JSON-LD edit | Cache file data/ai.cache.json has newer timestamp than source. |
Delete data/ai.cache.json or run touch GS1_Application_Identifiers.jsonld. |
| Blank table in No-JS environment | HTML5 <template> tag used around server-rendered rows. |
Ensure <tbody v-if="!isHydrated"> is used rather than inert <template>. |
Wrong decimal point in 310n note |
Fourth digit not evaluated as integer offset. | Verify AIRepository::processNote() extracts digit 4 and calculates 6 - digit. |