Fix CTDL-ASN detection: support context arrays and embedded structures (fixes #1408, fixes #1410)#1409
Open
nphoenix wants to merge 4 commits intocassproject:masterfrom
Open
Fix CTDL-ASN detection: support context arrays and embedded structures (fixes #1408, fixes #1410)#1409nphoenix wants to merge 4 commits intocassproject:masterfrom
nphoenix wants to merge 4 commits intocassproject:masterfrom
Conversation
Support context arrays and embedded competencies
comply with lint
Added functions to convert embedded CTDL-ASN structures to @graph format for backend compatibility. Enhanced JSON-LD analysis to support both @graph and embedded structures. - Add convertToGraphStructure() to handle embedded ceterms:competencies - Modify importJsonLd() to convert before sending to backend - Enhance comments documenting PR cassproject#1408 fixes - Works around backend limitation requiring @graph format Fixes: no @graph created, unsure how to parse error Related: cassproject#1408, cassproject#1410"
…petencies Fixes three critical issues with CTDL-ASN framework imports: 1. Enhanced CTDL-ASN Detection - Handles @context as both array and string formats - Detects embedded ceterms:competencies structures - Identifies CTDL-ASN files with various structural patterns 2. Added @graph Conversion - Converts embedded competencies to @graph format required by backend - Preserves existing @graph structures unchanged - Handles CompetencyFramework, ConceptScheme, ProgressionModel, Collection 3. Fixed File Upload Bug - File uploads now convert to @graph before backend (previously only URLs did) - Refactored to use sendData() helper for consistent processing
|
Author
|
This PR now includes fixes for both:
EDITABLE_-_ICICLE_Learning_Engineering_Competency_Framework_CTDL-ASN_2025-12-26.jsonld.txt |
Author
|
Update: My issue is resolved through fixing TLA Toolbox export compliance (see #1410 for details). I'm leaving this PR open for the CASS team to decide if they want to merge it for handling non-compliant imports from other tools. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Fixes CTDL-ASN file detection to support context arrays and embedded competency structures, enabling import of standards-compliant files.
Fixes #1408 and #1410
Problem
CTDL-ASN files fail to import with errors:
Both structures are valid per the CTDL-ASN specification but are currently rejected by CASS.
Root Cause
The
analyzeJsonLdFramework()function insrc/mixins/import.js(lines 502-535) has two bugs:@context === "https://credreg.net/ctdl...", which fails when @context is an array (valid per JSON-LD spec)@graphstructure, rejecting valid embeddedceterms:competenciesarraysSolution
Updated
analyzeJsonLdFramework()to:@contextto handle both strings and arrays@graphand embeddedceterms:competenciesstructuresCode Changes
File:
src/mixins/import.jsFunction:
analyzeJsonLdFramework()(lines 502-535)Key changes:
Testing Results
Before Fix
After Fix
Known Limitations
This PR fixes the detection phase of CTDL-ASN import. Additional bugs remain in the import execution phase that will require separate fixes:
.jsonfiles needs improvementHowever, this fix is a critical first step - without proper detection, import cannot proceed at all.
Impact
Immediate benefits:
Standards compliance:
Testing
Tested with multiple CTDL-ASN file variations:
All variations now detect correctly.
This PR addresses an interoperability issue preventing import of standards-compliant CTDL-ASN files into CASS.
TEST-01-ORIGINAL.jsonld.txt
TEST-05-MINIMAL-2-competencies.jsonld.txt