@kanonak-protocol/sdk 4.14.0 → 4.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,25 +1,25 @@
1
- import{a as v,b as Le,c as at,g as M,j as it,l as S}from"./chunk-R73T4RUO.js";import{a as nt}from"./chunk-NJ3AZYQD.js";import{a as d,d as x,e as Y,f as st,g as L,h as ct}from"./chunk-2HNPPYSK.js";import{a as G}from"./chunk-6U26UASC.js";import{h as Be}from"./chunk-WGKIRLMA.js";import{c as y,d as I,j as Me,k as H,l as F,m as K,n as z,p as P,r as k,t as J,u as w,v as W,w as g,x as O,y as V}from"./chunk-7BHDZHJY.js";import{a as rt}from"./chunk-FUUTGGJS.js";import{e as $}from"./chunk-2ACBWC7K.js";var Q=class{isValid=!1;errors=[];warnings=[];get totalIssues(){return this.errors.length+this.warnings.length}};var h=(t=>(t.Warning="Warning",t.Error="Error",t))(h||{});var u=class{ruleType="";severity="Error";lineNumber;column;entityName;propertyName;propertyPath;message="";suggestion;actualValue;expectedValue;toString(){let e="";return this.lineNumber!==void 0&&(e+=`Line ${this.lineNumber}: `),this.entityName&&(e+=`[${this.entityName}] `),e+=this.message,e}};var qe=class c{resolvedDocuments=[];currentEntityPath;withPath(e){let t=new c;return t.resolvedDocuments=this.resolvedDocuments,t.currentEntityPath=e,t}};var ee=class{constructor(e){this.underlying=e;this.repository=new ze(e)}underlying;repository;parsePromise=null;getKanonaks(){return this.parseOnce().then(e=>e.merged)}getAuthoredKanonaks(){return this.parseOnce().then(e=>e.authored)}parseOnce(){return this.parsePromise||(this.parsePromise=(async()=>{let e={};return{merged:await new S().parseKanonaks(this.underlying,e),authored:e.authored??[]}})()),this.parsePromise}},ze=class{constructor(e){this.inner=e}inner;highestVersionCache=new Map;byNamespaceCache=new Map;getAllDocumentsAsync(){return this.inner.getAllDocumentsAsync()}getDocumentAsync(e){return this.inner.getDocumentAsync(e)}getDocumentsByNamespaceAsync(e,t){let o=`${e}/${t}`,n=this.byNamespaceCache.get(o);return n||(n=this.inner.getDocumentsByNamespaceAsync(e,t),this.byNamespaceCache.set(o,n),n)}getHighestCompatibleVersionAsync(e,t){let o=t.version,n=o?`${o.major}.${o.minor}.${o.patch}`:"",r=`${e}/${t.packageName}@${t.versionOperator}:${n}`,a=this.highestVersionCache.get(r);return a||(a=this.inner.getHighestCompatibleVersionAsync(e,t),this.highestVersionCache.set(r,a),a)}saveDocumentAsync(){throw new Error("CachingRepository is read-only during a validation pass.")}deleteDocumentAsync(){throw new Error("CachingRepository is read-only during a validation pass.")}clearNamespaceAsync(){throw new Error("CachingRepository is read-only during a validation pass.")}getAllDocumentReferencesAsync(){return this.inner.getAllDocumentReferencesAsync()}getDocumentContentAsync(e){return this.inner.getDocumentContentAsync(e)}getDocumentUriAsync(e){return this.inner.getDocumentUriAsync(e)}};async function D(c,e,t){return t?t.getKanonaks():new S().parseKanonaks(new te(c,e))}async function C(c,e,t){let o=await D(c,e,t),n=Fe(c);return n?o.filter(r=>r instanceof y&&r.namespace===n):[]}async function oe(c,e,t){let o=Fe(c);if(!o)return[];let n;if(t)n=await t.getAuthoredKanonaks();else{let r={};await new S().parseKanonaks(new te(c,e),r),n=r.authored??[]}return n.filter(r=>r instanceof y&&r.sourceDoc===o)}function q(c,e){for(let t of c)t instanceof y&&Xe(t,t.name,e)}function Xe(c,e,t){t({kanonak:c,path:e});for(let o of c.statement)if(o instanceof H)Xe(o.object,pt(e,o.object),t);else if(o instanceof F)for(let n of o.object)n instanceof v&&Xe(n,pt(e,n),t)}function pt(c,e){let t=e instanceof v&&e.name?e.name:"<embedded>";return`${c}/${t}`}function Fe(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${$(e.version)}`}var te=class{constructor(e,t){this.document=e;this.broader=t}document;broader;async getAllDocumentsAsync(){let e=this.document.metadata.namespace_?.toString(),t=(await this.broader.getAllDocumentsAsync()).filter(o=>o.metadata.namespace_?.toString()!==e);return[this.document,...t]}getDocumentAsync(e){return this.broader.getDocumentAsync(e)}getDocumentsByNamespaceAsync(e,t){return this.broader.getDocumentsByNamespaceAsync(e,t)}getHighestCompatibleVersionAsync(e,t){return this.broader.getHighestCompatibleVersionAsync(e,t)}getAllDocumentReferencesAsync(){return this.broader.getAllDocumentReferencesAsync()}getDocumentContentAsync(e){return this.broader.getDocumentContentAsync(e)}getDocumentUriAsync(e){return this.broader.getDocumentUriAsync(e)}saveDocumentAsync(){throw new Error("DocumentWithRepositoryCatalog is read-only")}deleteDocumentAsync(){throw new Error("DocumentWithRepositoryCatalog is read-only")}clearNamespaceAsync(){throw new Error("DocumentWithRepositoryCatalog is read-only")}};var ne=class c{static NAMESPACE_PREFIX_PATTERN=/^(rdfs|xsd|owl|rdf|dc|foaf|skos|dct|dcterms|geo|time|prov|schema|og|dbo):/i;ruleName="NamespacePrefix";validate(e){let t=[];for(let[o,n]of Object.entries(e.body))n&&typeof n=="object"&&!Array.isArray(n)&&this.validateEntity(o,n,t);return t}validateEntity(e,t,o){for(let[n,r]of Object.entries(t)){let a=r?.toString()??"";if(a&&c.NAMESPACE_PREFIX_PATTERN.test(a)){let i=this.getSuggestionForPrefixedValue(a),s=e.split(".")[0],p=new u;p.ruleType=this.ruleName,p.severity="Error",p.entityName=s,p.propertyName=e,p.actualValue=n,p.expectedValue=i,p.message=`Invalid namespace prefix '${a}'. Use '${i}' without prefix.`,p.suggestion="Kanonak YAML uses simple type names. Namespace resolution is handled through imports.",o.push(p)}r&&typeof r=="object"&&!Array.isArray(r)&&this.validateEntity(`${e}.${n}`,r,o)}}getSuggestionForPrefixedValue(e){let t=e.toLowerCase();if(t==="rdfs:class"||t==="owl:class")return"Class";if(t==="rdfs:property"||t==="rdf:property")return"DatatypeProperty or ObjectProperty";if(t.startsWith("xsd:"))return e.substring(4);let o=e.indexOf(":");return o>=0?e.substring(o+1):e}};var re=class c{static RESERVED_WORDS=new Set(["imports","namespace","type","label","comment","subclassof","domain","range","required","functional"]);static VALID_PROPERTIES=new Set(["type","label","comment","subClassOf","subPropertyOf","domain","range","required","functional","inverseOf","transitive","symmetric","inverseFunctional"]);static VALID_NAME_PATTERN=/^[a-zA-Z][a-zA-Z0-9_-]*$/;static VALID_AUGMENTATION_PATTERN=/^[a-zA-Z][a-zA-Z0-9_-]*\.[a-zA-Z][a-zA-Z0-9_-]*$/;static VALID_PROPERTY_NAME_PATTERN=/^[a-zA-Z][a-zA-Z0-9_.]*$/;ruleName="ResourceNaming";validate(e){let t=[],o=e.metadata?.namespace_?.publisher==="kanonak.org"&&e.metadata?.namespace_?.package_?.startsWith("core-");for(let[n,r]of Object.entries(e.body)){let a=c.VALID_AUGMENTATION_PATTERN.test(n);if(!a&&!o&&c.RESERVED_WORDS.has(n.toLowerCase())){let i=new u;i.ruleType=this.ruleName,i.severity="Error",i.entityName=n,i.message=`Entity name '${n}' is a reserved word and cannot be used.`,i.suggestion="Choose a different name that doesn't conflict with Kanonak reserved words.",t.push(i);continue}if(!a&&!c.VALID_NAME_PATTERN.test(n)){let i;/^\d/.test(n)?i="Entity names must start with a letter, not a number.":n.includes(" ")?i="Entity names cannot contain spaces. Use camelCase or underscores instead.":i="Entity names must start with a letter and contain only letters, numbers, and underscores.";let s=new u;s.ruleType=this.ruleName,s.severity="Error",s.entityName=n,s.message=`Invalid entity name '${n}'. ${i}`,s.suggestion=i,t.push(s)}r&&typeof r=="object"&&!Array.isArray(r)&&this.validatePropertyNames(n,r,t)}return t}validatePropertyNames(e,t,o){for(let n of Object.keys(t))if(!c.VALID_PROPERTIES.has(n)&&!c.VALID_PROPERTY_NAME_PATTERN.test(n)){let r=new u;r.ruleType=this.ruleName,r.severity="Warning",r.entityName=e,r.propertyName=n,r.message=`Property name '${n}' in entity '${e}' doesn't follow naming conventions.`,r.suggestion="Property names should start with a letter and contain only letters, numbers, and underscores.",o.push(r)}}};var ae=class c{static XSD_TYPES=new Set(["string","integer","int","long","short","byte","decimal","float","double","boolean","bool","datetime","date","time","duration","anyuri","anysimpletype","nonnegativeinteger","positiveinteger","negativeinteger","nonpositiveinteger","unsignedint","unsignedlong","unsignedshort","unsignedbyte","base64binary","hexbinary"]);ruleName="PropertyTypeSpecificity";validate(e){let t=[];if(e.metadata?.namespace_?.publisher==="kanonak.org"&&e.metadata?.namespace_?.package_?.startsWith("core-"))return t;let o=this.isPropertyDefinedAsClass(e);for(let[n,r]of Object.entries(e.body))if(r&&typeof r=="object"&&!Array.isArray(r)){let a=r,i=a.type;if(i){let s=[];if(Array.isArray(i))for(let p of i){let l=p?.toString();l&&l==="Property"&&!o&&s.push(l)}else{let p=i?.toString();p&&p==="Property"&&!o&&s.push(p)}for(let p of s){let l=this.getPropertyValue(a,"range"),m=this.determinePropertyType(l),f=new u;f.ruleType=this.ruleName,f.severity="Error",f.entityName=n,f.propertyName="type",f.actualValue=p,f.expectedValue=m,f.message=`Invalid property type '${p}'. Use '${m}' instead.`,f.suggestion="Properties should specify their type: DatatypeProperty for data values, ObjectProperty for relationships.",t.push(f)}}}return t}determinePropertyType(e){return!e||e.trim().length===0?"DatatypeProperty or ObjectProperty":c.XSD_TYPES.has(e.toLowerCase())?"DatatypeProperty":/^[A-Z]/.test(e)?"ObjectProperty":"DatatypeProperty or ObjectProperty"}getPropertyValue(e,t){let o=e[t];return o?o.toString():null}isPropertyDefinedAsClass(e){let t=e.body.Property;if(t&&typeof t=="object"&&!Array.isArray(t)){let n=t.type;if(n){let r=n.toString();return r==="Class"||r.endsWith(".Class")}}return!1}};var ie=class{get ruleName(){return"SubjectKanonakTypeRequired"}validate(e){let t=[];for(let[o,n]of Object.entries(e.body)){if(typeof n!="object"||n===null||Array.isArray(n)||o.includes("."))continue;let r=n,a="type"in r,i=r.type?.toString().trim();if(!a||!i){let s=new u;s.ruleType=this.ruleName,s.severity="Error",s.entityName=o,s.propertyName="type",s.message=`Subject Kanonak '${o}' must have a 'type' property.`,s.suggestion=`Add a type statement like:
1
+ import{a as v,b as Me,c as it,g as M,j as ct,l as S}from"./chunk-MX3DEXMV.js";import{a as rt}from"./chunk-NJ3AZYQD.js";import{a as y,d as A,e as Y,f as pt,g as L,h as lt}from"./chunk-WFQANMBQ.js";import{a as G}from"./chunk-6U26UASC.js";import{h as Fe,i as st}from"./chunk-GZPLWII7.js";import{c as d,d as I,j as Be,k as H,l as F,m as K,n as z,p as P,r as h,t as J,u as x,v as W,w as g,x as O,y as V}from"./chunk-7BHDZHJY.js";import{a as at}from"./chunk-FUUTGGJS.js";import{e as U}from"./chunk-2ACBWC7K.js";var Q=class{isValid=!1;errors=[];warnings=[];infos=[];get totalIssues(){return this.errors.length+this.warnings.length+this.infos.length}get allDiagnostics(){return[...this.errors,...this.warnings,...this.infos]}};var k=(o=>(o.Info="Info",o.Warning="Warning",o.Error="Error",o))(k||{});var u=class{ruleType="";severity="Error";lineNumber;column;entityName;propertyName;propertyPath;message="";suggestion;actualValue;expectedValue;toString(){let e="";return this.lineNumber!==void 0&&(e+=`Line ${this.lineNumber}: `),this.entityName&&(e+=`[${this.entityName}] `),e+=this.message,e}};var ze=class c{resolvedDocuments=[];currentEntityPath;withPath(e){let t=new c;return t.resolvedDocuments=this.resolvedDocuments,t.currentEntityPath=e,t}};var ee=class{constructor(e){this.underlying=e;this.repository=new Xe(e)}underlying;repository;parsePromise=null;getKanonaks(){return this.parseOnce().then(e=>e.merged)}getAuthoredKanonaks(){return this.parseOnce().then(e=>e.authored)}parseOnce(){return this.parsePromise||(this.parsePromise=(async()=>{let e={};return{merged:await new S().parseKanonaks(this.underlying,e),authored:e.authored??[]}})()),this.parsePromise}},Xe=class{constructor(e){this.inner=e}inner;highestVersionCache=new Map;byNamespaceCache=new Map;getAllDocumentsAsync(){return this.inner.getAllDocumentsAsync()}getDocumentAsync(e){return this.inner.getDocumentAsync(e)}getDocumentsByNamespaceAsync(e,t){let o=`${e}/${t}`,n=this.byNamespaceCache.get(o);return n||(n=this.inner.getDocumentsByNamespaceAsync(e,t),this.byNamespaceCache.set(o,n),n)}getHighestCompatibleVersionAsync(e,t){let o=t.version,n=o?`${o.major}.${o.minor}.${o.patch}`:"",r=`${e}/${t.packageName}@${t.versionOperator}:${n}`,a=this.highestVersionCache.get(r);return a||(a=this.inner.getHighestCompatibleVersionAsync(e,t),this.highestVersionCache.set(r,a),a)}saveDocumentAsync(){throw new Error("CachingRepository is read-only during a validation pass.")}deleteDocumentAsync(){throw new Error("CachingRepository is read-only during a validation pass.")}clearNamespaceAsync(){throw new Error("CachingRepository is read-only during a validation pass.")}getAllDocumentReferencesAsync(){return this.inner.getAllDocumentReferencesAsync()}getDocumentContentAsync(e){return this.inner.getDocumentContentAsync(e)}getDocumentUriAsync(e){return this.inner.getDocumentUriAsync(e)}};async function D(c,e,t){return t?t.getKanonaks():new S().parseKanonaks(new te(c,e))}async function C(c,e,t){let o=await D(c,e,t),n=We(c);return n?o.filter(r=>r instanceof d&&r.namespace===n):[]}async function oe(c,e,t){let o=We(c);if(!o)return[];let n;if(t)n=await t.getAuthoredKanonaks();else{let r={};await new S().parseKanonaks(new te(c,e),r),n=r.authored??[]}return n.filter(r=>r instanceof d&&r.sourceDoc===o)}function q(c,e){for(let t of c)t instanceof d&&Ze(t,t.name,e)}function Ze(c,e,t){t({kanonak:c,path:e});for(let o of c.statement)if(o instanceof H)Ze(o.object,mt(e,o.object),t);else if(o instanceof F)for(let n of o.object)n instanceof v&&Ze(n,mt(e,n),t)}function mt(c,e){let t=e instanceof v&&e.name?e.name:"<embedded>";return`${c}/${t}`}function We(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${U(e.version)}`}var te=class{constructor(e,t){this.document=e;this.broader=t}document;broader;async getAllDocumentsAsync(){let e=this.document.metadata.namespace_?.toString(),t=(await this.broader.getAllDocumentsAsync()).filter(o=>o.metadata.namespace_?.toString()!==e);return[this.document,...t]}getDocumentAsync(e){return this.broader.getDocumentAsync(e)}getDocumentsByNamespaceAsync(e,t){return this.broader.getDocumentsByNamespaceAsync(e,t)}getHighestCompatibleVersionAsync(e,t){return this.broader.getHighestCompatibleVersionAsync(e,t)}getAllDocumentReferencesAsync(){return this.broader.getAllDocumentReferencesAsync()}getDocumentContentAsync(e){return this.broader.getDocumentContentAsync(e)}getDocumentUriAsync(e){return this.broader.getDocumentUriAsync(e)}saveDocumentAsync(){throw new Error("DocumentWithRepositoryCatalog is read-only")}deleteDocumentAsync(){throw new Error("DocumentWithRepositoryCatalog is read-only")}clearNamespaceAsync(){throw new Error("DocumentWithRepositoryCatalog is read-only")}};var ne=class c{static NAMESPACE_PREFIX_PATTERN=/^(rdfs|xsd|owl|rdf|dc|foaf|skos|dct|dcterms|geo|time|prov|schema|og|dbo):/i;ruleName="NamespacePrefix";validate(e){let t=[];for(let[o,n]of Object.entries(e.body))n&&typeof n=="object"&&!Array.isArray(n)&&this.validateEntity(o,n,t);return t}validateEntity(e,t,o){for(let[n,r]of Object.entries(t)){let a=r?.toString()??"";if(a&&c.NAMESPACE_PREFIX_PATTERN.test(a)){let i=this.getSuggestionForPrefixedValue(a),s=e.split(".")[0],p=new u;p.ruleType=this.ruleName,p.severity="Error",p.entityName=s,p.propertyName=e,p.actualValue=n,p.expectedValue=i,p.message=`Invalid namespace prefix '${a}'. Use '${i}' without prefix.`,p.suggestion="Kanonak YAML uses simple type names. Namespace resolution is handled through imports.",o.push(p)}r&&typeof r=="object"&&!Array.isArray(r)&&this.validateEntity(`${e}.${n}`,r,o)}}getSuggestionForPrefixedValue(e){let t=e.toLowerCase();if(t==="rdfs:class"||t==="owl:class")return"Class";if(t==="rdfs:property"||t==="rdf:property")return"DatatypeProperty or ObjectProperty";if(t.startsWith("xsd:"))return e.substring(4);let o=e.indexOf(":");return o>=0?e.substring(o+1):e}};var re=class c{static RESERVED_WORDS=new Set(["imports","namespace","type","label","comment","subclassof","domain","range","required","functional"]);static VALID_PROPERTIES=new Set(["type","label","comment","subClassOf","subPropertyOf","domain","range","required","functional","inverseOf","transitive","symmetric","inverseFunctional"]);static VALID_NAME_PATTERN=/^[a-zA-Z][a-zA-Z0-9_-]*$/;static VALID_AUGMENTATION_PATTERN=/^[a-zA-Z][a-zA-Z0-9_-]*\.[a-zA-Z][a-zA-Z0-9_-]*$/;static VALID_PROPERTY_NAME_PATTERN=/^[a-zA-Z][a-zA-Z0-9_.]*$/;ruleName="ResourceNaming";validate(e){let t=[],o=e.metadata?.namespace_?.publisher==="kanonak.org"&&e.metadata?.namespace_?.package_?.startsWith("core-");for(let[n,r]of Object.entries(e.body)){let a=c.VALID_AUGMENTATION_PATTERN.test(n);if(!a&&!o&&c.RESERVED_WORDS.has(n.toLowerCase())){let i=new u;i.ruleType=this.ruleName,i.severity="Error",i.entityName=n,i.message=`Entity name '${n}' is a reserved word and cannot be used.`,i.suggestion="Choose a different name that doesn't conflict with Kanonak reserved words.",t.push(i);continue}if(!a&&!c.VALID_NAME_PATTERN.test(n)){let i;/^\d/.test(n)?i="Entity names must start with a letter, not a number.":n.includes(" ")?i="Entity names cannot contain spaces. Use camelCase or underscores instead.":i="Entity names must start with a letter and contain only letters, numbers, and underscores.";let s=new u;s.ruleType=this.ruleName,s.severity="Error",s.entityName=n,s.message=`Invalid entity name '${n}'. ${i}`,s.suggestion=i,t.push(s)}r&&typeof r=="object"&&!Array.isArray(r)&&this.validatePropertyNames(n,r,t)}return t}validatePropertyNames(e,t,o){for(let n of Object.keys(t))if(!c.VALID_PROPERTIES.has(n)&&!c.VALID_PROPERTY_NAME_PATTERN.test(n)){let r=new u;r.ruleType=this.ruleName,r.severity="Warning",r.entityName=e,r.propertyName=n,r.message=`Property name '${n}' in entity '${e}' doesn't follow naming conventions.`,r.suggestion="Property names should start with a letter and contain only letters, numbers, and underscores.",o.push(r)}}};var ae=class c{static XSD_TYPES=new Set(["string","integer","int","long","short","byte","decimal","float","double","boolean","bool","datetime","date","time","duration","anyuri","anysimpletype","nonnegativeinteger","positiveinteger","negativeinteger","nonpositiveinteger","unsignedint","unsignedlong","unsignedshort","unsignedbyte","base64binary","hexbinary"]);ruleName="PropertyTypeSpecificity";validate(e){let t=[];if(e.metadata?.namespace_?.publisher==="kanonak.org"&&e.metadata?.namespace_?.package_?.startsWith("core-"))return t;let o=this.isPropertyDefinedAsClass(e);for(let[n,r]of Object.entries(e.body))if(r&&typeof r=="object"&&!Array.isArray(r)){let a=r,i=a.type;if(i){let s=[];if(Array.isArray(i))for(let p of i){let l=p?.toString();l&&l==="Property"&&!o&&s.push(l)}else{let p=i?.toString();p&&p==="Property"&&!o&&s.push(p)}for(let p of s){let l=this.getPropertyValue(a,"range"),m=this.determinePropertyType(l),f=new u;f.ruleType=this.ruleName,f.severity="Error",f.entityName=n,f.propertyName="type",f.actualValue=p,f.expectedValue=m,f.message=`Invalid property type '${p}'. Use '${m}' instead.`,f.suggestion="Properties should specify their type: DatatypeProperty for data values, ObjectProperty for relationships.",t.push(f)}}}return t}determinePropertyType(e){return!e||e.trim().length===0?"DatatypeProperty or ObjectProperty":c.XSD_TYPES.has(e.toLowerCase())?"DatatypeProperty":/^[A-Z]/.test(e)?"ObjectProperty":"DatatypeProperty or ObjectProperty"}getPropertyValue(e,t){let o=e[t];return o?o.toString():null}isPropertyDefinedAsClass(e){let t=e.body.Property;if(t&&typeof t=="object"&&!Array.isArray(t)){let n=t.type;if(n){let r=n.toString();return r==="Class"||r.endsWith(".Class")}}return!1}};var ie=class{get ruleName(){return"SubjectKanonakTypeRequired"}validate(e){let t=[];for(let[o,n]of Object.entries(e.body)){if(typeof n!="object"||n===null||Array.isArray(n)||o.includes("."))continue;let r=n,a="type"in r,i=r.type?.toString().trim();if(!a||!i){let s=new u;s.ruleType=this.ruleName,s.severity="Error",s.entityName=o,s.propertyName="type",s.message=`Subject Kanonak '${o}' must have a 'type' property.`,s.suggestion=`Add a type statement like:
2
2
  type: Scene
3
3
 
4
4
  Only embedded objects can infer type from their parent property's range. Subject Kanonaks (top-level entities) must explicitly declare their type.`,s.expectedValue="A valid class name (Scene, Character, Story, etc.)",t.push(s)}}return t}};var Ut=new Set(["EphemeralPackage"]),se=class{get ruleName(){return"PackageHeader"}validate(e){let t=e.metadata;if(!t.type_)return[];let o=[],n=this.packageKey(e,t.type_);return t.namespace_?(!Ut.has(t.type_)&&!t.namespace_.version&&o.push(this.error(n,"version",`Package resource '${n}' requires a 'version' property \u2014 packages are addressed by name@version.`,`Add a version, e.g.:
5
5
  version: 1.0.0`)),o):(o.push(this.error(n,"publisher",`Package resource '${n}' requires a 'publisher' property.`,`Add a publisher, e.g.:
6
- publisher: example.org`)),o)}packageKey(e,t){for(let[o,n]of Object.entries(e.body))if(n&&typeof n=="object"&&!Array.isArray(n)&&n.type===t)return o;return t}error(e,t,o,n){let r=new u;return r.ruleType=this.ruleName,r.severity="Error",r.entityName=e,r.propertyName=t,r.message=o,r.suggestion=n,r}};var Ot={publisher:"kanonak.org",package_:"core-rdf",name:"type"},$t={publisher:"kanonak.org",package_:"core-rdf",name:"range"},At={publisher:"kanonak.org",package_:"core-rdf",name:"Resource"},wt={publisher:"kanonak.org",package_:"core-rdf",name:"Class"},ce=class{ruleName="EmbeddedKanonakType";async validateAsync(e,t,o){let n=[],r=await D(e,t,o),a=await oe(e,t,o);for(let i of a)i instanceof y&&this.walk(r,i,i.name,n);return n}walk(e,t,o,n){for(let r of t.statement)if(r instanceof H){let a=r.predicate?.subject,i=`${o}.${a?.name??"<embedded>"}`;this.check(e,a,r.object,o,i,n),this.walk(e,r.object,i,n)}else if(r instanceof F){let a=r.predicate?.subject,i=0;for(let s of r.object){if(s instanceof v){let p=`${o}.${a?.name??"<embedded>"}[${i}]`;this.check(e,a,s,o,p,n),this.walk(e,s,p,n)}i++}}}check(e,t,o,n,r,a){if(!t)return;let i=g(o,Ot);if(!i)return;let s=k(e,t);if(!s)return;let p=g(s,$t);if(p&&!(z(p,At)||z(p,wt))){if(K(i)===K(p)){a.push(this.redundant(n,r,i,p));return}Y(e,i).some(l=>K(l)===K(p))||a.push(this.notSubclass(n,r,i,p))}}redundant(e,t,o,n){let r=new u;return r.ruleType=this.ruleName,r.severity="Warning",r.entityName=e,r.propertyName=t,r.actualValue=o.name,r.expectedValue=n.name,r.message=`Embedded object at '${t}' declares 'type: ${o.name}', which equals the parent property's range '${n.name}'. The declaration is redundant \u2014 the type is already inferred from the property's range.`,r.suggestion=`Remove the 'type: ${o.name}' line, or keep it if explicitness is preferred over concision.`,r}notSubclass(e,t,o,n){let r=new u;return r.ruleType=this.ruleName,r.severity="Error",r.entityName=e,r.propertyName=t,r.actualValue=o.name,r.expectedValue=n.name,r.message=`Embedded object at '${t}' has 'type: ${o.name}', which is not a subclass of the parent property's range '${n.name}'.`,r.suggestion=`Either remove the 'type: ${o.name}' line (so the type is inferred from the property's range '${n.name}'), or add 'subClassOf: ${n.name}' to the '${o.name}' class definition so the relationship holds.`,r}};import{VersionOperator as We}from"@kanonak-protocol/types/document/models/enums";var pe=class{ruleName="ImportExistence";async validateAsync(e,t){let o=[];if(!e.metadata?.imports)return o;let n=await t.getAllDocumentsAsync();for(let[r,a]of Object.entries(e.metadata.imports))for(let i of a)if(!await t.getHighestCompatibleVersionAsync(r,i)){let p=await this.determineImportErrorAsync(t,r,i,n),l=new u;l.ruleType=this.ruleName,l.severity="Error",l.message=p.message,l.suggestion=p.suggestion,l.entityName=`Import: ${r}/${i.packageName}`,l.actualValue=i.toString(),l.expectedValue=p.expectedValue,o.push(l)}return o}async determineImportErrorAsync(e,t,o,n){let r=await e.getDocumentsByNamespaceAsync(t,o.packageName);if(r.length===0){let p=n.filter(R=>R.metadata.namespace_?.publisher===t).map(R=>R.metadata.namespace_.package_).filter((R,E,N)=>N.indexOf(R)===E),l=this.findSimilarPackages(o.packageName,p),m=`Import '${t}/${o.package_}' not found - package does not exist`,f=l.length>0?`Did you mean: ${l.slice(0,3).join(", ")}?`:p.length>0?`Available packages in ${t}: ${p.slice(0,5).join(", ")}`:`No packages found for publisher '${t}'. Verify the publisher name is correct.`;return{message:m,suggestion:f,expectedValue:"Existing package"}}let i=r.filter(p=>p.metadata.namespace_?.version).map(p=>p.metadata.namespace_.version.toString()).sort().join(", "),s=this.getAcceptableVersionRange(o);return{message:`Import '${t}/${o.toString()}' version mismatch - no compatible version found`,suggestion:`Available versions: ${i}. Required: ${s}`,expectedValue:s}}getAcceptableVersionRange(e){switch(e.versionOperator){case We.Exact:return`exactly ${e.version.major}.${e.version.minor}.${e.version.patch}`;case We.Compatible:return`${e.version.major}.${e.version.minor}.${e.version.patch} to ${e.version.major}.${e.version.minor}.x`;case We.Major:return e.version.major===0?`0.${e.version.minor}.x`:`${e.version.major}.x.x`;case We.Any:return`any version >= ${e.version.major}.${e.version.minor}.${e.version.patch}`;default:return e.toString()}}findSimilarPackages(e,t){if(t.length===0)return[];let o=t.filter(a=>a.toLowerCase().includes(e.toLowerCase())||e.toLowerCase().includes(a.toLowerCase()));if(o.length>0)return o.sort((a,i)=>a.length-i.length);let n=t.map(a=>({package:a,distance:this.levenshteinDistance(e.toLowerCase(),a.toLowerCase())})).sort((a,i)=>a.distance-i.distance),r=Math.max(3,Math.floor(e.length*.4));return n.filter(a=>a.distance<=r).map(a=>a.package)}levenshteinDistance(e,t){if(!e||e.length===0)return t?.length??0;if(!t||t.length===0)return e.length;let o=e.length,n=t.length,r=Array(o+1).fill(null).map(()=>Array(n+1).fill(0));for(let a=0;a<=o;a++)r[a][0]=a;for(let a=0;a<=n;a++)r[0][a]=a;for(let a=1;a<=o;a++)for(let i=1;i<=n;i++){let s=e[a-1]===t[i-1]?0:1;r[a][i]=Math.min(Math.min(r[a-1][i]+1,r[a][i-1]+1),r[a-1][i-1]+s)}return r[o][n]}};var xt="kanonak.org",Tt="core-rdf",Nt=new Set(["type","subClassOf","subPropertyOf","domain","range"].map(c=>K({publisher:xt,package_:Tt,name:c}))),le=class{ruleName="UnresolvedReference";async validateAsync(e,t,o){let n=[],r=await D(e,t,o),a=await C(e,t,o);return q(a,({kanonak:i,path:s})=>{for(let p of i.statement){let l=_t(p);if(!(!l||Nt.has(K(l)))){if(p instanceof Me)this.check(r,s,l,p.object,n);else if(p instanceof F)for(let m of p.object)m instanceof I&&this.check(r,s,l,m,n)}}}),n}check(e,t,o,n,r){k(e,n.subject)||r.push(this.unresolvedError(t,o.name,n.subject))}unresolvedError(e,t,o){let n=`${o.publisher}/${o.package_}/${o.name}`,r=new u;return r.ruleType=this.ruleName,r.severity="Error",r.entityName=e,r.propertyName=t,r.actualValue=n,r.expectedValue="A reference that resolves to a defined or imported resource",r.message=`Reference to '${o.name}' in '${t}' could not be resolved`,r.suggestion=`The entity '${n}' is not defined in this namespace or any imported namespace.
6
+ publisher: example.org`)),o)}packageKey(e,t){for(let[o,n]of Object.entries(e.body))if(n&&typeof n=="object"&&!Array.isArray(n)&&n.type===t)return o;return t}error(e,t,o,n){let r=new u;return r.ruleType=this.ruleName,r.severity="Error",r.entityName=e,r.propertyName=t,r.message=o,r.suggestion=n,r}};var At={publisher:"kanonak.org",package_:"core-rdf",name:"type"},wt={publisher:"kanonak.org",package_:"core-rdf",name:"range"},xt={publisher:"kanonak.org",package_:"core-rdf",name:"Resource"},Tt={publisher:"kanonak.org",package_:"core-rdf",name:"Class"},ce=class{ruleName="EmbeddedKanonakType";async validateAsync(e,t,o){let n=[],r=await D(e,t,o),a=await oe(e,t,o);for(let i of a)i instanceof d&&this.walk(r,i,i.name,n);return n}walk(e,t,o,n){for(let r of t.statement)if(r instanceof H){let a=r.predicate?.subject,i=`${o}.${a?.name??"<embedded>"}`;this.check(e,a,r.object,o,i,n),this.walk(e,r.object,i,n)}else if(r instanceof F){let a=r.predicate?.subject,i=0;for(let s of r.object){if(s instanceof v){let p=`${o}.${a?.name??"<embedded>"}[${i}]`;this.check(e,a,s,o,p,n),this.walk(e,s,p,n)}i++}}}check(e,t,o,n,r,a){if(!t)return;let i=g(o,At);if(!i)return;let s=h(e,t);if(!s)return;let p=g(s,wt);if(p&&!(z(p,xt)||z(p,Tt))){if(K(i)===K(p)){a.push(this.redundant(n,r,i,p));return}Y(e,i).some(l=>K(l)===K(p))||a.push(this.notSubclass(n,r,i,p))}}redundant(e,t,o,n){let r=new u;return r.ruleType=this.ruleName,r.severity="Warning",r.entityName=e,r.propertyName=t,r.actualValue=o.name,r.expectedValue=n.name,r.message=`Embedded object at '${t}' declares 'type: ${o.name}', which equals the parent property's range '${n.name}'. The declaration is redundant \u2014 the type is already inferred from the property's range.`,r.suggestion=`Remove the 'type: ${o.name}' line, or keep it if explicitness is preferred over concision.`,r}notSubclass(e,t,o,n){let r=new u;return r.ruleType=this.ruleName,r.severity="Error",r.entityName=e,r.propertyName=t,r.actualValue=o.name,r.expectedValue=n.name,r.message=`Embedded object at '${t}' has 'type: ${o.name}', which is not a subclass of the parent property's range '${n.name}'.`,r.suggestion=`Either remove the 'type: ${o.name}' line (so the type is inferred from the property's range '${n.name}'), or add 'subClassOf: ${n.name}' to the '${o.name}' class definition so the relationship holds.`,r}};import{VersionOperator as He}from"@kanonak-protocol/types/document/models/enums";var pe=class{ruleName="ImportExistence";async validateAsync(e,t){let o=[];if(!e.metadata?.imports)return o;let n=await t.getAllDocumentsAsync();for(let[r,a]of Object.entries(e.metadata.imports))for(let i of a)if(!await t.getHighestCompatibleVersionAsync(r,i)){let p=await this.determineImportErrorAsync(t,r,i,n),l=new u;l.ruleType=this.ruleName,l.severity="Error",l.message=p.message,l.suggestion=p.suggestion,l.entityName=`Import: ${r}/${i.packageName}`,l.actualValue=i.toString(),l.expectedValue=p.expectedValue,o.push(l)}return o}async determineImportErrorAsync(e,t,o,n){let r=await e.getDocumentsByNamespaceAsync(t,o.packageName);if(r.length===0){let p=n.filter(R=>R.metadata.namespace_?.publisher===t).map(R=>R.metadata.namespace_.package_).filter((R,E,N)=>N.indexOf(R)===E),l=this.findSimilarPackages(o.packageName,p),m=`Import '${t}/${o.package_}' not found - package does not exist`,f=l.length>0?`Did you mean: ${l.slice(0,3).join(", ")}?`:p.length>0?`Available packages in ${t}: ${p.slice(0,5).join(", ")}`:`No packages found for publisher '${t}'. Verify the publisher name is correct.`;return{message:m,suggestion:f,expectedValue:"Existing package"}}let i=r.filter(p=>p.metadata.namespace_?.version).map(p=>p.metadata.namespace_.version.toString()).sort().join(", "),s=this.getAcceptableVersionRange(o);return{message:`Import '${t}/${o.toString()}' version mismatch - no compatible version found`,suggestion:`Available versions: ${i}. Required: ${s}`,expectedValue:s}}getAcceptableVersionRange(e){switch(e.versionOperator){case He.Exact:return`exactly ${e.version.major}.${e.version.minor}.${e.version.patch}`;case He.Compatible:return`${e.version.major}.${e.version.minor}.${e.version.patch} to ${e.version.major}.${e.version.minor}.x`;case He.Major:return e.version.major===0?`0.${e.version.minor}.x`:`${e.version.major}.x.x`;case He.Any:return`any version >= ${e.version.major}.${e.version.minor}.${e.version.patch}`;default:return e.toString()}}findSimilarPackages(e,t){if(t.length===0)return[];let o=t.filter(a=>a.toLowerCase().includes(e.toLowerCase())||e.toLowerCase().includes(a.toLowerCase()));if(o.length>0)return o.sort((a,i)=>a.length-i.length);let n=t.map(a=>({package:a,distance:this.levenshteinDistance(e.toLowerCase(),a.toLowerCase())})).sort((a,i)=>a.distance-i.distance),r=Math.max(3,Math.floor(e.length*.4));return n.filter(a=>a.distance<=r).map(a=>a.package)}levenshteinDistance(e,t){if(!e||e.length===0)return t?.length??0;if(!t||t.length===0)return e.length;let o=e.length,n=t.length,r=Array(o+1).fill(null).map(()=>Array(n+1).fill(0));for(let a=0;a<=o;a++)r[a][0]=a;for(let a=0;a<=n;a++)r[0][a]=a;for(let a=1;a<=o;a++)for(let i=1;i<=n;i++){let s=e[a-1]===t[i-1]?0:1;r[a][i]=Math.min(Math.min(r[a-1][i]+1,r[a][i-1]+1),r[a-1][i-1]+s)}return r[o][n]}};var Nt="kanonak.org",_t="core-rdf",Lt=new Set(["type","subClassOf","subPropertyOf","domain","range"].map(c=>K({publisher:Nt,package_:_t,name:c}))),le=class{ruleName="UnresolvedReference";async validateAsync(e,t,o){let n=[],r=await D(e,t,o),a=await C(e,t,o);return q(a,({kanonak:i,path:s})=>{for(let p of i.statement){let l=Mt(p);if(!(!l||Lt.has(K(l)))){if(p instanceof Be)this.check(r,s,l,p.object,n);else if(p instanceof F)for(let m of p.object)m instanceof I&&this.check(r,s,l,m,n)}}}),n}check(e,t,o,n,r){h(e,n.subject)||r.push(this.unresolvedError(t,o.name,n.subject))}unresolvedError(e,t,o){let n=`${o.publisher}/${o.package_}/${o.name}`,r=new u;return r.ruleType=this.ruleName,r.severity="Error",r.entityName=e,r.propertyName=t,r.actualValue=n,r.expectedValue="A reference that resolves to a defined or imported resource",r.message=`Reference to '${o.name}' in '${t}' could not be resolved`,r.suggestion=`The entity '${n}' is not defined in this namespace or any imported namespace.
7
7
  \u2022 Import the package that defines it, or check for a typo in '${o.name}'
8
- \u2022 If it lives in an imported namespace, alias-qualify the reference`,r}};function _t(c){return c.predicate?.subject}var lt={publisher:"kanonak.org",package_:"core-rdf",name:"subClassOf"},mt={publisher:"kanonak.org",package_:"core-rdf",name:"subPropertyOf"};function Lt(c,e){let t=g(c,e);if(t)return[t];let o=[];for(let n of V(c,e))n instanceof I&&o.push(n.subject);return o}function He(c,e,t){let o=[],n=new Set,r=new Set,a=i=>{let s=k(c,i),p=s?`${s.namespace}/${s.name}`:K(i);if(n.has(p)){let l=o.findIndex(f=>f.key===p),m=o.slice(l);return m.length<=1?null:[...m.map(f=>f.uri),i]}if(r.has(p))return null;if(n.add(p),o.push({key:p,uri:i}),s)for(let l of Lt(s,t)){let m=a(l);if(m)return m}return o.pop(),n.delete(p),r.add(p),null};return a(e)}var ut=c=>c,me=class{ruleName="ClassHierarchyCycle";async validateAsync(e,t,o){let n=[],r=await D(e,t,o),a=await C(e,t,o);for(let i of a){if(!(i instanceof y)||!(d.isClassType(ut(i))||d.isDatatypeType(ut(i))))continue;let s=x(i);if(!s)continue;let p=He(r,s,lt);if(p){let l=p.map(f=>f.name).join(" \u2192 "),m=new u;m.ruleType=this.ruleName,m.severity="Error",m.message=`Circular class hierarchy detected: ${l}`,m.suggestion="Remove the circular dependency by breaking one of the subClassOf relationships",m.entityName=i.name,m.propertyName="subClassOf",m.actualValue=l,n.push(m);break}}return n}};var Mt=c=>c,ue=class{ruleName="PropertyHierarchyCycle";async validateAsync(e,t,o){let n=[],r=await D(e,t,o),a=await C(e,t,o);for(let i of a){if(!(i instanceof y)||!d.isAnyPropertyType(Mt(i)))continue;let s=x(i);if(!s)continue;let p=He(r,s,mt);if(p){let l=p.map(f=>f.name).join(" \u2192 "),m=new u;m.ruleType=this.ruleName,m.severity="Error",m.message=`Circular property hierarchy detected: ${l}`,m.suggestion="Remove the circular dependency by breaking one of the subPropertyOf relationships",m.entityName=i.name,m.propertyName="subPropertyOf",m.actualValue=l,n.push(m);break}}return n}};var Bt={publisher:"kanonak.org",package_:"core-rdf",name:"range"},ft=c=>c,fe=class{ruleName="PropertyRangeRequired";async validateAsync(e,t,o){let n=[],r=await C(e,t,o);for(let a of r){if(!(a instanceof y))continue;let i=d.isObjectPropertyType(ft(a));!i&&!d.isDatatypePropertyType(ft(a))||J(a,Bt)||n.push(this.error(a.name,i))}return n}error(e,t){let o=new u;return o.ruleType=this.ruleName,o.severity="Error",o.entityName=e,o.propertyName="range",o.message=`Property '${e}' must have a 'range' defined.`,o.suggestion=t?"Add a range like: range: ClassName (the class this property expects)":"Add a range like: range: string (or integer, boolean, etc.)",o.expectedValue=t?"A class name (Character, Scene, Story, etc.)":"A datatype (string, integer, boolean, decimal, etc.)",o}};var Ft={publisher:"kanonak.org",package_:"core-rdf",name:"subClassOf"},dt=c=>c,de=class{ruleName="SubClassOfReference";async validateAsync(e,t,o){let n=[],r=await D(e,t,o),a=await C(e,t,o);for(let i of a){if(!(i instanceof y)||!yt(dt(i)))continue;let s=Wt(i,Ft);for(let p=0;p<s.length;p++)this.resolvesToClassLike(r,s[p])||n.push(this.error(i.name,s[p],s.length>1?`[${p}]`:""))}return n}resolvesToClassLike(e,t){let o=k(e,t);return o?yt(dt(o)):!1}error(e,t,o){let n=`${t.publisher}/${t.package_}/${t.name}`,r=new u;return r.ruleType=this.ruleName,r.severity="Error",r.entityName=e,r.propertyName="subClassOf",r.actualValue=n,r.expectedValue="Defined or imported class",r.message=`Class '${t.name}' referenced in subClassOf${o} is not defined or imported`,r.suggestion=`Define '${t.name}' as a Class, or import a namespace that contains it`,r}};function yt(c){return d.isClassType(c)||d.isDatatypeType(c)}function Wt(c,e){let t=g(c,e);if(t)return[t];let o=[];for(let n of V(c,e))n instanceof I&&o.push(n.subject);return o}var Ht={publisher:"kanonak.org",package_:"core-rdf",name:"subPropertyOf"},gt=c=>c,ye=class{ruleName="SubPropertyOfReference";async validateAsync(e,t,o){let n=[],r=await D(e,t,o),a=await C(e,t,o);for(let i of a){if(!(i instanceof y)||!d.isAnyPropertyType(gt(i)))continue;let s=Gt(i,Ht);for(let p=0;p<s.length;p++)this.resolvesToProperty(r,s[p])||n.push(this.error(i.name,s[p],s.length>1?`[${p}]`:""))}return n}resolvesToProperty(e,t){let o=k(e,t);return o?d.isAnyPropertyType(gt(o)):!1}error(e,t,o){let n=`${t.publisher}/${t.package_}/${t.name}`,r=new u;return r.ruleType=this.ruleName,r.severity="Error",r.entityName=e,r.propertyName="subPropertyOf",r.actualValue=n,r.expectedValue="Defined or imported property",r.message=`Property '${t.name}' referenced in subPropertyOf${o} is not defined or imported`,r.suggestion=`Define '${t.name}' as a property, or import a namespace that contains it`,r}};function Gt(c,e){let t=g(c,e);if(t)return[t];let o=[];for(let n of V(c,e))n instanceof I&&o.push(n.subject);return o}var ge=class{get ruleName(){return"NamespaceImportCycle"}async validateAsync(e,t){let o=[],n=e.metadata.namespace_?.toString();if(!n)return o;let r=new Map,a=new Set;await this.buildImportGraph(e,t,r,a);let i=this.detectCycle(n,r);if(i){let s=i.join(" \u2192 "),p=new u;p.ruleType=this.ruleName,p.severity="Error",p.message=`Circular namespace import detected: ${s}`,p.suggestion="Remove one of the imports to break the circular dependency. Circular dependencies prevent proper package resolution.",p.entityName="imports",p.propertyName="imports",p.actualValue=s,o.push(p)}return o}async buildImportGraph(e,t,o,n){let r=e.metadata.namespace_?.toString()??"";if(!(!r||n.has(r))&&(n.add(r),e.metadata.imports)){let a=[];for(let[i,s]of Object.entries(e.metadata.imports))for(let p of s){let l=`${i}/${p.packageName}@${p.version}`;a.push(l);let m=await t.getHighestCompatibleVersionAsync(i,p);m&&await this.buildImportGraph(m,t,o,n)}a.length>0&&o.set(r,a)}}detectCycle(e,t){let o=[],n=new Set;return this.detectCycleRecursive(e,t,o,n)}detectCycleRecursive(e,t,o,n){let r=o.indexOf(e);if(r>=0){let i=o.slice(r);return i.push(e),i}if(n.has(e))return null;o.push(e),n.add(e);let a=t.get(e);if(a)for(let i of a){let s=this.detectCycleRecursive(i,t,o,n);if(s)return s}return o.pop(),null}};var ke=class{ruleName="UnresolvedPredicate";async validateAsync(e,t,o){let n=[],r=Fe(e);if(!r)return n;let a=await D(e,t,o);return q(a,({kanonak:i,path:s})=>{for(let p of i.unresolvedPredicates)p.sourceDoc===r&&n.push(this.unresolvedPredicateError(s,p.key))}),n}unresolvedPredicateError(e,t){let o=t.lastIndexOf("."),n=o>0?t.slice(0,o):null,r=o>0?t.slice(o+1):t,a=new u;return a.ruleType=this.ruleName,a.severity="Error",a.entityName=e,a.propertyName=t,a.actualValue=t,a.expectedValue="A defined or imported property",a.message=`Property '${t}' is not defined or imported`,a.suggestion=n?`The property '${r}' was not found in the namespace imported as '${n}'.
8
+ \u2022 If it lives in an imported namespace, alias-qualify the reference`,r}};function Mt(c){return c.predicate?.subject}var ut={publisher:"kanonak.org",package_:"core-rdf",name:"subClassOf"},ft={publisher:"kanonak.org",package_:"core-rdf",name:"subPropertyOf"};function Bt(c,e){let t=g(c,e);if(t)return[t];let o=[];for(let n of V(c,e))n instanceof I&&o.push(n.subject);return o}function Ge(c,e,t){let o=[],n=new Set,r=new Set,a=i=>{let s=h(c,i),p=s?`${s.namespace}/${s.name}`:K(i);if(n.has(p)){let l=o.findIndex(f=>f.key===p),m=o.slice(l);return m.length<=1?null:[...m.map(f=>f.uri),i]}if(r.has(p))return null;if(n.add(p),o.push({key:p,uri:i}),s)for(let l of Bt(s,t)){let m=a(l);if(m)return m}return o.pop(),n.delete(p),r.add(p),null};return a(e)}var dt=c=>c,me=class{ruleName="ClassHierarchyCycle";async validateAsync(e,t,o){let n=[],r=await D(e,t,o),a=await C(e,t,o);for(let i of a){if(!(i instanceof d)||!(y.isClassType(dt(i))||y.isDatatypeType(dt(i))))continue;let s=A(i);if(!s)continue;let p=Ge(r,s,ut);if(p){let l=p.map(f=>f.name).join(" \u2192 "),m=new u;m.ruleType=this.ruleName,m.severity="Error",m.message=`Circular class hierarchy detected: ${l}`,m.suggestion="Remove the circular dependency by breaking one of the subClassOf relationships",m.entityName=i.name,m.propertyName="subClassOf",m.actualValue=l,n.push(m);break}}return n}};var Ft=c=>c,ue=class{ruleName="PropertyHierarchyCycle";async validateAsync(e,t,o){let n=[],r=await D(e,t,o),a=await C(e,t,o);for(let i of a){if(!(i instanceof d)||!y.isAnyPropertyType(Ft(i)))continue;let s=A(i);if(!s)continue;let p=Ge(r,s,ft);if(p){let l=p.map(f=>f.name).join(" \u2192 "),m=new u;m.ruleType=this.ruleName,m.severity="Error",m.message=`Circular property hierarchy detected: ${l}`,m.suggestion="Remove the circular dependency by breaking one of the subPropertyOf relationships",m.entityName=i.name,m.propertyName="subPropertyOf",m.actualValue=l,n.push(m);break}}return n}};var Wt={publisher:"kanonak.org",package_:"core-rdf",name:"range"},yt=c=>c,fe=class{ruleName="PropertyRangeRequired";async validateAsync(e,t,o){let n=[],r=await C(e,t,o);for(let a of r){if(!(a instanceof d))continue;let i=y.isObjectPropertyType(yt(a));!i&&!y.isDatatypePropertyType(yt(a))||J(a,Wt)||n.push(this.error(a.name,i))}return n}error(e,t){let o=new u;return o.ruleType=this.ruleName,o.severity="Error",o.entityName=e,o.propertyName="range",o.message=`Property '${e}' must have a 'range' defined.`,o.suggestion=t?"Add a range like: range: ClassName (the class this property expects)":"Add a range like: range: string (or integer, boolean, etc.)",o.expectedValue=t?"A class name (Character, Scene, Story, etc.)":"A datatype (string, integer, boolean, decimal, etc.)",o}};var Ht={publisher:"kanonak.org",package_:"core-rdf",name:"subClassOf"},gt=c=>c,de=class{ruleName="SubClassOfReference";async validateAsync(e,t,o){let n=[],r=await D(e,t,o),a=await C(e,t,o);for(let i of a){if(!(i instanceof d)||!kt(gt(i)))continue;let s=Gt(i,Ht);for(let p=0;p<s.length;p++)this.resolvesToClassLike(r,s[p])||n.push(this.error(i.name,s[p],s.length>1?`[${p}]`:""))}return n}resolvesToClassLike(e,t){let o=h(e,t);return o?kt(gt(o)):!1}error(e,t,o){let n=`${t.publisher}/${t.package_}/${t.name}`,r=new u;return r.ruleType=this.ruleName,r.severity="Error",r.entityName=e,r.propertyName="subClassOf",r.actualValue=n,r.expectedValue="Defined or imported class",r.message=`Class '${t.name}' referenced in subClassOf${o} is not defined or imported`,r.suggestion=`Define '${t.name}' as a Class, or import a namespace that contains it`,r}};function kt(c){return y.isClassType(c)||y.isDatatypeType(c)}function Gt(c,e){let t=g(c,e);if(t)return[t];let o=[];for(let n of V(c,e))n instanceof I&&o.push(n.subject);return o}var Yt={publisher:"kanonak.org",package_:"core-rdf",name:"subPropertyOf"},ht=c=>c,ye=class{ruleName="SubPropertyOfReference";async validateAsync(e,t,o){let n=[],r=await D(e,t,o),a=await C(e,t,o);for(let i of a){if(!(i instanceof d)||!y.isAnyPropertyType(ht(i)))continue;let s=qt(i,Yt);for(let p=0;p<s.length;p++)this.resolvesToProperty(r,s[p])||n.push(this.error(i.name,s[p],s.length>1?`[${p}]`:""))}return n}resolvesToProperty(e,t){let o=h(e,t);return o?y.isAnyPropertyType(ht(o)):!1}error(e,t,o){let n=`${t.publisher}/${t.package_}/${t.name}`,r=new u;return r.ruleType=this.ruleName,r.severity="Error",r.entityName=e,r.propertyName="subPropertyOf",r.actualValue=n,r.expectedValue="Defined or imported property",r.message=`Property '${t.name}' referenced in subPropertyOf${o} is not defined or imported`,r.suggestion=`Define '${t.name}' as a property, or import a namespace that contains it`,r}};function qt(c,e){let t=g(c,e);if(t)return[t];let o=[];for(let n of V(c,e))n instanceof I&&o.push(n.subject);return o}var ge=class{get ruleName(){return"NamespaceImportCycle"}async validateAsync(e,t){let o=[],n=e.metadata.namespace_?.toString();if(!n)return o;let r=new Map,a=new Set;await this.buildImportGraph(e,t,r,a);let i=this.detectCycle(n,r);if(i){let s=i.join(" \u2192 "),p=new u;p.ruleType=this.ruleName,p.severity="Error",p.message=`Circular namespace import detected: ${s}`,p.suggestion="Remove one of the imports to break the circular dependency. Circular dependencies prevent proper package resolution.",p.entityName="imports",p.propertyName="imports",p.actualValue=s,o.push(p)}return o}async buildImportGraph(e,t,o,n){let r=e.metadata.namespace_?.toString()??"";if(!(!r||n.has(r))&&(n.add(r),e.metadata.imports)){let a=[];for(let[i,s]of Object.entries(e.metadata.imports))for(let p of s){let l=`${i}/${p.packageName}@${p.version}`;a.push(l);let m=await t.getHighestCompatibleVersionAsync(i,p);m&&await this.buildImportGraph(m,t,o,n)}a.length>0&&o.set(r,a)}}detectCycle(e,t){let o=[],n=new Set;return this.detectCycleRecursive(e,t,o,n)}detectCycleRecursive(e,t,o,n){let r=o.indexOf(e);if(r>=0){let i=o.slice(r);return i.push(e),i}if(n.has(e))return null;o.push(e),n.add(e);let a=t.get(e);if(a)for(let i of a){let s=this.detectCycleRecursive(i,t,o,n);if(s)return s}return o.pop(),null}};var ke=class{ruleName="UnresolvedPredicate";async validateAsync(e,t,o){let n=[],r=We(e);if(!r)return n;let a=await D(e,t,o);return q(a,({kanonak:i,path:s})=>{for(let p of i.unresolvedPredicates)p.sourceDoc===r&&n.push(this.unresolvedPredicateError(s,p.key))}),n}unresolvedPredicateError(e,t){let o=t.lastIndexOf("."),n=o>0?t.slice(0,o):null,r=o>0?t.slice(o+1):t,a=new u;return a.ruleType=this.ruleName,a.severity="Error",a.entityName=e,a.propertyName=t,a.actualValue=t,a.expectedValue="A defined or imported property",a.message=`Property '${t}' is not defined or imported`,a.suggestion=n?`The property '${r}' was not found in the namespace imported as '${n}'.
9
9
  1. Check '${r}' is spelled correctly
10
10
  2. Verify '${n}' is imported with the right alias and version
11
11
  3. Ensure that namespace version actually defines '${r}'`:`The property '${t}' is not defined in this namespace or any imported namespace.
12
12
  1. Define '${t}' as an ObjectProperty or DatatypeProperty here, OR
13
13
  2. Import the namespace that defines it, OR
14
- 3. Alias-qualify it if it lives in an imported namespace ('alias.${t}')`,a}};var he=class{get ruleName(){return"AmbiguousReference"}async validateAsync(e,t){let o=[],{entitySources:n,importPaths:r}=await this.buildEntitySourceMapAsync(e,t),a=await this.buildDatatypePropertyNamesAsync(e,t);for(let[i,s]of Object.entries(e.body))typeof s=="object"&&s!==null&&!Array.isArray(s)&&this.validateEntityReferences(i,s,n,r,a,e,o);return o}async buildEntitySourceMapAsync(e,t){let o=new Map,n=new Set,r=new Map;for(let a of Object.keys(e.body)){let i=e.metadata.namespace_?.toString()??"";o.has(a)||o.set(a,[]),o.get(a).push(`(local:${i})`)}if(e.metadata.imports)for(let[a,i]of Object.entries(e.metadata.imports))for(let s of i){let p=await t.getHighestCompatibleVersionAsync(a,s);if(p){let l=p.metadata.namespace_?.toString()??"";await this.collectEntitiesRecursivelyAsync(p,o,n,r,[l],t)}}return{entitySources:o,importPaths:r}}async collectEntitiesRecursivelyAsync(e,t,o,n,r,a){let i=e.metadata.namespace_?.toString()??"";if(!o.has(i)){o.add(i),n.has(i)||n.set(i,r);for(let s of Object.keys(e.body)){t.has(s)||t.set(s,[]);let p=t.get(s);p.includes(i)||p.push(i)}if(e.metadata.imports)for(let[s,p]of Object.entries(e.metadata.imports))for(let l of p){let m=await a.getHighestCompatibleVersionAsync(s,l);if(m){let f=m.metadata.namespace_?.toString()??"";await this.collectEntitiesRecursivelyAsync(m,t,o,n,[...r,f],a)}}}}async buildDatatypePropertyNamesAsync(e,t){let o=new Set,n=new Set;if(await this.collectDatatypePropertiesAsync(e,o,n,t),e.metadata.imports)for(let[r,a]of Object.entries(e.metadata.imports))for(let i of a){let s=await t.getHighestCompatibleVersionAsync(r,i);s&&await this.collectDatatypePropertiesAsync(s,o,n,t)}return o}async collectDatatypePropertiesAsync(e,t,o,n){let r=e.metadata.namespace_?.toString()??"";if(!o.has(r)){o.add(r);for(let[a,i]of Object.entries(e.body)){if(typeof i!="object"||i===null||Array.isArray(i))continue;let s=i.type;if(typeof s!="string")continue;(s.includes(".")?s.substring(s.lastIndexOf(".")+1):s)==="DatatypeProperty"&&t.add(a)}if(e.metadata.imports)for(let[a,i]of Object.entries(e.metadata.imports))for(let s of i){let p=await n.getHighestCompatibleVersionAsync(a,s);p&&await this.collectDatatypePropertiesAsync(p,t,o,n)}}}validateEntityReferences(e,t,o,n,r,a,i){for(let[s,p]of Object.entries(t)){let l=s;if(l&&!l.includes(".")){let m=o.get(l);if(m&&m.length>1&&!m.some(R=>R.startsWith("(local:"))){let R=m.filter(E=>!E.startsWith("(local:"));R.length>1&&i.push(this.createAmbiguityError(e,l,`Property '${l}'`,R,n,a,!0,l))}}this.validatePropertyValue(e,l,p,o,n,r,a,i)}}validatePropertyValue(e,t,o,n,r,a,i,s){if(o==null)return;let p=t&&t.includes(".")?t.substring(t.lastIndexOf(".")+1):t,l=!!p&&a.has(p);if(typeof o=="string"&&!o.includes(".")&&!l){let m=n.get(o);if(m&&m.length>1&&!m.some(R=>R.startsWith("(local:"))){let R=m.filter(E=>!E.startsWith("(local:"));R.length>1&&s.push(this.createAmbiguityError(e,t,`Reference '${o}'`,R,r,i,!1,o))}}else if(Array.isArray(o))for(let m=0;m<o.length;m++){let f=`${e}.${t}[${m}]`;this.validatePropertyValue(f,t,o[m],n,r,a,i,s)}else if(typeof o=="object"&&!Array.isArray(o)){let m=t?`${e}.${t}`:e;this.validateEntityReferences(m,o,n,r,a,i,s)}}createAmbiguityError(e,t,o,n,r,a,i,s){let p=[];for(let j of n){let U=this.findAliasForNamespace(a,j);if(U){let B=t?.split(".").pop()??t;p.push(`${U}.${B}`)}}let l=p.length>0?`Use one of: ${p.map(j=>`'${j}'`).join(", ")}`:`Add aliases to imports and use qualified names (e.g., 'alias.${t}')`,m=n.map(j=>{let U=r.get(j);return!U||U.length===0?` \u2022 ${j}`:U.length===1?` \u2022 ${j} (direct import)`:` \u2022 ${j}
15
- imported via: ${U.join(" \u2192 ")}`}).join(`
14
+ 3. Alias-qualify it if it lives in an imported namespace ('alias.${t}')`,a}};var he=class{get ruleName(){return"AmbiguousReference"}async validateAsync(e,t){let o=[],{entitySources:n,importPaths:r}=await this.buildEntitySourceMapAsync(e,t),a=await this.buildDatatypePropertyNamesAsync(e,t);for(let[i,s]of Object.entries(e.body))typeof s=="object"&&s!==null&&!Array.isArray(s)&&this.validateEntityReferences(i,s,n,r,a,e,o);return o}async buildEntitySourceMapAsync(e,t){let o=new Map,n=new Set,r=new Map;for(let a of Object.keys(e.body)){let i=e.metadata.namespace_?.toString()??"";o.has(a)||o.set(a,[]),o.get(a).push(`(local:${i})`)}if(e.metadata.imports)for(let[a,i]of Object.entries(e.metadata.imports))for(let s of i){let p=await t.getHighestCompatibleVersionAsync(a,s);if(p){let l=p.metadata.namespace_?.toString()??"";await this.collectEntitiesRecursivelyAsync(p,o,n,r,[l],t)}}return{entitySources:o,importPaths:r}}async collectEntitiesRecursivelyAsync(e,t,o,n,r,a){let i=e.metadata.namespace_?.toString()??"";if(!o.has(i)){o.add(i),n.has(i)||n.set(i,r);for(let s of Object.keys(e.body)){t.has(s)||t.set(s,[]);let p=t.get(s);p.includes(i)||p.push(i)}if(e.metadata.imports)for(let[s,p]of Object.entries(e.metadata.imports))for(let l of p){let m=await a.getHighestCompatibleVersionAsync(s,l);if(m){let f=m.metadata.namespace_?.toString()??"";await this.collectEntitiesRecursivelyAsync(m,t,o,n,[...r,f],a)}}}}async buildDatatypePropertyNamesAsync(e,t){let o=new Set,n=new Set;if(await this.collectDatatypePropertiesAsync(e,o,n,t),e.metadata.imports)for(let[r,a]of Object.entries(e.metadata.imports))for(let i of a){let s=await t.getHighestCompatibleVersionAsync(r,i);s&&await this.collectDatatypePropertiesAsync(s,o,n,t)}return o}async collectDatatypePropertiesAsync(e,t,o,n){let r=e.metadata.namespace_?.toString()??"";if(!o.has(r)){o.add(r);for(let[a,i]of Object.entries(e.body)){if(typeof i!="object"||i===null||Array.isArray(i))continue;let s=i.type;if(typeof s!="string")continue;(s.includes(".")?s.substring(s.lastIndexOf(".")+1):s)==="DatatypeProperty"&&t.add(a)}if(e.metadata.imports)for(let[a,i]of Object.entries(e.metadata.imports))for(let s of i){let p=await n.getHighestCompatibleVersionAsync(a,s);p&&await this.collectDatatypePropertiesAsync(p,t,o,n)}}}validateEntityReferences(e,t,o,n,r,a,i){for(let[s,p]of Object.entries(t)){let l=s;if(l&&!l.includes(".")){let m=o.get(l);if(m&&m.length>1&&!m.some(R=>R.startsWith("(local:"))){let R=m.filter(E=>!E.startsWith("(local:"));R.length>1&&i.push(this.createAmbiguityError(e,l,`Property '${l}'`,R,n,a,!0,l))}}this.validatePropertyValue(e,l,p,o,n,r,a,i)}}validatePropertyValue(e,t,o,n,r,a,i,s){if(o==null)return;let p=t&&t.includes(".")?t.substring(t.lastIndexOf(".")+1):t,l=!!p&&a.has(p);if(typeof o=="string"&&!o.includes(".")&&!l){let m=n.get(o);if(m&&m.length>1&&!m.some(R=>R.startsWith("(local:"))){let R=m.filter(E=>!E.startsWith("(local:"));R.length>1&&s.push(this.createAmbiguityError(e,t,`Reference '${o}'`,R,r,i,!1,o))}}else if(Array.isArray(o))for(let m=0;m<o.length;m++){let f=`${e}.${t}[${m}]`;this.validatePropertyValue(f,t,o[m],n,r,a,i,s)}else if(typeof o=="object"&&!Array.isArray(o)){let m=t?`${e}.${t}`:e;this.validateEntityReferences(m,o,n,r,a,i,s)}}createAmbiguityError(e,t,o,n,r,a,i,s){let p=[];for(let j of n){let $=this.findAliasForNamespace(a,j);if($){let B=t?.split(".").pop()??t;p.push(`${$}.${B}`)}}let l=p.length>0?`Use one of: ${p.map(j=>`'${j}'`).join(", ")}`:`Add aliases to imports and use qualified names (e.g., 'alias.${t}')`,m=n.map(j=>{let $=r.get(j);return!$||$.length===0?` \u2022 ${j}`:$.length===1?` \u2022 ${j} (direct import)`:` \u2022 ${j}
15
+ imported via: ${$.join(" \u2192 ")}`}).join(`
16
16
  `),f=e.split(".")[0],R=e.includes(".")?e:t,E=new u;E.ruleType=this.ruleName,E.severity="Error",E.entityName=f,R&&(E.propertyName=R);let N=s??t;return N&&(E.actualValue=N),E.message=`${o} is ambiguous - defined in multiple imported namespaces`,E.suggestion=`${l}
17
17
 
18
18
  Defined in:
19
- ${m}`,E.expectedValue="Unambiguous reference (use namespace alias to disambiguate)",E}findAliasForNamespace(e,t){if(!e.metadata.imports)return null;for(let[o,n]of Object.entries(e.metadata.imports))for(let r of n)if(`${o}/${r.packageName}@${r.version}`===t&&r.alias)return r.alias;return null}};var Yt={publisher:"kanonak.org",package_:"core-rdf",name:"range"},Ge=c=>c,Re=class{ruleName="PropertyRangeReference";async validateAsync(e,t,o){let n=[],r=await D(e,t,o),a=await C(e,t,o);for(let i of a){if(!(i instanceof y))continue;let s=d.isObjectPropertyType(Ge(i));if(!(!s&&!d.isDatatypePropertyType(Ge(i))))for(let p of qt(i,Yt))this.resolvesToClassLike(r,p)||n.push(this.error(i.name,p,s))}return n}resolvesToClassLike(e,t){let o=k(e,t);return o?d.isClassType(Ge(o))||d.isDatatypeType(Ge(o)):!1}error(e,t,o){let n=`${t.publisher}/${t.package_}/${t.name}`,r=new u;return r.ruleType=this.ruleName,r.severity="Error",r.entityName=e,r.propertyName="range",r.actualValue=n,r.expectedValue=o?"A defined or imported class":"A datatype or defined class",r.message=`Property '${e}' has range '${t.name}' which is not defined or imported`,r.suggestion=o?`Define '${t.name}' as a Class here, or import the namespace that contains it (alias-qualify it if imported under an alias).`:`Use a datatype (xsd type, rdfs.Literal, or a datatype-derived type), or \u2014 if '${t.name}' is a class \u2014 make this an ObjectProperty.`,r}};function qt(c,e){let t=g(c,e);if(t)return[t];let o=[];for(let n of V(c,e))n instanceof I&&o.push(n.subject);return o}var zt={publisher:"kanonak.org",package_:"core-rdf",name:"range"},Ke="kanonak.org",Ze="core-rdf",Je="core-owl",Xt=c=>c,Zt=[{uri:{publisher:Ke,package_:Ze,name:"Class"},ok:c=>d.isClassType(c)||d.isDatatypeType(c)},{uri:{publisher:Ke,package_:Ze,name:"Datatype"},ok:c=>d.isDatatypeType(c)},{uri:{publisher:Ke,package_:Ze,name:"Property"},ok:c=>d.isAnyPropertyType(c)},{uri:{publisher:Ke,package_:Je,name:"ObjectProperty"},ok:c=>d.isObjectPropertyType(c)},{uri:{publisher:Ke,package_:Je,name:"DatatypeProperty"},ok:c=>d.isDatatypePropertyType(c)},{uri:{publisher:Ke,package_:Je,name:"AnnotationProperty"},ok:c=>d.isAnnotationPropertyType(c)}],be=class{ruleName="ObjectPropertyValue";async validateAsync(e,t,o){let n=[],r=await D(e,t,o),a=await oe(e,t,o);for(let i of a)i instanceof y&&this.walk(r,i,i.name,n);return n}walk(e,t,o,n){for(let r of t.statement)if(r instanceof Me)this.check(e,r.predicate?.subject,r.object.subject,o,n);else if(r instanceof H)this.walk(e,r.object,kt(o,r.predicate?.subject),n);else if(r instanceof F){let a=r.predicate?.subject;for(let i of r.object)i instanceof I?this.check(e,a,i.subject,o,n):i instanceof v&&this.walk(e,i,kt(o,a),n)}}check(e,t,o,n,r){if(!t)return;let a=k(e,t);if(!a)return;let i=g(a,zt);if(!i)return;let s=Zt.find(l=>z(i,l.uri));if(!s)return;let p=k(e,o);p&&(s.ok(Xt(p))||r.push(this.warn(n,t,i,o)))}warn(e,t,o,n){let r=new u;return r.ruleType=this.ruleName,r.severity="Warning",r.entityName=e.split(".")[0],r.propertyName=e,r.actualValue=n.name,r.expectedValue=o.name,r.message=`Property '${t.name}' expects a ${o.name}, but '${n.name}' is not a ${o.name}`,r.suggestion=`Reference a resource that is a ${o.name}, or correct the type of '${n.name}'.`,r}};function kt(c,e){return`${c}.${e?.name??"<embedded>"}`}var Jt={publisher:"kanonak.org",package_:"core-rdf",name:"type"},Qt={publisher:"kanonak.org",package_:"core-rdf",name:"domain"},eo={publisher:"kanonak.org",package_:"core-rdf",name:"Resource"},Ve=class{ruleName="PropertyDomain";async validateAsync(e,t,o){let n=[],r=await D(e,t,o),a=await oe(e,t,o);for(let i of a)i instanceof y&&this.walk(r,i,i.name,n);return n}walk(e,t,o,n){this.checkNode(e,t,o,n);for(let r of t.statement)if(r instanceof H)this.walk(e,r.object,Rt(o,r.predicate?.subject),n);else if(r instanceof F)for(let a of r.object)a instanceof v&&this.walk(e,a,Rt(o,r.predicate?.subject),n)}checkNode(e,t,o,n){let r=ht(t,Jt);if(r.length===0)return;let a,i=()=>{if(!a){a=new Set([K(eo)]);for(let p of r)for(let l of Y(e,p))a.add(K(l))}return a},s=new Set;for(let p of t.statement){let l=to(p);if(!l||Be(l.name)||s.has(K(l)))continue;s.add(K(l));let m=k(e,l);if(!m)continue;let f=ht(m,Qt);f.length!==0&&(f.some(R=>i().has(K(R)))||n.push(this.error(o,l,f,r[0])))}}error(e,t,o,n){let r=o.map(i=>i.name).join(" | "),a=new u;return a.ruleType=this.ruleName,a.severity="Error",a.entityName=e.split(".")[0],a.propertyName=e,a.actualValue=t.name,a.expectedValue=`Property used on ${r} or its subclasses`,a.message=`Property '${t.name}' has domain '${r}' but is used on '${n.name}' at '${e}'`,a.suggestion=`Either:
19
+ ${m}`,E.expectedValue="Unambiguous reference (use namespace alias to disambiguate)",E}findAliasForNamespace(e,t){if(!e.metadata.imports)return null;for(let[o,n]of Object.entries(e.metadata.imports))for(let r of n)if(`${o}/${r.packageName}@${r.version}`===t&&r.alias)return r.alias;return null}};var zt={publisher:"kanonak.org",package_:"core-rdf",name:"range"},Ye=c=>c,Re=class{ruleName="PropertyRangeReference";async validateAsync(e,t,o){let n=[],r=await D(e,t,o),a=await C(e,t,o);for(let i of a){if(!(i instanceof d))continue;let s=y.isObjectPropertyType(Ye(i));if(!(!s&&!y.isDatatypePropertyType(Ye(i))))for(let p of Xt(i,zt))this.resolvesToClassLike(r,p)||n.push(this.error(i.name,p,s))}return n}resolvesToClassLike(e,t){let o=h(e,t);return o?y.isClassType(Ye(o))||y.isDatatypeType(Ye(o)):!1}error(e,t,o){let n=`${t.publisher}/${t.package_}/${t.name}`,r=new u;return r.ruleType=this.ruleName,r.severity="Error",r.entityName=e,r.propertyName="range",r.actualValue=n,r.expectedValue=o?"A defined or imported class":"A datatype or defined class",r.message=`Property '${e}' has range '${t.name}' which is not defined or imported`,r.suggestion=o?`Define '${t.name}' as a Class here, or import the namespace that contains it (alias-qualify it if imported under an alias).`:`Use a datatype (xsd type, rdfs.Literal, or a datatype-derived type), or \u2014 if '${t.name}' is a class \u2014 make this an ObjectProperty.`,r}};function Xt(c,e){let t=g(c,e);if(t)return[t];let o=[];for(let n of V(c,e))n instanceof I&&o.push(n.subject);return o}var Zt={publisher:"kanonak.org",package_:"core-rdf",name:"range"},Ke="kanonak.org",Je="core-rdf",Qe="core-owl",Jt=c=>c,Qt=[{uri:{publisher:Ke,package_:Je,name:"Class"},ok:c=>y.isClassType(c)||y.isDatatypeType(c)},{uri:{publisher:Ke,package_:Je,name:"Datatype"},ok:c=>y.isDatatypeType(c)},{uri:{publisher:Ke,package_:Je,name:"Property"},ok:c=>y.isAnyPropertyType(c)},{uri:{publisher:Ke,package_:Qe,name:"ObjectProperty"},ok:c=>y.isObjectPropertyType(c)},{uri:{publisher:Ke,package_:Qe,name:"DatatypeProperty"},ok:c=>y.isDatatypePropertyType(c)},{uri:{publisher:Ke,package_:Qe,name:"AnnotationProperty"},ok:c=>y.isAnnotationPropertyType(c)}],be=class{ruleName="ObjectPropertyValue";async validateAsync(e,t,o){let n=[],r=await D(e,t,o),a=await oe(e,t,o);for(let i of a)i instanceof d&&this.walk(r,i,i.name,n);return n}walk(e,t,o,n){for(let r of t.statement)if(r instanceof Be)this.check(e,r.predicate?.subject,r.object.subject,o,n);else if(r instanceof H)this.walk(e,r.object,Rt(o,r.predicate?.subject),n);else if(r instanceof F){let a=r.predicate?.subject;for(let i of r.object)i instanceof I?this.check(e,a,i.subject,o,n):i instanceof v&&this.walk(e,i,Rt(o,a),n)}}check(e,t,o,n,r){if(!t)return;let a=h(e,t);if(!a)return;let i=g(a,Zt);if(!i)return;let s=Qt.find(l=>z(i,l.uri));if(!s)return;let p=h(e,o);p&&(s.ok(Jt(p))||r.push(this.warn(n,t,i,o)))}warn(e,t,o,n){let r=new u;return r.ruleType=this.ruleName,r.severity="Warning",r.entityName=e.split(".")[0],r.propertyName=e,r.actualValue=n.name,r.expectedValue=o.name,r.message=`Property '${t.name}' expects a ${o.name}, but '${n.name}' is not a ${o.name}`,r.suggestion=`Reference a resource that is a ${o.name}, or correct the type of '${n.name}'.`,r}};function Rt(c,e){return`${c}.${e?.name??"<embedded>"}`}var eo={publisher:"kanonak.org",package_:"core-rdf",name:"type"},to={publisher:"kanonak.org",package_:"core-rdf",name:"domain"},oo={publisher:"kanonak.org",package_:"core-rdf",name:"Resource"},Ve=class{ruleName="PropertyDomain";async validateAsync(e,t,o){let n=[],r=await D(e,t,o),a=await oe(e,t,o);for(let i of a)i instanceof d&&this.walk(r,i,i.name,n);return n}walk(e,t,o,n){this.checkNode(e,t,o,n);for(let r of t.statement)if(r instanceof H)this.walk(e,r.object,bt(o,r.predicate?.subject),n);else if(r instanceof F)for(let a of r.object)a instanceof v&&this.walk(e,a,bt(o,r.predicate?.subject),n)}checkNode(e,t,o,n){let r=Kt(t,eo);if(r.length===0)return;let a,i=()=>{if(!a){a=new Set([K(oo)]);for(let p of r)for(let l of Y(e,p))a.add(K(l))}return a},s=new Set;for(let p of t.statement){let l=no(p);if(!l||Fe(l.name)||s.has(K(l)))continue;s.add(K(l));let m=h(e,l);if(!m)continue;let f=Kt(m,to);f.length!==0&&(f.some(R=>i().has(K(R)))||n.push(this.error(o,l,f,r[0])))}}error(e,t,o,n){let r=o.map(i=>i.name).join(" | "),a=new u;return a.ruleType=this.ruleName,a.severity="Error",a.entityName=e.split(".")[0],a.propertyName=e,a.actualValue=t.name,a.expectedValue=`Property used on ${r} or its subclasses`,a.message=`Property '${t.name}' has domain '${r}' but is used on '${n.name}' at '${e}'`,a.suggestion=`Either:
20
20
  1. Use '${t.name}' only on '${r}' (or a subclass) instances
21
21
  2. Widen the property's domain to include '${n.name}'
22
- 3. Use a different property for '${n.name}'`,a}};function to(c){return c.predicate?.subject}function ht(c,e){let t=g(c,e);if(t)return[t];let o=[];for(let n of V(c,e))n instanceof I&&o.push(n.subject);return o}function Rt(c,e){return`${c}.${e?.name??"<embedded>"}`}var oo={publisher:"kanonak.org",package_:"core-rdf",name:"range"},no={publisher:"kanonak.org",package_:"core-rdf",name:"Literal"},Qe=c=>c,Ee=class{ruleName="PropertyKindRangeConsistency";async validateAsync(e,t,o){let n=[],r=await D(e,t,o),a=await C(e,t,o);for(let i of a){if(!(i instanceof y))continue;let s=d.isObjectPropertyType(Qe(i)),p=d.isDatatypePropertyType(Qe(i));if(!s&&!p)continue;let l=g(i,oo);if(!l||!k(r,l))continue;let m=ro(r,l);p&&!m?n.push(this.error(i.name,l,"datatype")):s&&m&&n.push(this.error(i.name,l,"object"))}return n}error(e,t,o){let n=new u;return n.ruleType=this.ruleName,n.severity="Error",n.entityName=e,n.propertyName="range",n.actualValue=t.name,o==="datatype"?(n.expectedValue="A datatype (xsd type, rdfs.Literal, or a datatype-derived class)",n.message=`DatatypeProperty '${e}' has range '${t.name}', which is a class, not a datatype. A datatype property's values are literals.`,n.suggestion=`Use a datatype range (e.g. xsd.string, rdfs.Literal, or a datatype-derived class), or \u2014 if '${t.name}' is the intended target \u2014 declare '${e}' an ObjectProperty.`):(n.expectedValue="A plain class (not datatype-derived)",n.message=`ObjectProperty '${e}' has range '${t.name}', which is a datatype, not a class. An object property's values are references to resources.`,n.suggestion=`Declare '${e}' a DatatypeProperty (its values are literals of '${t.name}'), or change the range to a plain class.`),n}};function ro(c,e){for(let t of Y(c,e)){if(z(t,no))return!0;let o=k(c,t);if(o&&d.isDatatypeType(Qe(o)))return!0}return!1}var ao={publisher:"kanonak.org",package_:"core-rdf",name:"type"},Kt=c=>c,ve=class{ruleName="ClassDefinition";async validateAsync(e,t,o){let n=[],r=await D(e,t,o),a=await C(e,t,o);return q(a,({kanonak:i,path:s})=>{for(let p of io(i,ao))this.resolvesToClassLike(r,p)||n.push(this.error(s,p))}),n}resolvesToClassLike(e,t){if(Be(t.name))return!0;let o=k(e,t);return o?d.isClassType(Kt(o))||d.isDatatypeType(Kt(o)):!1}error(e,t){let o=`${t.publisher}/${t.package_}/${t.name}`,n=new u;return n.ruleType=this.ruleName,n.severity="Error",n.entityName=e,n.propertyName="type",n.actualValue=o,n.expectedValue="Defined or imported class",n.message=`Class '${t.name}' is not defined or imported`,n.suggestion=`Define '${t.name}' as a Class in this document, or import a namespace that contains it`,n}};function io(c,e){let t=g(c,e);if(t)return[t];let o=[];for(let n of V(c,e))n instanceof I&&o.push(n.subject);return o}var De=class{ruleName="MarkdownLink";async validateAsync(e,t,o){let n=[],r=await C(e,t,o);return q(r,({kanonak:a,path:i})=>{this.checkNode(a,i,n)}),n}checkNode(e,t,o){for(let n of e.statement){if(!(n instanceof at))continue;let r=n.predicate.subject?.name??"(unknown)";for(let a of n.links)a.target||o.push(this.unresolvedLinkError(t,r,a.reference));for(let a of it(n.object))o.push(this.malformedLinkError(t,r,a.snippet))}}unresolvedLinkError(e,t,o){let n=new u;return n.ruleType=this.ruleName,n.severity="Error",n.entityName=e,n.propertyName=t,n.actualValue=o,n.message=`Embedded link [[${o}]] in '${t}' could not be resolved`,n.expectedValue="A reference resolvable through the document's import closure",n.suggestion=`The reference '${o}' inside a markdown value cannot be found in the current document or any imported namespace.
22
+ 3. Use a different property for '${n.name}'`,a}};function no(c){return c.predicate?.subject}function Kt(c,e){let t=g(c,e);if(t)return[t];let o=[];for(let n of V(c,e))n instanceof I&&o.push(n.subject);return o}function bt(c,e){return`${c}.${e?.name??"<embedded>"}`}var ro={publisher:"kanonak.org",package_:"core-rdf",name:"range"},ao={publisher:"kanonak.org",package_:"core-rdf",name:"Literal"},et=c=>c,Ee=class{ruleName="PropertyKindRangeConsistency";async validateAsync(e,t,o){let n=[],r=await D(e,t,o),a=await C(e,t,o);for(let i of a){if(!(i instanceof d))continue;let s=y.isObjectPropertyType(et(i)),p=y.isDatatypePropertyType(et(i));if(!s&&!p)continue;let l=g(i,ro);if(!l||!h(r,l))continue;let m=io(r,l);p&&!m?n.push(this.error(i.name,l,"datatype")):s&&m&&n.push(this.error(i.name,l,"object"))}return n}error(e,t,o){let n=new u;return n.ruleType=this.ruleName,n.severity="Error",n.entityName=e,n.propertyName="range",n.actualValue=t.name,o==="datatype"?(n.expectedValue="A datatype (xsd type, rdfs.Literal, or a datatype-derived class)",n.message=`DatatypeProperty '${e}' has range '${t.name}', which is a class, not a datatype. A datatype property's values are literals.`,n.suggestion=`Use a datatype range (e.g. xsd.string, rdfs.Literal, or a datatype-derived class), or \u2014 if '${t.name}' is the intended target \u2014 declare '${e}' an ObjectProperty.`):(n.expectedValue="A plain class (not datatype-derived)",n.message=`ObjectProperty '${e}' has range '${t.name}', which is a datatype, not a class. An object property's values are references to resources.`,n.suggestion=`Declare '${e}' a DatatypeProperty (its values are literals of '${t.name}'), or change the range to a plain class.`),n}};function io(c,e){for(let t of Y(c,e)){if(z(t,ao))return!0;let o=h(c,t);if(o&&y.isDatatypeType(et(o)))return!0}return!1}var ve=class{ruleName="ReservedNameShadow";async validateAsync(e,t,o){let n=[],r=await C(e,t,o);for(let a of r){if(!(a instanceof d))continue;let i=st(a.name);if(!i)continue;let s=A(a);s&&(i.publisher===s.publisher&&i.package_===s.package_||n.push(this.info(a.name,s,i)))}return n}info(e,t,o){let n=new u;return n.ruleType=this.ruleName,n.severity="Info",n.entityName=e,n.propertyName=e,n.actualValue=`${t.publisher}/${t.package_}/${e}`,n.expectedValue=`${o.publisher}/${o.package_}/${e}`,n.message=`'${e}' is also the reserved built-in '${o.publisher}/${o.package_}/${e}'. This local definition shadows it \u2014 a bare '${e}' reference in this package resolves to the local entity, not the built-in.`,n.suggestion=`If this is intentional, qualify bare references to '${e}' explicitly (this local one vs. the built-in '${o.publisher}/${o.package_}/${e}') so the choice is unambiguous to readers and tools \u2014 e.g. a self-referential 'subClassOf: ${e}' silently resolves to this local entity.`,n}};var so={publisher:"kanonak.org",package_:"core-rdf",name:"type"},Vt=c=>c,De=class{ruleName="ClassDefinition";async validateAsync(e,t,o){let n=[],r=await D(e,t,o),a=await C(e,t,o);return q(a,({kanonak:i,path:s})=>{for(let p of co(i,so))this.resolvesToClassLike(r,p)||n.push(this.error(s,p))}),n}resolvesToClassLike(e,t){if(Fe(t.name))return!0;let o=h(e,t);return o?y.isClassType(Vt(o))||y.isDatatypeType(Vt(o)):!1}error(e,t){let o=`${t.publisher}/${t.package_}/${t.name}`,n=new u;return n.ruleType=this.ruleName,n.severity="Error",n.entityName=e,n.propertyName="type",n.actualValue=o,n.expectedValue="Defined or imported class",n.message=`Class '${t.name}' is not defined or imported`,n.suggestion=`Define '${t.name}' as a Class in this document, or import a namespace that contains it`,n}};function co(c,e){let t=g(c,e);if(t)return[t];let o=[];for(let n of V(c,e))n instanceof I&&o.push(n.subject);return o}var Ie=class{ruleName="MarkdownLink";async validateAsync(e,t,o){let n=[],r=await C(e,t,o);return q(r,({kanonak:a,path:i})=>{this.checkNode(a,i,n)}),n}checkNode(e,t,o){for(let n of e.statement){if(!(n instanceof it))continue;let r=n.predicate.subject?.name??"(unknown)";for(let a of n.links)a.target||o.push(this.unresolvedLinkError(t,r,a.reference));for(let a of ct(n.object))o.push(this.malformedLinkError(t,r,a.snippet))}}unresolvedLinkError(e,t,o){let n=new u;return n.ruleType=this.ruleName,n.severity="Error",n.entityName=e,n.propertyName=t,n.actualValue=o,n.message=`Embedded link [[${o}]] in '${t}' could not be resolved`,n.expectedValue="A reference resolvable through the document's import closure",n.suggestion=`The reference '${o}' inside a markdown value cannot be found in the current document or any imported namespace.
23
23
 
24
24
  Possible solutions:
25
25
  \u2022 Import the package that defines '${o}' so the link can resolve
@@ -31,22 +31,22 @@ long reference across two lines in a block scalar, e.g.:
31
31
  ... read for [[persistent-energy-
32
32
  shock]] held ...
33
33
  which is parsed as literal text, not a link. Keep each [[reference]] on one
34
- line (let the line run long), or check for an unterminated [[.`,n}};var bt="kanonak.org",Vt="look",so={publisher:bt,package_:Vt,name:"displayLabel"},co={publisher:bt,package_:Vt,name:"displaySummary"},Ie=class{ruleName="DisplayLensScope";async validateAsync(e,t,o){let n=[],r;o?r=await o.getKanonaks():r=await new S().parseKanonaks(new G(e,t));let a=po(e);if(!a)return n;for(let i of r)i instanceof y&&i.namespace===a&&(this.checkLens(r,i,so,"displayLabel",n),this.checkLens(r,i,co,"displaySummary",n));return n}checkLens(e,t,o,n,r){let a=g(t,o);if(!a)return;let i=[],s=x(t);if(s&&i.push(s),i.push(...ct(t)),i.length===0)return;i.some(l=>L(e,l,a).ok)||r.push(this.scopeError(t.name,n,a.name))}scopeError(e,t,o){let n=new u;return n.ruleType=this.ruleName,n.severity="Error",n.entityName=e,n.propertyName=t,n.actualValue=o,n.message=`${t} points at '${o}', which is not a property in scope for '${e}'`,n.expectedValue="A property whose domain is this resource's class, an ancestor, or rdfs.Resource",n.suggestion=`'${o}' resolves, but its domain does not cover '${e}', so the lens would silently fall back to the resource's name at render time.
34
+ line (let the line run long), or check for an unterminated [[.`,n}};var Et="kanonak.org",vt="look",po={publisher:Et,package_:vt,name:"displayLabel"},lo={publisher:Et,package_:vt,name:"displaySummary"},Ce=class{ruleName="DisplayLensScope";async validateAsync(e,t,o){let n=[],r;o?r=await o.getKanonaks():r=await new S().parseKanonaks(new G(e,t));let a=mo(e);if(!a)return n;for(let i of r)i instanceof d&&i.namespace===a&&(this.checkLens(r,i,po,"displayLabel",n),this.checkLens(r,i,lo,"displaySummary",n));return n}checkLens(e,t,o,n,r){let a=g(t,o);if(!a)return;let i=[],s=A(t);if(s&&i.push(s),i.push(...lt(t)),i.length===0)return;i.some(l=>L(e,l,a).ok)||r.push(this.scopeError(t.name,n,a.name))}scopeError(e,t,o){let n=new u;return n.ruleType=this.ruleName,n.severity="Error",n.entityName=e,n.propertyName=t,n.actualValue=o,n.message=`${t} points at '${o}', which is not a property in scope for '${e}'`,n.expectedValue="A property whose domain is this resource's class, an ancestor, or rdfs.Resource",n.suggestion=`'${o}' resolves, but its domain does not cover '${e}', so the lens would silently fall back to the resource's name at render time.
35
35
 
36
36
  Possible solutions:
37
37
  \u2022 Point ${t} at a property declared on this class (or an ancestor / rdfs.Resource)
38
38
  \u2022 Set the property's domain to this class if it should apply here
39
- \u2022 Use rdfs.label / rdfs.comment for the universal default`,n}};function po(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${$(e.version)}`}function X(c,e,t){let o=[];return xe(c,t,{input:e},o),o}function xe(c,e,t,o){if(P(e,M.VarRef)){let a=W(e,M.varName);return a?t[a]:void 0}if(P(e,M.PropertyRead)){let a=O(e,M.readSource),i=a?xe(c,a,t,o):void 0,s=g(e,M.readProp);if(!i||!s)return;let p=L(c,i,s);if(!p.ok){o.push({contextClass:i,propertyUri:s,via:"PropertyRead"});return}return p.descriptor?.range}if(P(e,M.Traverse)){let a=O(e,M.traverseSource),i=a?xe(c,a,t,o):void 0,s=g(e,M.through),p;if(i&&s){let m=L(c,i,s);m.ok?p=m.descriptor?.range:o.push({contextClass:i,propertyUri:s,via:"Traverse"})}let l=O(e,M.step);return l?xe(c,l,{...t,input:p},o):void 0}let n=W(e,M.loopVar),r=n?{...t,[n]:void 0}:t;for(let a of lo(e))xe(c,a,r,o)}function lo(c){let e=[];for(let t of c.statement){let o=t.object;if(o instanceof v)e.push(o);else if(Array.isArray(o))for(let n of o)n instanceof v&&e.push(n)}return e}var Te="kanonak.org",Ne="look",mo={publisher:Te,package_:Ne,name:"semanticSvg"},uo={publisher:Te,package_:Ne,name:"tierChip"},fo={publisher:Te,package_:Ne,name:"tierIcon"},yo={publisher:Te,package_:Ne,name:"tierCard"},go={publisher:Te,package_:Ne,name:"tierFull"},ko=[uo,fo,yo,go],Ce=class{ruleName="LookSemanticSvgPath";async validateAsync(e,t,o){let n=[],r;o?r=await o.getKanonaks():r=await new S().parseKanonaks(new G(e,t));let a=ho(e);if(!a)return n;for(let i of r)i instanceof y&&i.namespace===a&&this.checkSemanticSvg(r,i,n);return n}checkSemanticSvg(e,t,o){let n=O(t,mo);if(!n)return;let r=x(t);if(r)for(let a of ko){let i=O(n,a);if(i)for(let s of X(e,r,i))o.push(this.toError(t.name,a.name,s))}}toError(e,t,o){let n=`${o.propertyUri.publisher}/${o.propertyUri.package_}/${o.propertyUri.name}`,r=o.contextClass.name,a=r===e?`'${e}' (the class this SemanticSvg is declared on)`:`'${r}', reached by traversal from '${e}' (the class this SemanticSvg is declared on)`,i=new u;return i.ruleType=this.ruleName,i.severity="Error",i.entityName=e,i.propertyName=`look.semanticSvg.${t}`,i.actualValue=n,i.message=`tx.${o.via} reads property '${o.propertyUri.name}' off the rendered instance, but its domain is not in scope for ${a}. The read would silently return undefined at render time.`,i.expectedValue=`A property whose domain is '${r}', an ancestor, or rdfs.Resource`,i.suggestion=`Property '${n}' is not in scope for '${r}'.
39
+ \u2022 Use rdfs.label / rdfs.comment for the universal default`,n}};function mo(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${U(e.version)}`}function X(c,e,t){let o=[];return Te(c,t,{input:e},o),o}function Te(c,e,t,o){if(P(e,M.VarRef)){let a=W(e,M.varName);return a?t[a]:void 0}if(P(e,M.PropertyRead)){let a=O(e,M.readSource),i=a?Te(c,a,t,o):void 0,s=g(e,M.readProp);if(!i||!s)return;let p=L(c,i,s);if(!p.ok){o.push({contextClass:i,propertyUri:s,via:"PropertyRead"});return}return p.descriptor?.range}if(P(e,M.Traverse)){let a=O(e,M.traverseSource),i=a?Te(c,a,t,o):void 0,s=g(e,M.through),p;if(i&&s){let m=L(c,i,s);m.ok?p=m.descriptor?.range:o.push({contextClass:i,propertyUri:s,via:"Traverse"})}let l=O(e,M.step);return l?Te(c,l,{...t,input:p},o):void 0}let n=W(e,M.loopVar),r=n?{...t,[n]:void 0}:t;for(let a of uo(e))Te(c,a,r,o)}function uo(c){let e=[];for(let t of c.statement){let o=t.object;if(o instanceof v)e.push(o);else if(Array.isArray(o))for(let n of o)n instanceof v&&e.push(n)}return e}var Ne="kanonak.org",_e="look",fo={publisher:Ne,package_:_e,name:"semanticSvg"},yo={publisher:Ne,package_:_e,name:"tierChip"},go={publisher:Ne,package_:_e,name:"tierIcon"},ko={publisher:Ne,package_:_e,name:"tierCard"},ho={publisher:Ne,package_:_e,name:"tierFull"},Ro=[yo,go,ko,ho],Se=class{ruleName="LookSemanticSvgPath";async validateAsync(e,t,o){let n=[],r;o?r=await o.getKanonaks():r=await new S().parseKanonaks(new G(e,t));let a=Ko(e);if(!a)return n;for(let i of r)i instanceof d&&i.namespace===a&&this.checkSemanticSvg(r,i,n);return n}checkSemanticSvg(e,t,o){let n=O(t,fo);if(!n)return;let r=A(t);if(r)for(let a of Ro){let i=O(n,a);if(i)for(let s of X(e,r,i))o.push(this.toError(t.name,a.name,s))}}toError(e,t,o){let n=`${o.propertyUri.publisher}/${o.propertyUri.package_}/${o.propertyUri.name}`,r=o.contextClass.name,a=r===e?`'${e}' (the class this SemanticSvg is declared on)`:`'${r}', reached by traversal from '${e}' (the class this SemanticSvg is declared on)`,i=new u;return i.ruleType=this.ruleName,i.severity="Error",i.entityName=e,i.propertyName=`look.semanticSvg.${t}`,i.actualValue=n,i.message=`tx.${o.via} reads property '${o.propertyUri.name}' off the rendered instance, but its domain is not in scope for ${a}. The read would silently return undefined at render time.`,i.expectedValue=`A property whose domain is '${r}', an ancestor, or rdfs.Resource`,i.suggestion=`Property '${n}' is not in scope for '${r}'.
40
40
 
41
41
  Possible solutions:
42
42
  \u2022 Read a property declared on '${r}' (or an ancestor / rdfs.Resource)
43
43
  \u2022 If the property should apply to '${r}', adjust its domain
44
- \u2022 If the value comes from a pre-computed env binding, use tx.VarRef instead of PropertyRead`,i}};function ho(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${$(e.version)}`}var Ro="kanonak.org",b=(c,e)=>({publisher:Ro,package_:c,name:e}),Ko=b("derivation","look"),bo=b("look","bands"),Vo=b("look","Distribution"),Eo=b("look","StatRow"),vo=b("look","VersionDelta"),Do=b("look","Timeline"),Io=b("look","VersionDiff"),Co=b("look","TimePlot"),So=b("look","ReferenceList"),Po=b("look","Diagram"),jo=b("look","alphaPath"),Uo=b("look","betaPath"),et=b("look","metricPath"),Et=b("look","lowerPath"),vt=b("look","upperPath"),Dt=b("look","hueBy"),Oo=b("look","statPath"),$o=b("look","laneBy"),It=b("look","labelPath"),Ao=b("look","badgePath"),wo=b("look","mapPath"),xo=b("look","nodeNote"),To=b("look","edgeValue"),No=b("look","stats"),_o=b("look","facets"),Lo=b("look","channels"),Mo=b("look","track"),Bo=b("look","source"),Fo=b("look","relation"),Wo=b("look","entries"),_e=class{ruleName="LookBandPath";async validateAsync(e,t,o){let n=[],r;o?r=await o.getKanonaks():r=await new S().parseKanonaks(new G(e,t));let a=Go(e);if(!a)return n;for(let i of r)i instanceof y&&i.namespace===a&&this.checkDeclaration(r,i,n);return n}checkDeclaration(e,t,o){let n=O(t,Ko);if(!n)return;let r=x(t);if(!r)return;let a=V(n,bo).filter(i=>i instanceof v);for(let i of a)for(let s of this.carriersOf(e,i,r))for(let p of X(e,s.context,s.expr))o.push(this.toError(t.name,s.slot,p))}carriersOf(e,t,o){let n=[],r=(a,i)=>{let s=O(t,a);s&&n.push({slot:`look.${a.name}`,context:i,expr:s})};if(P(t,Vo))for(let a of[jo,Uo,et,Et,vt,Dt])r(a,o);if(P(t,vo)&&r(et,o),P(t,Eo)){let a=V(t,No).filter(i=>i instanceof v);for(let i of a){let s=O(i,Oo);s&&n.push({slot:"look.stats[].statPath",context:o,expr:s})}}if(P(t,Do)||P(t,Io)){let a=this.rangeOf(e,o,g(t,Mo));if(a)for(let i of[et,Et,vt,Dt])r(i,a)}if(P(t,Co)){let a=this.rangeOf(e,o,g(t,Bo));if(a)for(let i of[$o,It])r(i,a)}if(P(t,So))for(let a of V(t,Wo)){let i=a instanceof v?void 0:Ho(a),s=this.rangeOf(e,o,i);if(s)for(let p of[It,Ao])r(p,s)}if(P(t,Po)){let a=V(t,_o).filter(i=>i instanceof v);for(let i of a){let s=this.rangeOf(e,o,g(i,Fo));if(!s)continue;let p=O(i,xo);p&&n.push({slot:"look.facets[].nodeNote",context:s,expr:p});let l=O(i,To);l&&n.push({slot:"look.facets[].edgeValue",context:s,expr:l});let m=V(i,Lo).filter(f=>f instanceof v);for(let f of m){let R=O(f,wo);R&&n.push({slot:"look.facets[].channels[].mapPath",context:s,expr:R})}}}return n}rangeOf(e,t,o){if(!o)return;let n=L(e,t,o);return n.ok?n.descriptor?.range:void 0}toError(e,t,o){let n=`${o.propertyUri.publisher}/${o.propertyUri.package_}/${o.propertyUri.name}`,r=o.contextClass.name,a=new u;return a.ruleType=this.ruleName,a.severity="Error",a.entityName=e,a.propertyName=t,a.actualValue=n,a.message=`tx.${o.via} reads property '${o.propertyUri.name}', but its domain is not in scope for '${r}' (the class this band carrier is evaluated against). The read would silently return undefined at render time and the band would render empty.`,a.expectedValue=`A property whose domain is '${r}', an ancestor, or rdfs.Resource`,a.suggestion=`Property '${n}' is not in scope for '${r}'.
44
+ \u2022 If the value comes from a pre-computed env binding, use tx.VarRef instead of PropertyRead`,i}};function Ko(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${U(e.version)}`}var bo="kanonak.org",b=(c,e)=>({publisher:bo,package_:c,name:e}),Vo=b("derivation","look"),Eo=b("look","bands"),vo=b("look","Distribution"),Do=b("look","StatRow"),Io=b("look","VersionDelta"),Co=b("look","Timeline"),So=b("look","VersionDiff"),Po=b("look","TimePlot"),jo=b("look","ReferenceList"),$o=b("look","Diagram"),Oo=b("look","alphaPath"),Uo=b("look","betaPath"),tt=b("look","metricPath"),Dt=b("look","lowerPath"),It=b("look","upperPath"),Ct=b("look","hueBy"),Ao=b("look","statPath"),wo=b("look","laneBy"),St=b("look","labelPath"),xo=b("look","badgePath"),To=b("look","mapPath"),No=b("look","nodeNote"),_o=b("look","edgeValue"),Lo=b("look","stats"),Mo=b("look","facets"),Bo=b("look","channels"),Fo=b("look","track"),Wo=b("look","source"),Ho=b("look","relation"),Go=b("look","entries"),Le=class{ruleName="LookBandPath";async validateAsync(e,t,o){let n=[],r;o?r=await o.getKanonaks():r=await new S().parseKanonaks(new G(e,t));let a=qo(e);if(!a)return n;for(let i of r)i instanceof d&&i.namespace===a&&this.checkDeclaration(r,i,n);return n}checkDeclaration(e,t,o){let n=O(t,Vo);if(!n)return;let r=A(t);if(!r)return;let a=V(n,Eo).filter(i=>i instanceof v);for(let i of a)for(let s of this.carriersOf(e,i,r))for(let p of X(e,s.context,s.expr))o.push(this.toError(t.name,s.slot,p))}carriersOf(e,t,o){let n=[],r=(a,i)=>{let s=O(t,a);s&&n.push({slot:`look.${a.name}`,context:i,expr:s})};if(P(t,vo))for(let a of[Oo,Uo,tt,Dt,It,Ct])r(a,o);if(P(t,Io)&&r(tt,o),P(t,Do)){let a=V(t,Lo).filter(i=>i instanceof v);for(let i of a){let s=O(i,Ao);s&&n.push({slot:"look.stats[].statPath",context:o,expr:s})}}if(P(t,Co)||P(t,So)){let a=this.rangeOf(e,o,g(t,Fo));if(a)for(let i of[tt,Dt,It,Ct])r(i,a)}if(P(t,Po)){let a=this.rangeOf(e,o,g(t,Wo));if(a)for(let i of[wo,St])r(i,a)}if(P(t,jo))for(let a of V(t,Go)){let i=a instanceof v?void 0:Yo(a),s=this.rangeOf(e,o,i);if(s)for(let p of[St,xo])r(p,s)}if(P(t,$o)){let a=V(t,Mo).filter(i=>i instanceof v);for(let i of a){let s=this.rangeOf(e,o,g(i,Ho));if(!s)continue;let p=O(i,No);p&&n.push({slot:"look.facets[].nodeNote",context:s,expr:p});let l=O(i,_o);l&&n.push({slot:"look.facets[].edgeValue",context:s,expr:l});let m=V(i,Bo).filter(f=>f instanceof v);for(let f of m){let R=O(f,To);R&&n.push({slot:"look.facets[].channels[].mapPath",context:s,expr:R})}}}return n}rangeOf(e,t,o){if(!o)return;let n=L(e,t,o);return n.ok?n.descriptor?.range:void 0}toError(e,t,o){let n=`${o.propertyUri.publisher}/${o.propertyUri.package_}/${o.propertyUri.name}`,r=o.contextClass.name,a=new u;return a.ruleType=this.ruleName,a.severity="Error",a.entityName=e,a.propertyName=t,a.actualValue=n,a.message=`tx.${o.via} reads property '${o.propertyUri.name}', but its domain is not in scope for '${r}' (the class this band carrier is evaluated against). The read would silently return undefined at render time and the band would render empty.`,a.expectedValue=`A property whose domain is '${r}', an ancestor, or rdfs.Resource`,a.suggestion=`Property '${n}' is not in scope for '${r}'.
45
45
 
46
46
  Possible solutions:
47
47
  \u2022 Read a property declared on '${r}' (or an ancestor / rdfs.Resource)
48
48
  \u2022 If the property should apply to '${r}', adjust its domain
49
- \u2022 If the path is wrong, correct the tx.PropertyRead/tx.Traverse chain`,a}};function Ho(c){let e=c.subject;return e&&typeof e.name=="string"?e:void 0}function Go(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${$(e.version)}`}var Pe="kanonak.org",je="view",Yo={publisher:Pe,package_:je,name:"bind"},qo={publisher:Pe,package_:je,name:"produces"},zo={publisher:Pe,package_:je,name:"projections"},Xo={publisher:Pe,package_:je,name:"where"},Zo={publisher:Pe,package_:je,name:"value"},Jo={publisher:Pe,package_:je,name:"as"},Se=class{ruleName="TxExpressionPath";async validateAsync(e,t,o){let n=[],r;o?r=await o.getKanonaks():r=await new S().parseKanonaks(new G(e,t));let a=tn(e);if(!a)return n;for(let i of r)i instanceof y&&i.namespace===a&&this.checkView(r,i,n);return n}checkView(e,t,o){let n=g(t,Yo);if(!n)return;let r=g(t,qo),a=0;for(let s of en(e,V(t,zo))){let p=O(s,Zo);if(p)for(let m of X(e,n,p))o.push(this.toError(t.name,`view.projections[${a}].value`,n,m));let l=g(s,Jo);l&&r&&(L(e,r,l).ok||o.push(this.asError(t.name,a,r,l))),a+=1}let i=0;for(let s of Qo(t,Xo)){for(let p of X(e,n,s))o.push(this.toError(t.name,`view.where[${i}]`,n,p));i+=1}}asError(e,t,o,n){let r=`${n.publisher}/${n.package_}/${n.name}`,a=new u;return a.ruleType=this.ruleName,a.severity="Error",a.entityName=e,a.propertyName=`view.projections[${t}].as`,a.actualValue=r,a.message=`Projection stores its value under property '${n.name}', but that property's domain is not in scope for the view's produces class '${o.name}'. The materialized result instance could not carry this value.`,a.expectedValue=`A property whose domain is '${o.name}', an ancestor, or rdfs.Resource`,a.suggestion=`Property '${r}' is not in scope for produces class '${o.name}'.
49
+ \u2022 If the path is wrong, correct the tx.PropertyRead/tx.Traverse chain`,a}};function Yo(c){let e=c.subject;return e&&typeof e.name=="string"?e:void 0}function qo(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${U(e.version)}`}var je="kanonak.org",$e="view",zo={publisher:je,package_:$e,name:"bind"},Xo={publisher:je,package_:$e,name:"produces"},Zo={publisher:je,package_:$e,name:"projections"},Jo={publisher:je,package_:$e,name:"where"},Qo={publisher:je,package_:$e,name:"value"},en={publisher:je,package_:$e,name:"as"},Pe=class{ruleName="TxExpressionPath";async validateAsync(e,t,o){let n=[],r;o?r=await o.getKanonaks():r=await new S().parseKanonaks(new G(e,t));let a=nn(e);if(!a)return n;for(let i of r)i instanceof d&&i.namespace===a&&this.checkView(r,i,n);return n}checkView(e,t,o){let n=g(t,zo);if(!n)return;let r=g(t,Xo),a=0;for(let s of on(e,V(t,Zo))){let p=O(s,Qo);if(p)for(let m of X(e,n,p))o.push(this.toError(t.name,`view.projections[${a}].value`,n,m));let l=g(s,en);l&&r&&(L(e,r,l).ok||o.push(this.asError(t.name,a,r,l))),a+=1}let i=0;for(let s of tn(t,Jo)){for(let p of X(e,n,s))o.push(this.toError(t.name,`view.where[${i}]`,n,p));i+=1}}asError(e,t,o,n){let r=`${n.publisher}/${n.package_}/${n.name}`,a=new u;return a.ruleType=this.ruleName,a.severity="Error",a.entityName=e,a.propertyName=`view.projections[${t}].as`,a.actualValue=r,a.message=`Projection stores its value under property '${n.name}', but that property's domain is not in scope for the view's produces class '${o.name}'. The materialized result instance could not carry this value.`,a.expectedValue=`A property whose domain is '${o.name}', an ancestor, or rdfs.Resource`,a.suggestion=`Property '${r}' is not in scope for produces class '${o.name}'.
50
50
 
51
51
  Possible solutions:
52
52
  \u2022 Use an output property whose domain covers '${o.name}'
@@ -56,8 +56,8 @@ Possible solutions:
56
56
  Possible solutions:
57
57
  \u2022 Read a property declared on '${a}' (or an ancestor / rdfs.Resource)
58
58
  \u2022 If the property should apply to '${a}', adjust its domain
59
- \u2022 If the path is wrong, correct the tx.PropertyRead/tx.Traverse chain`,s}};function Qo(c,e){let t=O(c,e);return t?[t]:V(c,e).filter(o=>o instanceof v)}function en(c,e){let t=[];for(let o of e)if(o instanceof v)t.push(o);else if(o instanceof I){let n=k(c,o.subject);n&&t.push(n)}return t}function tn(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${$(e.version)}`}var Ye="kanonak.org",on="core-shacl",A=c=>({publisher:Ye,package_:on,name:c}),nn=A("NodeShape"),rn=A("PropertyShape"),an=A("targetClass"),sn=A("property"),cn=A("path"),pn=A("minCount"),ln=A("maxCount"),mn=A("datatype"),un=A("class"),Ct=A("in"),fn=A("pattern"),dn=A("flags"),yn=A("minLength"),gn=A("maxLength"),kn=A("minInclusive"),hn=A("maxInclusive"),Rn=new Set(["decimal","integer","int","long","short","byte","float","double","nonNegativeInteger","positiveInteger","negativeInteger","nonPositiveInteger","unsignedInt","unsignedLong","unsignedShort","unsignedByte"]),tt=c=>c,Oe=class{ruleName="ShaclShape";async validateAsync(e,t,o){let n=[],r=o?await o.getKanonaks():await new S().parseKanonaks(t),a=Kn(e);if(!a)return n;let i=new Set;for(let s of r){if(!(s instanceof y)||s.namespace!==a||!P(s,nn))continue;let p=g(s,an);p?this.resolvesToClass(r,p)||n.push(this.err(s.name,"targetClass","Error",`NodeShape '${s.name}' sh:targetClass '${p.name}' does not resolve to a class.`,"Reference a defined or imported rdfs.Class.",Z(p))):n.push(this.err(s.name,"targetClass","Error",`NodeShape '${s.name}' has no sh:targetClass; it constrains nothing.`,"Add sh:targetClass naming the class this shape applies to."));for(let l of V(s,sn)){let m;if(l instanceof v)m=l;else if(l instanceof I){let f=k(r,l.subject);f&&(m=f,i.add(K(l.subject)))}m&&this.checkPropertyShape(r,s.name,m,p??void 0,n)}}for(let s of r){if(!(s instanceof y)||s.namespace!==a||!P(s,rn))continue;let p=x(s);p&&i.has(K(p))||this.checkPropertyShape(r,s.name,s,void 0,n)}return n}checkPropertyShape(e,t,o,n,r){let a=g(o,cn);if(!a){r.push(this.err(t,"property.path","Error",`A PropertyShape on '${t}' has no sh:path; a PropertyShape must name the property it constrains.`,"Add sh:path naming a property."));return}let i=k(e,a),s=i?d.isAnyPropertyType(tt(i)):!1;s?n&&(L(e,n,a).ok||r.push(this.err(t,"property.path","Warning",`sh:path '${a.name}' is not in scope for sh:targetClass '${n.name}'; the constraint would never bind a value.`,`Constrain a property whose domain is '${n.name}', an ancestor, or rdfs.Resource.`,Z(a)))):r.push(this.err(t,"property.path","Error",`sh:path '${a.name}' on '${t}' does not resolve to a property.`,"Reference a defined or imported property.",Z(a)));let p=g(o,mn),l=g(o,un);p&&l&&r.push(this.err(t,"property","Error",`A PropertyShape on '${t}' sets both sh:datatype and sh:class; a value is a literal or a node, not both.`,"Keep sh:datatype (literal values) or sh:class (node values), not both.")),p&&!this.resolvesToDatatype(e,p)&&r.push(this.err(t,"datatype","Error",`sh:datatype '${p.name}' on '${t}' does not resolve to a datatype.`,"Reference an xsd datatype or rdfs.Datatype.",Z(p))),l&&!this.resolvesToClass(e,l)&&r.push(this.err(t,"class","Error",`sh:class '${l.name}' on '${t}' does not resolve to a class.`,"Reference a defined or imported rdfs.Class.",Z(l)));let m=Ue(w(o,pn)),f=Ue(w(o,ln));this.checkOrder(t,"minCount",m,"maxCount",f,r);let R=Ue(w(o,yn)),E=Ue(w(o,gn));this.checkOrder(t,"minLength",R,"maxLength",E,r);let N=Ue(w(o,kn)),j=Ue(w(o,hn));this.checkOrder(t,"minInclusive",N,"maxInclusive",j,r);let U=W(o,fn);if(U!==void 0){let B=W(o,dn);try{new RegExp(U,B)}catch{r.push(this.err(t,"pattern","Error",`sh:pattern on '${t}' is not a valid regular expression`+(B!==void 0?` (with flags '${B}')`:"")+`: ${U}`,"Provide a valid regular expression and flags.",U))}}if(J(o,Ct)&&V(o,Ct).length===0&&r.push(this.err(t,"in","Error",`sh:in on '${t}' is empty; an enumeration must list at least one permitted value.`,"List the permitted literal values, or remove sh:in.")),s&&n){let _=L(e,n,a).descriptor;_&&((U!==void 0||R!==void 0||E!==void 0)&&_.kind==="object"&&r.push(this.err(t,"pattern/minLength/maxLength","Warning",`String facets on '${t}' apply to '${a.name}', which is an object property; string facets constrain literal values.`,"Apply string facets to a datatype property, or use sh:class for node values.",Z(a))),(N!==void 0||j!==void 0)&&!this.isNumericDatatypeRange(_.range)&&r.push(this.err(t,"minInclusive/maxInclusive","Warning",`Numeric bounds on '${t}' apply to '${a.name}', whose range is not a numeric datatype.`,"Apply numeric bounds to a numeric datatype property.",Z(a))))}}checkOrder(e,t,o,n,r,a){o!==void 0&&r!==void 0&&o>r&&a.push(this.err(e,`${t}/${n}`,"Error",`${t} (${o}) exceeds ${n} (${r}) on '${e}'.`,`Set ${t} <= ${n}.`))}resolvesToClass(e,t){let o=k(e,t);return o?d.isClassType(tt(o)):!1}resolvesToDatatype(e,t){if(t.publisher===Ye&&t.package_==="core-rdf"&&t.name==="Literal")return!0;let o=k(e,t);return o?d.isDatatypeType(tt(o)):!1}isNumericDatatypeRange(e){return!e||e.publisher===Ye&&e.package_==="core-rdf"&&e.name==="Literal"?!0:e.publisher===Ye&&e.package_==="core-xsd"&&Rn.has(e.name)}err(e,t,o,n,r,a){let i=new u;return i.ruleType=this.ruleName,i.severity=o,i.entityName=e,i.propertyName=t,i.message=n,i.suggestion=r,a!==void 0&&(i.actualValue=a),i}};function Ue(c){return typeof c=="number"?c:void 0}function Z(c){return`${c.publisher}/${c.package_}/${c.name}`}function Kn(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${$(e.version)}`}var St={publisher:"kanonak.org",package_:"core-owl",name:"oneOf"},bn=c=>c,$e=class{ruleName="OwlOneOf";async validateAsync(e,t,o){let n=[],r=o?await o.getKanonaks():await new S().parseKanonaks(t),a=Vn(e);if(!a)return n;for(let i of r){if(!(i instanceof y)||i.namespace!==a||!J(i,St))continue;let s=V(i,St);if(s.length===0){n.push(this.err(i.name,"Warning",`owl:oneOf on '${i.name}' is empty; a closed enumeration must list at least one individual.`,"List the individuals that make up the enumeration, or remove owl:oneOf."));continue}for(let p of s)if(p instanceof Le)n.push(this.err(i.name,"Error",`owl:oneOf member '${String(p.value)}' on '${i.name}' is not a named individual; a class enumeration is of individuals (a misspelled or unimported individual reads as a literal). For a closed set of literal VALUES, constrain a property with sh:in instead.`,"Reference a defined or imported individual, or move literal value sets to a property sh:in.",String(p.value)));else if(p instanceof I){let l=k(r,p.subject);l&&d.isSchemaDefinitionType(bn(l))&&n.push(this.err(i.name,"Error",`owl:oneOf member '${p.subject.name}' on '${i.name}' is a class/property/datatype, not an individual.`,"List named individuals (instances), not schema definitions.",`${p.subject.publisher}/${p.subject.package_}/${p.subject.name}`))}}return n}err(e,t,o,n,r){let a=new u;return a.ruleType=this.ruleName,a.severity=t,a.entityName=e,a.propertyName="oneOf",a.message=o,a.suggestion=n,r!==void 0&&(a.actualValue=r),a}};function Vn(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${$(e.version)}`}var En="kanonak.org",vn="core-shacl",T=c=>({publisher:En,package_:vn,name:c}),Dn=T("NodeShape"),In=T("targetClass"),Cn=T("property"),Sn=T("path"),Pn=T("minCount"),jn=T("maxCount"),Un=T("in"),On=T("pattern"),$n=T("flags"),An=T("minLength"),wn=T("maxLength"),xn=T("minInclusive"),Tn=T("maxInclusive"),Nn=T("message");function Ae(c){return typeof c=="number"?c:void 0}function _n(c){let e={},t=Ae(w(c,Pn)),o=Ae(w(c,jn));t!==void 0&&(e.minCount=t),o!==void 0&&(e.maxCount=o);let n=Ae(w(c,An)),r=Ae(w(c,wn));n!==void 0&&(e.minLength=n),r!==void 0&&(e.maxLength=r);let a=Ae(w(c,xn)),i=Ae(w(c,Tn));a!==void 0&&(e.minInclusive=a),i!==void 0&&(e.maxInclusive=i);let s=W(c,On);if(s!==void 0){let m=W(c,$n);e.pattern=m!==void 0?{regex:s,flags:m}:{regex:s}}let p=V(c,Un).filter(m=>m instanceof Le).map(m=>m.value);p.length>0&&(e.enumValues=p);let l=W(c,Nn);return l!==void 0&&(e.message=l),e}function Ln(c,e){let t=[];for(let o of V(e,Cn))if(o instanceof v)t.push(o);else if(o instanceof I){let n=k(c,o.subject);n&&t.push(n)}return t}function Pt(c){let e=new Map;for(let t of c){if(!(t instanceof y)||!P(t,Dn))continue;let o=g(t,In);if(!o)continue;let n=K(o);for(let r of Ln(c,t)){let a=g(r,Sn);if(!a)continue;let i={pathKey:K(a),constraints:_n(r)},s=e.get(n);s?s.push(i):e.set(n,[i])}}return e}function Mn(c,e){e.minCount!==void 0&&(c.minCount=e.minCount),e.maxCount!==void 0&&(c.maxCount=e.maxCount),e.minLength!==void 0&&(c.minLength=e.minLength),e.maxLength!==void 0&&(c.maxLength=e.maxLength),e.minInclusive!==void 0&&(c.minInclusive=e.minInclusive),e.maxInclusive!==void 0&&(c.maxInclusive=e.maxInclusive),e.pattern!==void 0&&(c.pattern=e.pattern),e.enumValues!==void 0&&(c.enumValues=e.enumValues),e.message!==void 0&&(c.message=e.message)}function jt(c,e,t){let o=K(t),n=!1,r={};for(let a=e.length-1;a>=0;a--){let i=c.get(K(e[a]));if(i)for(let s of i)s.pathKey===o&&(n=!0,Mn(r,s.constraints))}if(n)return r.cardinality=r.maxCount===1?"single":"list",r.required=(r.minCount??0)>=1,r}var Bn=c=>c,Fn=new rt("kanonak.org","core-rdf","Resource"),we=class{ruleName="DiamondNameClash";async validateAsync(e,t,o){let n=[],r=o?await o.getKanonaks():await new S().parseKanonaks(t),a=Wn(e);if(!a)return n;let i=Pt(r);for(let s of r){if(!(s instanceof y)||s.namespace!==a||!d.isClassType(Bn(s)))continue;let p=x(s);if(!p)continue;let l=Y(r,p),m=K(p),f=new Set(l.map(E=>K(E)));f.delete(m),f.delete(K(Fn));let R=new Map;for(let E of st(r,p)){if(!E.domains.some(U=>f.has(K(U))))continue;let j=R.get(E.uri.name);j?j.push(E):R.set(E.uri.name,[E])}for(let[E,N]of R){if(N.length<2)continue;let j=_=>jt(i,l,_.uri)?.cardinality,U=new Set(N.map(_=>_.range?K(_.range):void 0).filter(_=>_!==void 0)),B=new Set(N.map(j).filter(_=>_!==void 0));U.size<=1&&B.size<=1||n.push(this.toError(s.name,E,N,j))}}return n}toError(e,t,o,n){let r=s=>{let p=`${s.uri.publisher}/${s.uri.package_}/${s.uri.name}`,l=s.range?`${s.range.publisher}/${s.range.package_}/${s.range.name}`:"no range",m=n(s);return`${p} (range ${l}${m?`, ${m}`:""})`},a=o.map(r).join("; "),i=new u;return i.ruleType=this.ruleName,i.severity="Error",i.entityName=e,i.propertyName=t,i.actualValue=a,i.message=`Class '${e}' inherits ${o.length} distinct properties named '${t}' with incompatible range or cardinality: ${a}. The generated interface would multiply-inherit '${t}' with conflicting types and could not compile.`,i.suggestion=`Disambiguate the diamond name-clash on '${t}':
59
+ \u2022 If the path is wrong, correct the tx.PropertyRead/tx.Traverse chain`,s}};function tn(c,e){let t=O(c,e);return t?[t]:V(c,e).filter(o=>o instanceof v)}function on(c,e){let t=[];for(let o of e)if(o instanceof v)t.push(o);else if(o instanceof I){let n=h(c,o.subject);n&&t.push(n)}return t}function nn(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${U(e.version)}`}var qe="kanonak.org",rn="core-shacl",w=c=>({publisher:qe,package_:rn,name:c}),an=w("NodeShape"),sn=w("PropertyShape"),cn=w("targetClass"),pn=w("property"),ln=w("path"),mn=w("minCount"),un=w("maxCount"),fn=w("datatype"),dn=w("class"),Pt=w("in"),yn=w("pattern"),gn=w("flags"),kn=w("minLength"),hn=w("maxLength"),Rn=w("minInclusive"),Kn=w("maxInclusive"),bn=new Set(["decimal","integer","int","long","short","byte","float","double","nonNegativeInteger","positiveInteger","negativeInteger","nonPositiveInteger","unsignedInt","unsignedLong","unsignedShort","unsignedByte"]),ot=c=>c,Ue=class{ruleName="ShaclShape";async validateAsync(e,t,o){let n=[],r=o?await o.getKanonaks():await new S().parseKanonaks(t),a=Vn(e);if(!a)return n;let i=new Set;for(let s of r){if(!(s instanceof d)||s.namespace!==a||!P(s,an))continue;let p=g(s,cn);p?this.resolvesToClass(r,p)||n.push(this.err(s.name,"targetClass","Error",`NodeShape '${s.name}' sh:targetClass '${p.name}' does not resolve to a class.`,"Reference a defined or imported rdfs.Class.",Z(p))):n.push(this.err(s.name,"targetClass","Error",`NodeShape '${s.name}' has no sh:targetClass; it constrains nothing.`,"Add sh:targetClass naming the class this shape applies to."));for(let l of V(s,pn)){let m;if(l instanceof v)m=l;else if(l instanceof I){let f=h(r,l.subject);f&&(m=f,i.add(K(l.subject)))}m&&this.checkPropertyShape(r,s.name,m,p??void 0,n)}}for(let s of r){if(!(s instanceof d)||s.namespace!==a||!P(s,sn))continue;let p=A(s);p&&i.has(K(p))||this.checkPropertyShape(r,s.name,s,void 0,n)}return n}checkPropertyShape(e,t,o,n,r){let a=g(o,ln);if(!a){r.push(this.err(t,"property.path","Error",`A PropertyShape on '${t}' has no sh:path; a PropertyShape must name the property it constrains.`,"Add sh:path naming a property."));return}let i=h(e,a),s=i?y.isAnyPropertyType(ot(i)):!1;s?n&&(L(e,n,a).ok||r.push(this.err(t,"property.path","Warning",`sh:path '${a.name}' is not in scope for sh:targetClass '${n.name}'; the constraint would never bind a value.`,`Constrain a property whose domain is '${n.name}', an ancestor, or rdfs.Resource.`,Z(a)))):r.push(this.err(t,"property.path","Error",`sh:path '${a.name}' on '${t}' does not resolve to a property.`,"Reference a defined or imported property.",Z(a)));let p=g(o,fn),l=g(o,dn);p&&l&&r.push(this.err(t,"property","Error",`A PropertyShape on '${t}' sets both sh:datatype and sh:class; a value is a literal or a node, not both.`,"Keep sh:datatype (literal values) or sh:class (node values), not both.")),p&&!this.resolvesToDatatype(e,p)&&r.push(this.err(t,"datatype","Error",`sh:datatype '${p.name}' on '${t}' does not resolve to a datatype.`,"Reference an xsd datatype or rdfs.Datatype.",Z(p))),l&&!this.resolvesToClass(e,l)&&r.push(this.err(t,"class","Error",`sh:class '${l.name}' on '${t}' does not resolve to a class.`,"Reference a defined or imported rdfs.Class.",Z(l)));let m=Oe(x(o,mn)),f=Oe(x(o,un));this.checkOrder(t,"minCount",m,"maxCount",f,r);let R=Oe(x(o,kn)),E=Oe(x(o,hn));this.checkOrder(t,"minLength",R,"maxLength",E,r);let N=Oe(x(o,Rn)),j=Oe(x(o,Kn));this.checkOrder(t,"minInclusive",N,"maxInclusive",j,r);let $=W(o,yn);if($!==void 0){let B=W(o,gn);try{new RegExp($,B)}catch{r.push(this.err(t,"pattern","Error",`sh:pattern on '${t}' is not a valid regular expression`+(B!==void 0?` (with flags '${B}')`:"")+`: ${$}`,"Provide a valid regular expression and flags.",$))}}if(J(o,Pt)&&V(o,Pt).length===0&&r.push(this.err(t,"in","Error",`sh:in on '${t}' is empty; an enumeration must list at least one permitted value.`,"List the permitted literal values, or remove sh:in.")),s&&n){let _=L(e,n,a).descriptor;_&&(($!==void 0||R!==void 0||E!==void 0)&&_.kind==="object"&&r.push(this.err(t,"pattern/minLength/maxLength","Warning",`String facets on '${t}' apply to '${a.name}', which is an object property; string facets constrain literal values.`,"Apply string facets to a datatype property, or use sh:class for node values.",Z(a))),(N!==void 0||j!==void 0)&&!this.isNumericDatatypeRange(_.range)&&r.push(this.err(t,"minInclusive/maxInclusive","Warning",`Numeric bounds on '${t}' apply to '${a.name}', whose range is not a numeric datatype.`,"Apply numeric bounds to a numeric datatype property.",Z(a))))}}checkOrder(e,t,o,n,r,a){o!==void 0&&r!==void 0&&o>r&&a.push(this.err(e,`${t}/${n}`,"Error",`${t} (${o}) exceeds ${n} (${r}) on '${e}'.`,`Set ${t} <= ${n}.`))}resolvesToClass(e,t){let o=h(e,t);return o?y.isClassType(ot(o)):!1}resolvesToDatatype(e,t){if(t.publisher===qe&&t.package_==="core-rdf"&&t.name==="Literal")return!0;let o=h(e,t);return o?y.isDatatypeType(ot(o)):!1}isNumericDatatypeRange(e){return!e||e.publisher===qe&&e.package_==="core-rdf"&&e.name==="Literal"?!0:e.publisher===qe&&e.package_==="core-xsd"&&bn.has(e.name)}err(e,t,o,n,r,a){let i=new u;return i.ruleType=this.ruleName,i.severity=o,i.entityName=e,i.propertyName=t,i.message=n,i.suggestion=r,a!==void 0&&(i.actualValue=a),i}};function Oe(c){return typeof c=="number"?c:void 0}function Z(c){return`${c.publisher}/${c.package_}/${c.name}`}function Vn(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${U(e.version)}`}var jt={publisher:"kanonak.org",package_:"core-owl",name:"oneOf"},En=c=>c,Ae=class{ruleName="OwlOneOf";async validateAsync(e,t,o){let n=[],r=o?await o.getKanonaks():await new S().parseKanonaks(t),a=vn(e);if(!a)return n;for(let i of r){if(!(i instanceof d)||i.namespace!==a||!J(i,jt))continue;let s=V(i,jt);if(s.length===0){n.push(this.err(i.name,"Warning",`owl:oneOf on '${i.name}' is empty; a closed enumeration must list at least one individual.`,"List the individuals that make up the enumeration, or remove owl:oneOf."));continue}for(let p of s)if(p instanceof Me)n.push(this.err(i.name,"Error",`owl:oneOf member '${String(p.value)}' on '${i.name}' is not a named individual; a class enumeration is of individuals (a misspelled or unimported individual reads as a literal). For a closed set of literal VALUES, constrain a property with sh:in instead.`,"Reference a defined or imported individual, or move literal value sets to a property sh:in.",String(p.value)));else if(p instanceof I){let l=h(r,p.subject);l&&y.isSchemaDefinitionType(En(l))&&n.push(this.err(i.name,"Error",`owl:oneOf member '${p.subject.name}' on '${i.name}' is a class/property/datatype, not an individual.`,"List named individuals (instances), not schema definitions.",`${p.subject.publisher}/${p.subject.package_}/${p.subject.name}`))}}return n}err(e,t,o,n,r){let a=new u;return a.ruleType=this.ruleName,a.severity=t,a.entityName=e,a.propertyName="oneOf",a.message=o,a.suggestion=n,r!==void 0&&(a.actualValue=r),a}};function vn(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${U(e.version)}`}var Dn="kanonak.org",In="core-shacl",T=c=>({publisher:Dn,package_:In,name:c}),Cn=T("NodeShape"),Sn=T("targetClass"),Pn=T("property"),jn=T("path"),$n=T("minCount"),On=T("maxCount"),Un=T("in"),An=T("pattern"),wn=T("flags"),xn=T("minLength"),Tn=T("maxLength"),Nn=T("minInclusive"),_n=T("maxInclusive"),Ln=T("message");function we(c){return typeof c=="number"?c:void 0}function Mn(c){let e={},t=we(x(c,$n)),o=we(x(c,On));t!==void 0&&(e.minCount=t),o!==void 0&&(e.maxCount=o);let n=we(x(c,xn)),r=we(x(c,Tn));n!==void 0&&(e.minLength=n),r!==void 0&&(e.maxLength=r);let a=we(x(c,Nn)),i=we(x(c,_n));a!==void 0&&(e.minInclusive=a),i!==void 0&&(e.maxInclusive=i);let s=W(c,An);if(s!==void 0){let m=W(c,wn);e.pattern=m!==void 0?{regex:s,flags:m}:{regex:s}}let p=V(c,Un).filter(m=>m instanceof Me).map(m=>m.value);p.length>0&&(e.enumValues=p);let l=W(c,Ln);return l!==void 0&&(e.message=l),e}function Bn(c,e){let t=[];for(let o of V(e,Pn))if(o instanceof v)t.push(o);else if(o instanceof I){let n=h(c,o.subject);n&&t.push(n)}return t}function $t(c){let e=new Map;for(let t of c){if(!(t instanceof d)||!P(t,Cn))continue;let o=g(t,Sn);if(!o)continue;let n=K(o);for(let r of Bn(c,t)){let a=g(r,jn);if(!a)continue;let i={pathKey:K(a),constraints:Mn(r)},s=e.get(n);s?s.push(i):e.set(n,[i])}}return e}function Fn(c,e){e.minCount!==void 0&&(c.minCount=e.minCount),e.maxCount!==void 0&&(c.maxCount=e.maxCount),e.minLength!==void 0&&(c.minLength=e.minLength),e.maxLength!==void 0&&(c.maxLength=e.maxLength),e.minInclusive!==void 0&&(c.minInclusive=e.minInclusive),e.maxInclusive!==void 0&&(c.maxInclusive=e.maxInclusive),e.pattern!==void 0&&(c.pattern=e.pattern),e.enumValues!==void 0&&(c.enumValues=e.enumValues),e.message!==void 0&&(c.message=e.message)}function Ot(c,e,t){let o=K(t),n=!1,r={};for(let a=e.length-1;a>=0;a--){let i=c.get(K(e[a]));if(i)for(let s of i)s.pathKey===o&&(n=!0,Fn(r,s.constraints))}if(n)return r.cardinality=r.maxCount===1?"single":"list",r.required=(r.minCount??0)>=1,r}var Wn=c=>c,Hn=new at("kanonak.org","core-rdf","Resource"),xe=class{ruleName="DiamondNameClash";async validateAsync(e,t,o){let n=[],r=o?await o.getKanonaks():await new S().parseKanonaks(t),a=Gn(e);if(!a)return n;let i=$t(r);for(let s of r){if(!(s instanceof d)||s.namespace!==a||!y.isClassType(Wn(s)))continue;let p=A(s);if(!p)continue;let l=Y(r,p),m=K(p),f=new Set(l.map(E=>K(E)));f.delete(m),f.delete(K(Hn));let R=new Map;for(let E of pt(r,p)){if(!E.domains.some($=>f.has(K($))))continue;let j=R.get(E.uri.name);j?j.push(E):R.set(E.uri.name,[E])}for(let[E,N]of R){if(N.length<2)continue;let j=_=>Ot(i,l,_.uri)?.cardinality,$=new Set(N.map(_=>_.range?K(_.range):void 0).filter(_=>_!==void 0)),B=new Set(N.map(j).filter(_=>_!==void 0));$.size<=1&&B.size<=1||n.push(this.toError(s.name,E,N,j))}}return n}toError(e,t,o,n){let r=s=>{let p=`${s.uri.publisher}/${s.uri.package_}/${s.uri.name}`,l=s.range?`${s.range.publisher}/${s.range.package_}/${s.range.name}`:"no range",m=n(s);return`${p} (range ${l}${m?`, ${m}`:""})`},a=o.map(r).join("; "),i=new u;return i.ruleType=this.ruleName,i.severity="Error",i.entityName=e,i.propertyName=t,i.actualValue=a,i.message=`Class '${e}' inherits ${o.length} distinct properties named '${t}' with incompatible range or cardinality: ${a}. The generated interface would multiply-inherit '${t}' with conflicting types and could not compile.`,i.suggestion=`Disambiguate the diamond name-clash on '${t}':
60
60
  \u2022 rename one of the properties, or
61
61
  \u2022 re-domain one so it is not inherited by '${e}', or
62
62
  \u2022 restructure the hierarchy so '${e}' inherits only one '${t}', or
63
- \u2022 make the ranges/cardinalities compatible (identical) if they are meant to be the same property.`,i}};function Wn(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${$(e.version)}`}var ot=class{parser;documentRules;repositoryRules;includeWarnings=!0;constructor(e){this.parser=e??new nt,this.documentRules=[new ne,new re,new ae,new ie,new se],this.repositoryRules=[new ce,new pe,new le,new me,new ue,new fe,new de,new ye,new ge,new ke,new he,new Re,new be,new Ve,new Ee,new ve,new De,new Ie,new Ce,new _e,new Se,new Oe,new $e,new we]}async validateAsync(e,t,o){let n=new Q;for(let r of this.documentRules)try{let a=r.validate(e);this.addErrorsToResult(n,a)}catch(a){let i=new u;i.ruleType=r.ruleName,i.severity="Error",i.message=`Validation rule '${r.ruleName}' failed: ${a instanceof Error?a.message:String(a)}`,n.errors.push(i)}if(t){let r=[],a=o??new ee(new te(e,t)),i=a.repository;for(let s of this.repositoryRules)try{let p=await s.validateAsync(e,i,a);this.addErrorsToResult(n,p)}catch(p){let l=p instanceof Error?p.message:String(p);r.push({ruleName:s.ruleName,cause:l})}if(r.length>0){let s=new Map;for(let{ruleName:p,cause:l}of r){let m=s.get(l);m?m.push(p):s.set(l,[p])}for(let[p,l]of s){let m=new u;m.ruleType=l[0],m.severity="Error",l.length===1?m.message=`Validation rule '${l[0]}' failed: ${p}`:m.message=`${p} (affects ${l.length} rules: ${l.join(", ")})`,n.errors.push(m)}}}return n.isValid=n.errors.length===0,n}async validateDocumentsAsync(e,t){let o=new ee(t),n=[];for(let r of e){let a=await this.validateAsync(r,o.repository,o);n.push({document:r,result:a})}return n}async validateYamlAsync(e,t,o){let n=this.parser.parseWithErrors(e);if(!n.isValid){let r=new Q;r.isValid=!1;for(let a of n.errors){let i=new u;i.ruleType="ParseError",i.severity="Error",i.lineNumber=a.line,i.column=a.column,i.message=a.message,a.keyName&&(i.entityName=a.keyName),a.errorType==="DuplicateKey"&&(i.suggestion="All property names must be unique across the entire document. Rename one of the duplicate properties to make them unique."),r.errors.push(i)}return r}return await this.validateAsync(n.document,t,o)}addDocumentRule(e){this.documentRules.push(e)}addRepositoryRule(e){this.repositoryRules.push(e)}removeDocumentRule(e){let t=this.documentRules.findIndex(o=>o instanceof e);t>=0&&this.documentRules.splice(t,1)}removeRepositoryRule(e){let t=this.repositoryRules.findIndex(o=>o instanceof e);t>=0&&this.repositoryRules.splice(t,1)}addErrorsToResult(e,t){for(let o of t)o.severity==="Error"?e.errors.push(o):this.includeWarnings&&e.warnings.push(o)}};export{Q as a,h as b,u as c,qe as d,ee as e,ne as f,re as g,ae as h,ie as i,se as j,ce as k,pe as l,le as m,me as n,ue as o,fe as p,de as q,ye as r,ge as s,ke as t,he as u,Re as v,be as w,Ve as x,Ee as y,ve as z,De as A,Ie as B,Ce as C,Se as D,Oe as E,$e as F,Pt as G,jt as H,we as I,ot as J};
63
+ \u2022 make the ranges/cardinalities compatible (identical) if they are meant to be the same property.`,i}};function Gn(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${U(e.version)}`}var nt=class{parser;documentRules;repositoryRules;includeWarnings=!0;constructor(e){this.parser=e??new rt,this.documentRules=[new ne,new re,new ae,new ie,new se],this.repositoryRules=[new ce,new pe,new le,new me,new ue,new fe,new de,new ye,new ge,new ke,new he,new Re,new be,new Ve,new Ee,new ve,new De,new Ie,new Ce,new Se,new Le,new Pe,new Ue,new Ae,new xe]}async validateAsync(e,t,o){let n=new Q;for(let r of this.documentRules)try{let a=r.validate(e);this.addErrorsToResult(n,a)}catch(a){let i=new u;i.ruleType=r.ruleName,i.severity="Error",i.message=`Validation rule '${r.ruleName}' failed: ${a instanceof Error?a.message:String(a)}`,n.errors.push(i)}if(t){let r=[],a=o??new ee(new te(e,t)),i=a.repository;for(let s of this.repositoryRules)try{let p=await s.validateAsync(e,i,a);this.addErrorsToResult(n,p)}catch(p){let l=p instanceof Error?p.message:String(p);r.push({ruleName:s.ruleName,cause:l})}if(r.length>0){let s=new Map;for(let{ruleName:p,cause:l}of r){let m=s.get(l);m?m.push(p):s.set(l,[p])}for(let[p,l]of s){let m=new u;m.ruleType=l[0],m.severity="Error",l.length===1?m.message=`Validation rule '${l[0]}' failed: ${p}`:m.message=`${p} (affects ${l.length} rules: ${l.join(", ")})`,n.errors.push(m)}}}return n.isValid=n.errors.length===0,n}async validateDocumentsAsync(e,t){let o=new ee(t),n=[];for(let r of e){let a=await this.validateAsync(r,o.repository,o);n.push({document:r,result:a})}return n}async validateYamlAsync(e,t,o){let n=this.parser.parseWithErrors(e);if(!n.isValid){let r=new Q;r.isValid=!1;for(let a of n.errors){let i=new u;i.ruleType="ParseError",i.severity="Error",i.lineNumber=a.line,i.column=a.column,i.message=a.message,a.keyName&&(i.entityName=a.keyName),a.errorType==="DuplicateKey"&&(i.suggestion="All property names must be unique across the entire document. Rename one of the duplicate properties to make them unique."),r.errors.push(i)}return r}return await this.validateAsync(n.document,t,o)}addDocumentRule(e){this.documentRules.push(e)}addRepositoryRule(e){this.repositoryRules.push(e)}removeDocumentRule(e){let t=this.documentRules.findIndex(o=>o instanceof e);t>=0&&this.documentRules.splice(t,1)}removeRepositoryRule(e){let t=this.repositoryRules.findIndex(o=>o instanceof e);t>=0&&this.repositoryRules.splice(t,1)}addErrorsToResult(e,t){for(let o of t)o.severity==="Error"?e.errors.push(o):o.severity==="Info"?this.includeWarnings&&e.infos.push(o):this.includeWarnings&&e.warnings.push(o)}};export{Q as a,k as b,u as c,ze as d,ee as e,ne as f,re as g,ae as h,ie as i,se as j,ce as k,pe as l,le as m,me as n,ue as o,fe as p,de as q,ye as r,ge as s,ke as t,he as u,Re as v,be as w,Ve as x,Ee as y,ve as z,De as A,Ie as B,Ce as C,Se as D,Pe as E,Ue as F,Ae as G,$t as H,Ot as I,xe as J,nt as K};
package/dist/index.d.ts CHANGED
@@ -15,7 +15,7 @@ export type { IStatement } from './statements/index.js';
15
15
  export type { MarkdownLink } from './statements/index.js';
16
16
  export { Statement, ScalarStatement, StringStatement, NumberStatement, BooleanStatement, ReferenceStatement, EmbeddedStatement, ListStatement, MarkdownStatement } from './statements/index.js';
17
17
  export { extractMarkdownLinks, findMalformedReferences, type RawMarkdownLink, type MalformedMarkdownLink, } from './parsing/extractMarkdownLinks.js';
18
- export { OntologyValidationResult, OntologyValidationError, ValidationSeverity, ValidationContext, ValidationCache, KanonakObjectValidator, NamespacePrefixRule, ResourceNamingRule, PropertyTypeSpecificityRule, SubjectKanonakTypeRequiredRule, PackageHeaderRule, EmbeddedKanonakTypeRule, ImportExistenceRule, UnresolvedReferenceRule, ClassHierarchyCycleRule, PropertyHierarchyCycleRule, PropertyRangeRequiredRule, SubClassOfReferenceRule, SubPropertyOfReferenceRule, NamespaceImportCycleRule, UnresolvedPredicateRule, AmbiguousReferenceRule, PropertyRangeReferenceRule, ObjectPropertyValueValidationRule, PropertyDomainRule, PropertyKindRangeConsistencyRule, ClassDefinitionRule, MarkdownLinkRule } from './validation/index.js';
18
+ export { OntologyValidationResult, OntologyValidationError, ValidationSeverity, ValidationContext, ValidationCache, KanonakObjectValidator, NamespacePrefixRule, ResourceNamingRule, PropertyTypeSpecificityRule, SubjectKanonakTypeRequiredRule, PackageHeaderRule, EmbeddedKanonakTypeRule, ImportExistenceRule, UnresolvedReferenceRule, ClassHierarchyCycleRule, PropertyHierarchyCycleRule, PropertyRangeRequiredRule, SubClassOfReferenceRule, SubPropertyOfReferenceRule, NamespaceImportCycleRule, UnresolvedPredicateRule, AmbiguousReferenceRule, PropertyRangeReferenceRule, ObjectPropertyValueValidationRule, PropertyDomainRule, PropertyKindRangeConsistencyRule, ReservedNameShadowRule, ClassDefinitionRule, MarkdownLinkRule } from './validation/index.js';
19
19
  export type { IKanonakObjectValidator, DocumentValidationResult, IDocumentValidationRule, IRepositoryValidationRule } from './validation/index.js';
20
20
  export type { IKanonakDocumentRepository } from '@kanonak-protocol/types/document/models';
21
21
  export type { IKanonakParser } from '@kanonak-protocol/types/document/parsing';