@prefix : <https://ontology.inferal.com/modules/type-system/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

:CoreCoverageWaiverShape
    a sh:NodeShape ;
    rdfs:label "core coverage waiver shape" ;
    rdfs:comment "Documents SHACL coverage for public type-system classes whose base meaning is taxonomy, marker, expression, slot, value, or profile-extension semantics. This shape records an explicit waiver; language and project profiles add concrete checks when they define those semantics." ;
    sh:targetClass
        :Alias,
        :AliasDeclaration,
        :AlternativeMatch,
        :AnonymousTypeExpression,
        :AnyType,
        :ArrayExpression,
        :ArrayValue,
        :ArrayValueItem,
        :AssignableTypeRelation,
        :BooleanLiteralType,
        :BooleanType,
        :BooleanValue,
        :BytesType,
        :CallableSetMembership,
        :CallableSetType,
        :CollectionElementTypeMatch,
        :CollectionType,
        :ConstValue,
        :DataType,
        :DateTimeType,
        :DateType,
        :DecimalType,
        :DiscriminatorEnvelope,
        :DurationType,
        :Entity,
        :EnumMember,
        :EnumMemberReferenceLiteralType,
        :EnumValue,
        :ErrorType,
        :ExactTypeRelation,
        :FieldKey,
        :FieldKeyKind,
        :FieldMatch,
        :FloatType,
        :IndexerSlot,
        :InitializerArgument,
        :IntegerType,
        :InterfaceType,
        :IntersectionExpression,
        :IntersectionType,
        :IntrinsicType,
        :LiteralKind,
        :Namespace,
        :NeverType,
        :NonAssignableTypeRelation,
        :NullLiteralType,
        :NullType,
        :NullValue,
        :NullableType,
        :NumericLiteralType,
        :NumericType,
        :NumericValue,
        :ObjectValue,
        :ObjectValueMember,
        :OptionRecordType,
        :ParameterSlot,
        :RecordExpression,
        :RecordMapType,
        :ResultSlot,
        :ScalarConstructorInitializer,
        :ScalarInitializerCall,
        :ScalarInitializerSemanticKind,
        :ScalarValue,
        :StreamType,
        :StringLiteralType,
        :StringTemplateLiteralType,
        :StringTemplatePart,
        :StringType,
        :StringValue,
        :StructuredType,
        :SubtypeRelation,
        :TemplateParameter,
        :TemporalKind,
        :TemporalType,
        :TemporalZoneSemantics,
        :TimeType,
        :TupleElement,
        :TupleElementMatch,
        :TupleExpression,
        :TupleType,
        :Type,
        :TypeArgument,
        :TypeDeclaration,
        :TypeOfValue,
        :TypeOrValueParameter,
        :TypeParameter,
        :TypedSlot,
        :UnionExpression,
        :UnionVariant,
        :UnionVariantReferenceLiteralType,
        :UnknownType,
        :UrlType,
        :Value,
        :ValueArgument,
        :ValueDeclaration,
        :ValueOfType,
        :ValueParameter,
        :Vocabulary,
        :VoidType .

:DeclarationShape
    a sh:NodeShape ;
    rdfs:label "declaration shape" ;
    rdfs:comment "Validates TypeSpec declarations, including a preferred label and optional declared entity." ;
    sh:targetClass :Declaration ;
    sh:property [
        sh:path skos:prefLabel ;
        sh:nodeKind sh:Literal ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :declares ;
        sh:class :Entity ;
        sh:maxCount 1 ;
    ] .

:FieldShape
    a sh:NodeShape ;
    rdfs:label "field shape" ;
    rdfs:comment "Validates field keys, field types, ordinal values, and cardinality bounds for record fields." ;
    sh:targetClass :Field ;
    sh:property [
        sh:path :fieldKey ;
        sh:class :FieldKey ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :fieldType ;
        sh:class :Type ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :ordinal ;
        sh:datatype xsd:integer ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :minCount ;
        sh:datatype xsd:integer ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :maxCount ;
        sh:datatype xsd:integer ;
        sh:maxCount 1 ;
    ] .

:RecordTypeShape
    a sh:NodeShape ;
    rdfs:label "record type shape" ;
    rdfs:comment "Validates that record types reference field resources through hasField." ;
    sh:targetClass :RecordType ;
    sh:property [
        sh:path :hasField ;
        sh:class :Field ;
    ] .

:ArrayTypeShape
    a sh:NodeShape ;
    rdfs:label "array type shape" ;
    rdfs:comment "Validates the optional value type associated with an array type." ;
    sh:targetClass :ArrayType ;
    sh:property [
        sh:path :arrayValueType ;
        sh:class :Type ;
        sh:maxCount 1 ;
    ] .

:ScalarShape
    a sh:NodeShape ;
    rdfs:label "scalar shape" ;
    rdfs:comment "Validates scalar inheritance links to base and standard base scalar types." ;
    sh:targetClass :Scalar ;
    sh:property [
        sh:path :baseScalar ;
        sh:class :Scalar ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :standardBaseScalar ;
        sh:class :Scalar ;
        sh:maxCount 1 ;
    ] .

:UnionShape
    a sh:NodeShape ;
    rdfs:label "union shape" ;
    rdfs:comment "Validates union alternatives and optional discriminator metadata." ;
    sh:targetClass :Union ;
    sh:property [
        sh:path :hasUnionAlternative ;
        sh:class :UnionAlternative ;
        sh:minCount 1 ;
    ] ;
    sh:property [
        sh:path :hasDiscriminator ;
        sh:class :Discriminator ;
        sh:maxCount 1 ;
    ] .

:UnionAlternativeShape
    a sh:NodeShape ;
    rdfs:label "union alternative shape" ;
    rdfs:comment "Validates the type and optional ordinal of a union alternative." ;
    sh:targetClass :UnionAlternative ;
    sh:property [
        sh:path :alternativeType ;
        sh:class :Type ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :ordinal ;
        sh:datatype xsd:integer ;
        sh:maxCount 1 ;
    ] .

:EnumShape
    a sh:NodeShape ;
    rdfs:label "enum shape" ;
    rdfs:comment "Validates that enums contain at least one enum member." ;
    sh:targetClass :Enum ;
    sh:property [
        sh:path :hasEnumMember ;
        sh:class :EnumMember ;
        sh:minCount 1 ;
    ] .

:DiscriminatorShape
    a sh:NodeShape ;
    rdfs:label "discriminator shape" ;
    rdfs:comment "Validates discriminator field and optional discriminator envelope metadata." ;
    sh:targetClass :Discriminator ;
    sh:property [
        sh:path :discriminatorField ;
        sh:class :Field ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :discriminatorEnvelope ;
        sh:class :DiscriminatorEnvelope ;
        sh:maxCount 1 ;
    ] .

:CallableTypeShape
    a sh:NodeShape ;
    rdfs:label "callable type shape" ;
    rdfs:comment "Validates parameter and result slots for callable types." ;
    sh:targetClass :CallableType ;
    sh:property [
        sh:path :hasParameterSlot ;
        sh:class :ParameterSlot ;
    ] ;
    sh:property [
        sh:path :hasResultSlot ;
        sh:class :ResultSlot ;
    ] .

:TemplateInstantiationShape
    a sh:NodeShape ;
    rdfs:label "template instantiation shape" ;
    rdfs:comment "Validates the instantiated entity and template arguments of a template instantiation." ;
    sh:targetClass :TemplateInstantiation ;
    sh:property [
        sh:path :instantiates ;
        sh:class :Entity ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :templateArgument ;
        sh:class :TemplateArgument ;
    ] .

:TemplateArgumentShape
    a sh:NodeShape ;
    rdfs:label "template argument shape" ;
    rdfs:comment "Validates optional parameter, type, and value bindings for template arguments." ;
    sh:targetClass :TemplateArgument ;
    sh:property [
        sh:path :argumentParameter ;
        sh:class :TemplateParameter ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :argumentType ;
        sh:class :Type ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :argumentValue ;
        sh:class :Value ;
        sh:maxCount 1 ;
    ] .

:LiteralTypeShape
    a sh:NodeShape ;
    rdfs:label "literal type shape" ;
    rdfs:comment "Validates the base type and literal kind associated with literal types." ;
    sh:targetClass :LiteralType ;
    sh:property [
        sh:path :literalBaseType ;
        sh:class :Type ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :literalKind ;
        sh:class :LiteralKind ;
        sh:maxCount 1 ;
    ] .

:ScalarInitializerShape
    a sh:NodeShape ;
    rdfs:label "scalar initializer shape" ;
    rdfs:comment "Validates scalar initializer result and optional semantic kind metadata." ;
    sh:targetClass :ScalarInitializer ;
    sh:property [
        sh:path :initializerResult ;
        sh:class :Scalar ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :initializerSemanticKind ;
        sh:class :ScalarInitializerSemanticKind ;
        sh:maxCount 1 ;
    ] .

:TypeRelationShape
    a sh:NodeShape ;
    rdfs:label "type relation shape" ;
    rdfs:comment "Validates source and target type links for type relation resources." ;
    sh:targetClass :TypeRelation ;
    sh:property [
        sh:path :relationSourceType ;
        sh:class :Type ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :relationTargetType ;
        sh:class :Type ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] .

:TypeRelationEvidenceShape
    a sh:NodeShape ;
    rdfs:label "type relation evidence shape" ;
    rdfs:comment "Validates optional source and target type evidence links for type relation evidence resources." ;
    sh:targetClass :TypeRelationEvidence ;
    sh:property [
        sh:path :evidenceSourceType ;
        sh:class :Type ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :evidenceTargetType ;
        sh:class :Type ;
        sh:maxCount 1 ;
    ] .
