Semantic Entity Architecture (JSON-LD)
Relevant source files
The following files were used as context for generating this wiki page:
Semantic Entity Architecture manages structured data to enhance machine discovery and search engine visibility. It transforms internal data models into standardized JSON-LD (JavaScript Object Notation for Linked Data) structures, primarily using the @graph format. This architecture enables AI agents, search engines, and knowledge graphs to understand the relationships between the company, its services, products, and technical content.
The system centralizes schema generation within the SeoService, which dynamically injects structured data into the document head based on the active route or specific entity being viewed. This approach supports project goals for AI Search & Discovery Transformation, including Artificial Intelligence Optimization (AIO) and Knowledge Graph Optimization (KGO).
Sources: task.md:1-12, sunrise-angular/src/app/core/services/seo.service.ts:1-15
Core Components and Data Flow
The architecture relies on the SeoService to orchestrate metadata and schema updates. When a user navigates to a route or an entity component initializes, the service assembles relevant schema nodes into a unified @graph array.
Schema Generation Flow
The diagram shows how the SeoService centralizes schema node assembly, ensuring every page includes a base LocalBusiness node linked to specific entity nodes.
Sources: sunrise-angular/src/app/core/services/seo.service.ts:39-250
Key Functions
| Function | Purpose | Schema Nodes Generated |
|---|---|---|
getBaseLocalBusinessNode() | Generates the core entity for Sunrise Communication. | LocalBusiness, SecuritySystemInstallationService |
updateForServiceCluster() | Maps service vertical data to semantic nodes. | Service, OfferCatalog, FAQPage, HowTo, BreadcrumbList |
updateForProduct() | Describes specific hardware items. | Product, Offer, Brand, BreadcrumbList |
updateForTechnicalGuide() | Converts articles into machine-readable knowledge. | Article, FAQPage, BreadcrumbList |
updateForCctvCalculator() | Defines technical utility tools. | WebApplication, FAQPage, HowTo |
Sources: sunrise-angular/src/app/core/services/seo.service.ts:55-320
Entity Relationships and Schema Nodes
The architecture links various entities to the root LocalBusiness node using unique @id identifiers (e.g., /#localbusiness). This creates a connected knowledge graph rather than isolated data fragments.
Semantic Graph Structure
This diagram illustrates the relational hierarchy defined within the injectGraph logic, where all primary entities cite the LocalBusiness as the provider or publisher.
Sources: sunrise-angular/src/app/core/services/seo.service.ts:68-80, sunrise-angular/src/app/core/services/seo.service.ts:168-175
LocalBusiness Node Details
The LocalBusiness node serves as the foundation of the architecture. It contains critical geographic and contact data:
- Geo-Coordinates:
19.1868Latitude,72.9757Longitude. - Area Served: Thane, Mumbai, and Navi Mumbai regions.
- Ratings:
AggregateRatingwith a5.0value and93reviews. - Hours: 24/7 operating hours via
OpeningHoursSpecification.
Sources: sunrise-angular/src/app/core/services/seo.service.ts:326-415, task.md:13-15
Automated Entity Injection
The architecture utilizes Angular Effect and Lifecycle hooks to ensure schema injection occurs automatically upon data resolution.
Injection Logic in Components
Components like GuideDetailComponent use a signal-based effect to trigger the SeoService. This ensures that if the guide data updates (e.g., via route parameter change), the JSON-LD in the document head reflects the new entity immediately.
// From sunrise-angular/src/app/pages/guides/guide-detail/guide-detail.component.ts
constructor() {
effect(() => {
const g = this.guide();
if (g) {
let pageUrl = `${this.siteData.contact.website}/guides/${g.slug}`;
if (isPlatformBrowser(this.platformId) && this.document.location?.href) {
pageUrl = this.document.location.href;
}
this.seoService.updateForTechnicalGuide(g, pageUrl);
}
});
}
Sources: sunrise-angular/src/app/pages/guides/guide-detail/guide-detail.component.ts:36-46
DOM Manipulation
The SeoService manages a single <script type="application/ld+json"> element. If the element exists, the service updates its textContent; otherwise, it creates the element and appends it to the <head>.
// From sunrise-angular/src/app/core/services/seo.service.ts
private injectGraph(nodes: any[]) {
const payload = {
'@context': 'https://schema.org',
'@graph': nodes
};
if (!this.jsonLdScript) {
const existing = this.document.querySelector('script[type="application/ld+json"]');
if (existing) {
this.jsonLdScript = existing as HTMLScriptElement;
} else {
this.jsonLdScript = this.document.createElement('script');
this.jsonLdScript.type = 'application/ld+json';
this.document.head.appendChild(this.jsonLdScript);
}
}
this.jsonLdScript.textContent = JSON.stringify(payload);
}
Sources: sunrise-angular/src/app/core/services/seo.service.ts:468-486
Summary of Specialized Schemas
The architecture implements specialized schemas to target Answer Engine Optimization (AEO) and mobile search features.
- HowTo Schema: Used in Service Clusters to detail the "Turnkey Installation Lifecycle," including site audit, cabling, mounting, and testing steps.
- FAQPage Schema: Injected into guides, services, and tools to provide direct answers for voice search and "People Also Ask" boxes.
- BreadcrumbList: Dynamically generated for every deep-link to provide hierarchical context to crawlers.
- WebApplication Schema: Specifically applied to the CCTV Storage Calculator to define it as a utility tool with
price: 0.
Sources: sunrise-angular/src/app/core/services/seo.service.ts:101-140, sunrise-angular/src/app/core/services/seo.service.ts:208-228