/* * SPDX-License-Identifier: AGPL-3.0-or-later * Copyright (C) 2025 Sergej Görzen * This file is part of OmiLAXR.xAPI. */ #if XAPI_REGISTRY_EXISTS using OmiLAXR.Composers.HigherComposers; using xAPI.Registry; namespace OmiLAXR.xAPI.Composers.HigherComposers { /// /// Abstract base class for semantic-level xAPI composers that operate on pipeline data. /// Provides higher-order composition capabilities by analyzing patterns across multiple /// statements or tracking behaviors to generate semantic learning analytics insights /// that go beyond individual interaction events to capture learning progress and understanding. /// /// Type of pipeline that serves as the actor source for semantic analysis public abstract class xApiSemanticComposer : HigherComposer where TActorOfPipeline : Pipeline { /// /// Provides access to xAPI Registry contexts for creating standardized semantic statements. /// Enables semantic composers to generate statements using consistent xAPI vocabulary /// for complex learning analytics scenarios like competency assessment and learning progression. /// protected readonly xAPI_Contexts xapi = new xAPI_Contexts(); /// /// Statement builder configured with URI and author information for semantic statement creation. /// Pre-configured builder that semantic composers can use to generate statements /// with consistent metadata and proper xAPI Registry integration. /// protected xApiStatement.Builder actor; /// /// Reference to the target pipeline that provides the data source for semantic analysis. /// Enables semantic composers to access and analyze patterns from the pipeline's /// statement history and tracking data for higher-order learning insights. /// protected TActorOfPipeline targetPipeline; /// /// Base URI for resolving xAPI identifiers in semantic statements. /// Provides namespace context for generating properly formatted xAPI IRIs /// that ensure semantic statement compatibility with xAPI Registry definitions. /// protected string Uri = ""; /// /// Virtual method for retrieving the current URI context. /// Allows derived semantic composers to override URI resolution logic /// for specific semantic analysis scenarios or custom identifier schemes. /// /// Current base URI for xAPI identifier resolution protected virtual string GetUri() => Uri; public xApiRegistry Registry { get; protected set; } public override string GetDataStandardVersion() => Registry.version; /// /// Unity Awake method that initializes semantic composer dependencies and configuration. /// Sets up URI context from parent xApiRegistry, establishes pipeline connection, /// and prepares the statement builder with proper metadata for semantic statement generation. /// protected virtual void Awake() { // Retrieve global URI configuration from parent xAPI Registry Registry = GetComponentInParent(); if (Registry && Registry.enabled) Uri = Registry.uri; // Establish connection to target pipeline for data access targetPipeline = GetPipeline(); // Initialize statement builder with URI context and author metadata actor = new xApiStatement.Builder(GetUri(), GetAuthor(), this); } } } #endif