@prefix : <https://ontology.inferal.com/modules/company-intelligence/> .
@prefix conf: <https://ontology.inferal.com/modules/confidence/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@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#> .

:EconomicEntityShape
    a sh:NodeShape ;
    rdfs:label "economic entity shape" ;
    rdfs:comment "Basic validation for economic entities." ;
    sh:targetClass :EconomicEntity ;
    sh:property [
        sh:path rdfs:label ;
        sh:minCount 1 ;
    ] .

:LegalEntityShape
    a sh:NodeShape ;
    rdfs:label "legal entity shape" ;
    rdfs:comment "Basic validation for legal entities and their optional jurisdiction evidence." ;
    sh:targetClass :LegalEntity ;
    sh:property [
        sh:path rdfs:label ;
        sh:minCount 1 ;
    ] .

:OperatingEntityShape
    a sh:NodeShape ;
    rdfs:label "operating entity shape" ;
    rdfs:comment "Basic validation for operating entities." ;
    sh:targetClass :OperatingEntity ;
    sh:property [
        sh:path rdfs:label ;
        sh:minCount 1 ;
    ] .

:ReportingEntityShape
    a sh:NodeShape ;
    rdfs:label "reporting entity shape" ;
    rdfs:comment "Basic validation for reporting entities." ;
    sh:targetClass :ReportingEntity ;
    sh:property [
        sh:path rdfs:label ;
        sh:minCount 1 ;
    ] .

:IssuerShape
    a sh:NodeShape ;
    rdfs:label "issuer shape" ;
    rdfs:comment "Basic validation for issuers." ;
    sh:targetClass :Issuer ;
    sh:property [
        sh:path rdfs:label ;
        sh:minCount 1 ;
    ] .

:BrandShape
    a sh:NodeShape ;
    rdfs:label "brand shape" ;
    rdfs:comment "Basic validation for brands." ;
    sh:targetClass :Brand ;
    sh:property [
        sh:path rdfs:label ;
        sh:minCount 1 ;
    ] .

:JurisdictionShape
    a sh:NodeShape ;
    rdfs:label "jurisdiction shape" ;
    rdfs:comment "Basic validation for jurisdictions." ;
    sh:targetClass :Jurisdiction ;
    sh:property [
        sh:path rdfs:label ;
        sh:minCount 1 ;
    ] .

:IdentifierSchemeShape
    a sh:NodeShape ;
    rdfs:label "identifier scheme shape" ;
    rdfs:comment "Basic validation for identifier schemes." ;
    sh:targetClass :IdentifierScheme ;
    sh:property [
        sh:path rdfs:label ;
        sh:minCount 1 ;
    ] .

:EntityIdentifierShape
    a sh:NodeShape ;
    rdfs:label "entity identifier shape" ;
    rdfs:comment "Validation shape for identifier assignments with scheme, value, and identified-entity fields." ;
    sh:targetClass :EntityIdentifier ;
    sh:property [
        sh:path :identifierScheme ;
        sh:class :IdentifierScheme ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :identifierValue ;
        sh:datatype xsd:string ;
        sh:minLength 1 ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :identifiesEntity ;
        sh:class :EconomicEntity ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :source ;
        sh:class :Source ;
        sh:maxCount 1 ;
    ] .

:SourceShape
    a sh:NodeShape ;
    rdfs:label "source shape" ;
    rdfs:comment "Validates basic source metadata." ;
    sh:targetClass :Source ;
    sh:property [
        sh:path rdfs:label ;
        sh:minCount 1 ;
    ] ;
    sh:property [
        sh:path prov:generatedAtTime ;
        sh:datatype xsd:dateTime ;
        sh:maxCount 1 ;
    ] .

:SourceDocumentShape
    a sh:NodeShape ;
    rdfs:label "source document shape" ;
    rdfs:comment "Basic validation for source documents." ;
    sh:targetClass :SourceDocument ;
    sh:property [
        sh:path rdfs:label ;
        sh:minCount 1 ;
    ] .

:DatasetSourceShape
    a sh:NodeShape ;
    rdfs:label "dataset source shape" ;
    rdfs:comment "Basic validation for dataset sources." ;
    sh:targetClass :DatasetSource ;
    sh:property [
        sh:path rdfs:label ;
        sh:minCount 1 ;
    ] .

:FilingShape
    a sh:NodeShape ;
    rdfs:label "filing shape" ;
    rdfs:comment "Basic validation for filings." ;
    sh:targetClass :Filing ;
    sh:property [
        sh:path rdfs:label ;
        sh:minCount 1 ;
    ] .

:AssertionShape
    a sh:NodeShape ;
    rdfs:label "assertion shape" ;
    rdfs:comment "Validates sourced assertions with source and optional confidence assessment." ;
    sh:targetClass :Assertion ;
    sh:property [
        sh:path :source ;
        sh:class :Source ;
        sh:minCount 1 ;
    ] ;
    sh:property [
        sh:path :assertionKind ;
        sh:class skos:Concept ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :confidenceAssessment ;
        sh:class conf:ConfidenceAssessment ;
        sh:maxCount 1 ;
    ] ;
    sh:xone (
        [
            sh:property [
                sh:path :assertedObject ;
                sh:minCount 1 ;
            ] ;
            sh:property [
                sh:path :assertedValue ;
                sh:maxCount 0 ;
            ]
        ]
        [
            sh:property [
                sh:path :assertedValue ;
                sh:minCount 1 ;
            ] ;
            sh:property [
                sh:path :assertedObject ;
                sh:maxCount 0 ;
            ]
        ]
        [
            sh:property [
                sh:path :assertedObject ;
                sh:maxCount 0 ;
            ] ;
            sh:property [
                sh:path :assertedValue ;
                sh:maxCount 0 ;
            ]
        ]
    ) .

:EntityIdentityAssertionShape
    a sh:NodeShape ;
    rdfs:label "entity identity assertion shape" ;
    rdfs:comment "Validates identity assertions without forcing owl:sameAs semantics." ;
    sh:targetClass :EntityIdentityAssertion ;
    sh:property [
        sh:path :matchSubject ;
        sh:nodeKind sh:BlankNodeOrIRI ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :matchTarget ;
        sh:nodeKind sh:BlankNodeOrIRI ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :matchBasis ;
        sh:nodeKind sh:BlankNodeOrIRI ;
        sh:minCount 1 ;
    ] .

:RelationshipAssertionShape
    a sh:NodeShape ;
    rdfs:label "relationship assertion shape" ;
    rdfs:comment "Basic validation for relationship assertions." ;
    sh:targetClass :RelationshipAssertion ;
    sh:property [
        sh:path :source ;
        sh:class :Source ;
        sh:minCount 1 ;
    ] .

:ObservationShape
    a sh:NodeShape ;
    rdfs:label "observation shape" ;
    rdfs:comment "Basic validation for sourced observations." ;
    sh:targetClass :Observation ;
    sh:property [
        sh:path :source ;
        sh:class :Source ;
        sh:minCount 1 ;
    ] .

:MetricObservationShape
    a sh:NodeShape ;
    rdfs:label "metric observation shape" ;
    rdfs:comment "Validates operational and market metric observations." ;
    sh:targetClass :MetricObservation ;
    sh:property [
        sh:path :metricConcept ;
        sh:class :MetricConcept ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :metricValue ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :unit ;
        sh:class :Unit ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] .

:FinancialFactShape
    a sh:NodeShape ;
    rdfs:label "financial fact shape" ;
    rdfs:comment "Validates XBRL-facing financial facts with concept, value, unit, reporting context, source filing, and optional decimals." ;
    sh:targetClass :FinancialFact ;
    sh:property [
        sh:path :financialConcept ;
        sh:class :FinancialConcept ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :reportedValue ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :unit ;
        sh:class :Unit ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :reportingContext ;
        sh:class :ReportingContext ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :reportedIn ;
        sh:class :Source ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :decimals ;
        sh:datatype xsd:integer ;
        sh:maxCount 1 ;
    ] .

:ReportingContextShape
    a sh:NodeShape ;
    rdfs:label "reporting context shape" ;
    rdfs:comment "Validates reporting contexts as either duration contexts or instant contexts." ;
    sh:targetClass :ReportingContext ;
    sh:property [
        sh:path :reportingEntity ;
        sh:class :ReportingEntity ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :accountingBasis ;
        sh:class :AccountingBasis ;
        sh:maxCount 1 ;
    ] ;
    sh:xone (
        [
            sh:property [
                sh:path :periodStart ;
                sh:datatype xsd:date ;
                sh:minCount 1 ;
                sh:maxCount 1 ;
            ] ;
            sh:property [
                sh:path :periodEnd ;
                sh:datatype xsd:date ;
                sh:minCount 1 ;
                sh:maxCount 1 ;
            ] ;
            sh:property [
                sh:path :instantDate ;
                sh:maxCount 0 ;
            ]
        ]
        [
            sh:property [
                sh:path :instantDate ;
                sh:datatype xsd:date ;
                sh:minCount 1 ;
                sh:maxCount 1 ;
            ] ;
            sh:property [
                sh:path :periodStart ;
                sh:maxCount 0 ;
            ] ;
            sh:property [
                sh:path :periodEnd ;
                sh:maxCount 0 ;
            ]
        ]
    ) .

:FinancialConceptShape
    a sh:NodeShape ;
    rdfs:label "financial concept shape" ;
    rdfs:comment "Validates financial concepts and optional XBRL concept names." ;
    sh:targetClass :FinancialConcept ;
    sh:property [
        sh:path rdfs:label ;
        sh:minCount 1 ;
    ] ;
    sh:property [
        sh:path :xbrlConceptName ;
        sh:datatype xsd:string ;
        sh:maxCount 1 ;
    ] .

:MetricConceptShape
    a sh:NodeShape ;
    rdfs:label "metric concept shape" ;
    rdfs:comment "Basic validation for metric concepts." ;
    sh:targetClass :MetricConcept ;
    sh:property [
        sh:path rdfs:label ;
        sh:minCount 1 ;
    ] .

:EventShape
    a sh:NodeShape ;
    rdfs:label "event shape" ;
    rdfs:comment "Validates events with a date and at least one subject or participant." ;
    sh:targetClass :Event ;
    sh:property [
        sh:path :eventDate ;
        sh:datatype xsd:date ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:or (
        [
            sh:property [
                sh:path :eventSubject ;
                sh:minCount 1 ;
            ]
        ]
        [
            sh:property [
                sh:path :eventParticipant ;
                sh:minCount 1 ;
            ]
        ]
    ) .

:FormationEventShape
    a sh:NodeShape ;
    rdfs:label "formation event shape" ;
    rdfs:comment "Basic validation for formation events." ;
    sh:targetClass :FormationEvent ;
    sh:property [
        sh:path :eventSubject ;
        sh:class :EconomicEntity ;
        sh:minCount 1 ;
    ] .

:FundingEventShape
    a sh:NodeShape ;
    rdfs:label "funding event shape" ;
    rdfs:comment "Validates funding events with subject, date, amount, and currency when the total amount is known." ;
    sh:targetClass :FundingEvent ;
    sh:property [
        sh:path :eventSubject ;
        sh:class :EconomicEntity ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :amount ;
        sh:datatype xsd:decimal ;
        sh:minInclusive 0 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :currency ;
        sh:class :Currency ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :postMoneyValuation ;
        sh:datatype xsd:decimal ;
        sh:minInclusive 0 ;
        sh:maxCount 1 ;
    ] .

:AcquisitionEventShape
    a sh:NodeShape ;
    rdfs:label "acquisition event shape" ;
    rdfs:comment "Validates acquisition event parties and resulting relationships." ;
    sh:targetClass :AcquisitionEvent ;
    sh:property [
        sh:path :acquiringEntity ;
        sh:class :EconomicEntity ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :acquiredEntity ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :resultingRelationship ;
        sh:class :Relationship ;
    ] .

:MergerEventShape
    a sh:NodeShape ;
    rdfs:label "merger event shape" ;
    rdfs:comment "Basic validation for merger events." ;
    sh:targetClass :MergerEvent ;
    sh:property [
        sh:path :eventParticipant ;
        sh:minCount 2 ;
    ] .

:IPOEventShape
    a sh:NodeShape ;
    rdfs:label "IPO event shape" ;
    rdfs:comment "Basic validation for IPO events." ;
    sh:targetClass :IPOEvent ;
    sh:property [
        sh:path :eventSubject ;
        sh:class :Issuer ;
        sh:minCount 1 ;
    ] .

:NameChangeEventShape
    a sh:NodeShape ;
    rdfs:label "name change event shape" ;
    rdfs:comment "Basic validation for name change events." ;
    sh:targetClass :NameChangeEvent ;
    sh:property [
        sh:path :eventSubject ;
        sh:minCount 1 ;
    ] .

:RelationshipShape
    a sh:NodeShape ;
    rdfs:label "relationship shape" ;
    rdfs:comment "Validates qualified relationship endpoints and optional validity period." ;
    sh:targetClass :Relationship ;
    sh:property [
        sh:path :relationshipSubject ;
        sh:nodeKind sh:BlankNodeOrIRI ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :relationshipObject ;
        sh:nodeKind sh:BlankNodeOrIRI ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :relationshipType ;
        sh:nodeKind sh:BlankNodeOrIRI ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :validFrom ;
        sh:datatype xsd:date ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :validThrough ;
        sh:datatype xsd:date ;
        sh:maxCount 1 ;
    ] .

:OwnershipRelationshipShape
    a sh:NodeShape ;
    rdfs:label "ownership relationship shape" ;
    rdfs:comment "Validates ownership percentages." ;
    sh:targetClass :OwnershipRelationship ;
    sh:property [
        sh:path :percentOwned ;
        sh:datatype xsd:decimal ;
        sh:minInclusive 0 ;
        sh:maxInclusive 100 ;
        sh:maxCount 1 ;
    ] .

:ControlRelationshipShape
    a sh:NodeShape ;
    rdfs:label "control relationship shape" ;
    rdfs:comment "Validates control mechanism metadata." ;
    sh:targetClass :ControlRelationship ;
    sh:property [
        sh:path :controlMechanism ;
        sh:nodeKind sh:BlankNodeOrIRI ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] .

:RoleShape
    a sh:NodeShape ;
    rdfs:label "role shape" ;
    rdfs:comment "Validates time-bounded role relationships." ;
    sh:targetClass :Role ;
    sh:property [
        sh:path :roleHolder ;
        sh:nodeKind sh:BlankNodeOrIRI ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :roleInEntity ;
        sh:nodeKind sh:BlankNodeOrIRI ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :roleTitle ;
        sh:datatype xsd:string ;
        sh:maxCount 1 ;
    ] .

:FounderRoleShape
    a sh:NodeShape ;
    rdfs:label "founder role shape" ;
    rdfs:comment "Basic validation for founder roles." ;
    sh:targetClass :FounderRole ;
    sh:property [
        sh:path :roleHolder ;
        sh:minCount 1 ;
    ] .

:ExecutiveRoleShape
    a sh:NodeShape ;
    rdfs:label "executive role shape" ;
    rdfs:comment "Basic validation for executive roles." ;
    sh:targetClass :ExecutiveRole ;
    sh:property [
        sh:path :roleTitle ;
        sh:datatype xsd:string ;
        sh:minCount 1 ;
    ] .

:BoardRoleShape
    a sh:NodeShape ;
    rdfs:label "board role shape" ;
    rdfs:comment "Basic validation for board roles." ;
    sh:targetClass :BoardRole ;
    sh:property [
        sh:path :roleHolder ;
        sh:minCount 1 ;
    ] .

:InvestmentParticipationShape
    a sh:NodeShape ;
    rdfs:label "investment participation shape" ;
    rdfs:comment "Validates investor participation in funding events." ;
    sh:targetClass :InvestmentParticipation ;
    sh:property [
        sh:path :investor ;
        sh:nodeKind sh:BlankNodeOrIRI ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :fundingEvent ;
        sh:class :FundingEvent ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :leadInvestor ;
        sh:datatype xsd:boolean ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :amount ;
        sh:datatype xsd:decimal ;
        sh:minInclusive 0 ;
        sh:maxCount 1 ;
    ] .

:InstrumentShape
    a sh:NodeShape ;
    rdfs:label "instrument shape" ;
    rdfs:comment "Basic validation for instruments." ;
    sh:targetClass :Instrument ;
    sh:property [
        sh:path rdfs:label ;
        sh:minCount 1 ;
    ] .

:ClassificationShape
    a sh:NodeShape ;
    rdfs:label "classification shape" ;
    rdfs:comment "Validates sourced classifications and their target concepts." ;
    sh:targetClass :Classification ;
    sh:property [
        sh:path :classificationTarget ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :classifiedAs ;
        sh:minCount 1 ;
    ] ;
    sh:property [
        sh:path :source ;
        sh:class :Source ;
        sh:minCount 1 ;
    ] .

:ExternalVocabularyUseShape
    a sh:NodeShape ;
    rdfs:label "external vocabulary use shape" ;
    rdfs:comment "Validates records that explain external ontology reuse, mapping, or non-import decisions." ;
    sh:targetClass :ExternalVocabularyUse ;
    sh:property [
        sh:path :vocabulary ;
        sh:nodeKind sh:IRI ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path prov:generatedAtTime ;
        sh:datatype xsd:dateTime ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :mappingRationale ;
        sh:datatype xsd:string ;
        sh:minLength 20 ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] .

:ConflictSetShape
    a sh:NodeShape ;
    rdfs:label "conflict set shape" ;
    rdfs:comment "Validates that a conflict set identifies at least two conflicting assertions." ;
    sh:targetClass :ConflictSet ;
    sh:property [
        sh:path :conflictingAssertion ;
        sh:class :Assertion ;
        sh:minCount 2 ;
    ] ;
    sh:property [
        sh:path :canonicalAssertion ;
        sh:class :Assertion ;
        sh:maxCount 1 ;
    ] .

:CurrencyShape
    a sh:NodeShape ;
    rdfs:label "currency shape" ;
    rdfs:comment "Basic validation for currencies." ;
    sh:targetClass :Currency ;
    sh:property [
        sh:path rdfs:label ;
        sh:minCount 1 ;
    ] .

:UnitShape
    a sh:NodeShape ;
    rdfs:label "unit shape" ;
    rdfs:comment "Basic validation for units." ;
    sh:targetClass :Unit ;
    sh:property [
        sh:path rdfs:label ;
        sh:minCount 1 ;
    ] .

:AccountingBasisShape
    a sh:NodeShape ;
    rdfs:label "accounting basis shape" ;
    rdfs:comment "Basic validation for accounting basis resources." ;
    sh:targetClass :AccountingBasis ;
    sh:property [
        sh:path rdfs:label ;
        sh:minCount 1 ;
    ] .
