@prefix pn:   <http://pastnetworks.org/terms/> .
@prefix schema: <https://schema.org/> .
@prefix sh:   <http://www.w3.org/ns/shacl#> .
@prefix dct:  <http://purl.org/dc/terms/> .
@prefix owl:  <http://www.w3.org/2002/07/owl#> .
@prefix xsd:  <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

<https://pastnetworks.org/terms/pastnetworks-shapes>
    a owl:Ontology ;
    rdfs:label "PastNetworks SHACL shapes" ;
    rdfs:comment "Validation contract for PastNetworks linked data." ;
    dct:issued "2026-08-25"^^xsd:date ;
    dct:modified "2026-08-25"^^xsd:date ;
    dct:references <http://pastnetworks.org/terms/> ;
    dct:conformsTo <http://www.w3.org/ns/shacl#> ;
    owl:versionInfo "1.0.0" ;
    owl:versionIRI <https://pastnetworks.org/terms/1.0.0/pastnetworks-shapes.ttl> .

pn:YesNoValueShape a sh:NodeShape ;
    sh:datatype xsd:string ;
    sh:in ( "yes" "no" ) .

pn:NetworkDatasetShape a sh:NodeShape ;
    sh:targetClass pn:NetworkDataset ;
    sh:property [ sh:path dct:identifier ; sh:datatype xsd:integer ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path schema:name ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:icon ; sh:datatype xsd:string ; sh:in ( "miscellaneous" "pottery" "transportation" ) ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:dataUrl ; sh:nodeKind sh:IRI ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path dct:bibliographicCitation ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path dct:description ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path schema:encodingFormat ; sh:datatype xsd:string ; sh:in ( "csv" "graphml" "json" "net" "tsv" "txt" "xls" "xlsx" "other" ) ; sh:minCount 1 ] ;
    sh:property [ sh:path dct:creator ; sh:class schema:Person ; sh:node pn:AuthorShape ; sh:nodeKind sh:BlankNodeOrIRI ; sh:minCount 1 ] ;
    sh:property [ sh:path dct:license ; sh:class dct:LicenseDocument ; sh:node pn:LicenseShape ; sh:nodeKind sh:BlankNodeOrIRI ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path schema:keywords ; sh:datatype xsd:string ; sh:minCount 1 ] ;
    sh:property [ sh:path pn:collectionTags ; sh:datatype xsd:string ] ;
    sh:property [ sh:path schema:image ; sh:class schema:ImageObject ; sh:node pn:ImageShape ; sh:nodeKind sh:BlankNodeOrIRI ] ;
    sh:property [ sh:path pn:funding ; sh:datatype xsd:string ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:dataPublisher ; sh:datatype xsd:string ; sh:maxCount 1 ] ;
    sh:property [ sh:path dct:relation ; sh:class schema:CreativeWork ; sh:node pn:RelatedPublicationShape ; sh:nodeKind sh:BlankNodeOrIRI ] ;
    sh:property [ sh:path pn:topic ; sh:node pn:TopicDescriptionShape ; sh:nodeKind sh:BlankNodeOrIRI ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:structure ; sh:node pn:NetworkStructureShape ; sh:nodeKind sh:BlankNodeOrIRI ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:size ; sh:node pn:NetworkSizeShape ; sh:nodeKind sh:BlankNodeOrIRI ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:statistics ; sh:node pn:StatisticsShape ; sh:nodeKind sh:BlankNodeOrIRI ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:construction ; sh:node pn:ConstructionDescriptionShape ; sh:nodeKind sh:BlankNodeOrIRI ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:_meta ; sh:node pn:MetadataShape ; sh:nodeKind sh:BlankNodeOrIRI ; sh:minCount 1 ; sh:maxCount 1 ] .

pn:AuthorShape a sh:NodeShape ;
    sh:property [ sh:path schema:givenName ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path schema:familyName ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:affiliation ; sh:datatype xsd:string ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:orcidId ; sh:datatype xsd:string ; sh:pattern "^[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{3}[0-9X]$" ; sh:maxCount 1 ] .

pn:LicenseShape a sh:NodeShape ;
    sh:property [ sh:path dct:identifier ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path schema:name ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:reference ; sh:nodeKind sh:IRI ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:detailsUrl ; sh:nodeKind sh:IRI ; sh:maxCount 1 ] .

pn:ImageShape a sh:NodeShape ;
    sh:property [ sh:path schema:name ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path schema:encodingFormat ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path schema:caption ; sh:datatype xsd:string ; sh:maxCount 1 ] .

pn:RelatedPublicationShape a sh:NodeShape ;
    sh:property [ sh:path dct:bibliographicCitation ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path schema:url ; sh:nodeKind sh:IRI ; sh:maxCount 1 ] .

pn:TopicDescriptionShape a sh:NodeShape ;
    sh:property [ sh:path pn:yearFrom ; sh:datatype xsd:integer ; sh:minInclusive -4000000 ; sh:lessThan pn:yearTo ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:yearTo ; sh:datatype xsd:integer ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:modernCountriesAndContinents ; sh:class schema:Place ; sh:node pn:PlaceShape ; sh:nodeKind sh:BlankNodeOrIRI ; sh:minCount 1 ] ;
    sh:property [ sh:path pn:networkTopics ; sh:datatype xsd:string ; sh:minCount 1 ] ;
    sh:property [ sh:path pn:nodeTopics ; sh:datatype xsd:string ; sh:minCount 1 ] ;
    sh:property [ sh:path pn:edgeTopics ; sh:datatype xsd:string ; sh:minCount 1 ] ;
    sh:property [ sh:path pn:nodeAttributes ; sh:datatype xsd:string ] ;
    sh:property [ sh:path pn:edgeAttributes ; sh:datatype xsd:string ] ;
    sh:property [ sh:path pn:uncertainNodes ; sh:node pn:YesNoValueShape ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:uncertainEdges ; sh:node pn:YesNoValueShape ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:uncertainNodeAttributes ; sh:node pn:YesNoValueShape ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:uncertainEdgeAttributes ; sh:node pn:YesNoValueShape ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:uncertaintyDescription ; sh:datatype xsd:string ; sh:maxCount 1 ] .

pn:PlaceShape a sh:NodeShape ;
    sh:property [ sh:path schema:name ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:capital ; sh:datatype xsd:string ; sh:maxCount 1 ] ;
    sh:property [ sh:path schema:geo ; sh:class schema:GeoCoordinates ; sh:node pn:CoordinatesShape ; sh:nodeKind sh:BlankNodeOrIRI ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:iso2 ; sh:datatype xsd:string ; sh:pattern "^[A-Z]{2}$" ; sh:maxCount 1 ] ;
    sh:property [ sh:path schema:identifier ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] .

pn:CoordinatesShape a sh:NodeShape ;
    sh:property [ sh:path schema:longitude ; sh:datatype xsd:double ; sh:minInclusive -180 ; sh:maxInclusive 180 ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path schema:latitude ; sh:datatype xsd:double ; sh:minInclusive -90 ; sh:maxInclusive 90 ; sh:minCount 1 ; sh:maxCount 1 ] .

pn:NetworkStructureShape a sh:NodeShape ;
    sh:property [ sh:path pn:directionality ; sh:datatype xsd:string ; sh:in ( "directed" "undirected" "directed and undirected" ) ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:weighted ; sh:node pn:YesNoValueShape ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:multigraph ; sh:node pn:YesNoValueShape ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:selfLoops ; sh:node pn:YesNoValueShape ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:spatial ; sh:node pn:YesNoValueShape ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:longitudinal ; sh:node pn:YesNoValueShape ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:multipartile ; sh:node pn:YesNoValueShape ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:multilayer ; sh:node pn:YesNoValueShape ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:hypergraph ; sh:node pn:YesNoValueShape ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:signed ; sh:node pn:YesNoValueShape ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:probabilistic ; sh:node pn:YesNoValueShape ; sh:maxCount 1 ] .

pn:NetworkSizeShape a sh:NodeShape ;
    sh:property [ sh:path pn:numberOfNodes ; sh:datatype xsd:integer ; sh:minInclusive 0 ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:numberOfEdges ; sh:datatype xsd:integer ; sh:minInclusive 0 ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:numberOfIsolates ; sh:datatype xsd:integer ; sh:minInclusive 0 ; sh:maxCount 1 ] .

pn:StatisticsShape a sh:NodeShape ;
    sh:property [ sh:path pn:averageClusteringCoefficient ; sh:datatype xsd:double ; sh:maxCount 1 ] ;
    sh:property [
        sh:path pn:averageDegree ;
        sh:or (
            [ sh:datatype xsd:integer ]
            [ sh:datatype xsd:double ]
            [ sh:node pn:AverageDegreeShape ; sh:nodeKind sh:BlankNodeOrIRI ]
        ) ;
        sh:maxCount 1
    ] .

pn:AverageDegreeShape a sh:NodeShape ;
    sh:property [ sh:path pn:in ; sh:datatype xsd:double ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:out ; sh:datatype xsd:double ; sh:maxCount 1 ] .

pn:ConstructionDescriptionShape a sh:NodeShape ;
    sh:property [ sh:path dct:description ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:sources ; sh:node pn:SourceDescriptionShape ; sh:nodeKind sh:BlankNodeOrIRI ; sh:minCount 1 ] ;
    sh:property [ sh:path pn:dataCurationCodeUrl ; sh:nodeKind sh:IRI ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:additionalComments ; sh:datatype xsd:string ; sh:maxCount 1 ] .

pn:SourceDescriptionShape a sh:NodeShape ;
    sh:property [ sh:path dct:description ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:sourceTypes ; sh:datatype xsd:string ; sh:minCount 1 ] .

pn:MetadataShape a sh:NodeShape ;
    sh:property [ sh:path pn:created ; sh:datatype xsd:integer ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path pn:lastEdited ; sh:datatype xsd:integer ; sh:minCount 1 ; sh:maxCount 1 ] .
