| # Debug: Understanding the Validation Flow | |
| ## Your Sample RDF | |
| ```xml | |
| <bf:Work rdf:about="http://example.org/work/invalid-1"> | |
| <rdf:type rdf:resource="http://id.loc.gov/ontologies/bibframe/Text"/> | |
| <bf:title>Incomplete Title</bf:title> | |
| </bf:Work> | |
| ``` | |
| ## Expected Validation Errors | |
| ### From Monograph_Work_Text.tsv | |
| - Missing `bf:language` (required) | |
| - Missing `bf:content` (required) | |
| - Missing `bf:adminMetadata` (required) | |
| - Invalid `bf:title` structure (should be nested with bf:Title/bf:mainTitle) | |
| ### From Monograph_AdminMetadata.tsv | |
| **Should NOT report errors** because there is NO AdminMetadata node to validate! | |
| ## The Confusion | |
| If you see: | |
| ``` | |
| === Module: MonographDCTAP/Monograph_AdminMetadata.tsv === | |
| Message: Less than 1 values on [...]->bf:assigner | |
| ``` | |
| This means AdminMetadata EXISTS somewhere. Possible causes: | |
| 1. **First correction attempt added AdminMetadata** (without assigner) | |
| 2. **Different RDF** was being validated | |
| 3. **Cached intermediate result** from a previous run | |
| ## Rapid Fix Logic | |
| ```python | |
| missing = ["language", "content", "adminMetadata"] | |
| # For each missing property: | |
| if "adminMetadata" in missing: | |
| # Check: does AdminMetadata already exist? | |
| if "<bf:adminMetadata>" NOT in content: | |
| # NO β Add complete AdminMetadata block (includes assigner) | |
| fixes.append(INSTANT_FIXES["adminMetadata"]) | |
| else: | |
| # YES β Don't add duplicate | |
| pass | |
| if "assigner" in missing: | |
| # Check: does AdminMetadata exist? | |
| if "<bf:AdminMetadata>" in content: | |
| # YES β Inject assigner into existing AdminMetadata | |
| content = inject_assigner(content) | |
| else: | |
| # NO β Skip (will be added with full adminMetadata block) | |
| pass | |
| ``` | |
| ## What Should Happen with Your Sample | |
| **First validation:** | |
| ``` | |
| Missing: title (structure), language, content, adminMetadata | |
| ``` | |
| **Rapid fix adds:** | |
| - β Title (needs AI - complex structure change) | |
| - β language (instant template) | |
| - β content (instant template) | |
| - β adminMetadata (instant template - INCLUDES assigner already) | |
| **Re-validation should show:** | |
| - Title structure issue (still present) | |
| - NO adminMetadata errors | |
| - NO assigner errors (because adminMetadata includes it) | |
| ## Key Question | |
| **Where did you see the assigner error?** | |
| Was it: | |
| - A) First validation of your sample? β Shouldn't happen | |
| - B) Re-validation after correction? β Possible if rapid fix had bug | |
| - C) Different RDF file? β Most likely | |
| Check the RDF that produced the assigner error - does it have `<bf:adminMetadata>` tags? | |