@prefix af-m: <http://purl.allotrope.org/ontologies/material#> .
@prefix af-p: <http://purl.allotrope.org/ontologies/process#> .
@prefix af-r: <http://purl.allotrope.org/ontologies/result#> .
@prefix af-rl: <http://purl.allotrope.org/ontologies/role#> .
@prefix af-s: <http://purl.allotrope.org/shape/> .
@prefix af-x: <http://purl.allotrope.org/ontologies/property#> .
@prefix bfo: <http://purl.obolibrary.org/obo/BFO> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix iao: <http://purl.obolibrary.org/obo/IAO> .
@prefix obi: <http://purl.obolibrary.org/obo/OBI> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ro: <http://purl.obolibrary.org/obo/RO> .
@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#> .

af-s:AFS_0000149 a sh:NodeShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/core/CR/2024/12/process.shapes> ;
    skos:prefLabel "process time shape" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:message "A well-formed Allotrope process SHOULD have at least 1 temporal relation to another process. Shape targets activities, states, accomplishments and planned processes." ;
    sh:name "process time shape" ;
    sh:severity sh:Warning ;
    sh:sparql [ sh:prefixes <http://purl.allotrope.org/shapes/adm/core/CR/2021/09/prefix.shacl> ;
            sh:select """\r
					SELECT $this WHERE {\r
							FILTER NOT EXISTS {\r
				{\r
					$this ?temporalrelation ?process .\r
					?temporalrelation rdfs:subPropertyOf* ro:_0002222 . # temporally related to\r
					?process rdf:type/rdfs:subClassOf* bfo:_0000015 . # process\r
				} UNION {\r
					?process ?temporalrelation $this .\r
					?temporalrelation rdfs:subPropertyOf* ro:_0002222 . # temporally related to\r
					?process rdf:type/rdfs:subClassOf* bfo:_0000015 . # process\r
				}\r
			}\r
					}\r
			""" ] ;
    sh:targetClass af-p:AFP_0003371,
        af-p:AFP_0003374,
        af-p:AFP_0003620,
        bfo:_0000035,
        obi:_0000011 .

af-s:AFS_0000185 a sh:PropertyShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/core/CR/2024/12/process.shapes> ;
    skos:prefLabel "has specification 1 plan specification" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:class af-r:AFR_0001501 ;
    sh:maxCount 1 ;
    sh:message "It SHOULD have a plan specification." ;
    sh:minCount 1 ;
    sh:path [ sh:alternativePath ( af-x:AFX_0002805 [ sh:inversePath af-x:AFX_0002704 ] ) ] ;
    sh:severity sh:Warning .

af-s:AFS_0000186 a sh:PropertyShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/core/CR/2024/12/process.shapes> ;
    skos:prefLabel "^is about 1 file" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:message "It MUST have a file." ;
    sh:path [ sh:inversePath iao:_0000136 ] ;
    sh:qualifiedMinCount 1 ;
    sh:qualifiedValueShape [ sh:class af-r:AFR_0000639 ;
            sh:message "Type MUST be file." ] .

af-s:AFS_0000187 a sh:PropertyShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/core/CR/2024/12/process.shapes> ;
    skos:prefLabel "has participant 1 software with software agent role" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:message "It SHOULD have exactly 1 participant of software with software agent role." ;
    sh:path ro:_0000057 ;
    sh:qualifiedMinCount 1 ;
    sh:qualifiedValueShape af-s:AFS_0000189 ;
    sh:severity sh:Warning .

af-s:AFS_0000271 a sh:NodeShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/core/CR/2024/12/process.shapes> ;
    skos:prefLabel "start timebase shape" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:message "It MUST have exactly 1 start that has a related timebase leaf node." ;
    sh:name "start timebase shape" ;
    sh:property [ sh:message "It MUST have exactly 1 start that has a related timebase leaf node." ;
            sh:path ro:_0002224 ;
            sh:qualifiedMaxCount 1 ;
            sh:qualifiedMinCount 1 ;
            sh:qualifiedValueShape [ sh:class af-p:AFP_0003328 ;
                    sh:message "Type MUST be start that has a related timebase leaf node." ;
                    sh:property af-s:AFS_0000273 ] ] .

af-s:AFS_0000272 a sh:NodeShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/core/CR/2024/12/process.shapes> ;
    skos:prefLabel "end timebase shape" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:message "It MUST have exactly 1 end that has a related timebase leaf node." ;
    sh:name "end timebase shape" ;
    sh:property [ sh:message "It MUST have exactly 1 end that has a related timebase leaf node." ;
            sh:path ro:_0002230 ;
            sh:qualifiedMaxCount 1 ;
            sh:qualifiedMinCount 1 ;
            sh:qualifiedValueShape [ sh:class af-p:AFP_0003286 ;
                    sh:message "Type MUST be injection that has a related timebase leaf node." ;
                    sh:property af-s:AFS_0000273 ] ] .

af-s:AFS_0000297 a sh:NodeShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/core/CR/2024/12/process.shapes> ;
    skos:prefLabel "has participant subject shape" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:class bfo:_0000003 ;
    sh:message "Subjects of bfo:has participant must always be a BFO occurent." ;
    sh:name "has participant subject shape" ;
    sh:targetSubjectsOf ro:_0000057 .

af-s:AFS_0000298 a sh:NodeShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/core/CR/2024/12/process.shapes> ;
    skos:prefLabel "has participant object shape" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:class bfo:_0000002 ;
    sh:message "Targets of bfo:has participant must always be a BFO continuant." ;
    sh:name "has participant object shape" ;
    sh:targetObjectsOf ro:_0000057 .

af-s:AFS_0000299 a sh:NodeShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/core/CR/2024/12/process.shapes> ;
    skos:prefLabel "has material input subject shape" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:class bfo:_0000003 ;
    sh:message "Subjects of af-x:has material input must always be a BFO occurent." ;
    sh:name "has material input subject shape" ;
    sh:targetSubjectsOf af-x:AFX_0000696 .

af-s:AFS_0000300 a sh:NodeShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/core/CR/2024/12/process.shapes> ;
    skos:prefLabel "has material input object shape" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:class bfo:_0000040 ;
    sh:message "Objects of af-x:has material input must always be a material entity." ;
    sh:name "has material input object shape" ;
    sh:targetObjectsOf af-x:AFX_0000696 .

af-s:AFS_0000301 a sh:NodeShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/core/CR/2024/12/process.shapes> ;
    skos:prefLabel "has material output subject shape" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:class bfo:_0000003 ;
    sh:message "Subjects of af-x:has material output must always be a BFO occurent." ;
    sh:name "has material output subject shape" ;
    sh:targetSubjectsOf af-x:AFX_0000546 .

af-s:AFS_0000302 a sh:NodeShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/core/CR/2024/12/process.shapes> ;
    skos:prefLabel "has material output object shape" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:class bfo:_0000040 ;
    sh:message "Objects of af-x:has material output must always be a material entity." ;
    sh:name "has material output object shape" ;
    sh:targetObjectsOf af-x:AFX_0000546 .

af-s:AFS_0000303 a sh:NodeShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/core/CR/2024/12/process.shapes> ;
    skos:prefLabel "has data input subject shape" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:class bfo:_0000003 ;
    sh:message "Subjects of af-x:has data input must always be a BFO occurent." ;
    sh:name "has data input subject shape" ;
    sh:targetSubjectsOf af-x:AFX_0000542 .

af-s:AFS_0000304 a sh:NodeShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/core/CR/2024/12/process.shapes> ;
    skos:prefLabel "has data input object shape" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:class iao:_0000030 ;
    sh:message "Objects of af-x:has data input must always be an information content entity." ;
    sh:name "has data input object shape" ;
    sh:targetObjectsOf af-x:AFX_0000542 .

af-s:AFS_0000305 a sh:NodeShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/core/CR/2024/12/process.shapes> ;
    skos:prefLabel "has data output subject shape" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:class bfo:_0000003 ;
    sh:message "Subjects of af-x:has data output must always be a BFO occurent." ;
    sh:name "has data output subject shape" ;
    sh:targetSubjectsOf af-x:AFX_0000544 .

af-s:AFS_0000306 a sh:NodeShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/core/CR/2024/12/process.shapes> ;
    skos:prefLabel "has data output object shape" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:class iao:_0000030 ;
    sh:message "Objects of af-x:has data output must always be an information content entity." ;
    sh:name "has data output object shape" ;
    sh:targetObjectsOf af-x:AFX_0000544 .

af-s:AFS_0000307 a sh:NodeShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/core/CR/2024/12/process.shapes> ;
    skos:prefLabel "process boundaries shape" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:message "A process MUST have no more than 1 start and 1 end." ;
    sh:name "process boundaries shape" ;
    sh:property [ sh:message "A process MUST have no more than 1 start." ;
            sh:path ro:_0002224 ;
            sh:qualifiedMaxCount 1 ;
            sh:qualifiedValueShape [ sh:class af-p:AFP_0003328 ] ;
            sh:qualifiedValueShapesDisjoint true ],
        [ sh:message "A process MUST have no more than 1 end." ;
            sh:path ro:_0002230 ;
            sh:qualifiedMaxCount 1 ;
            sh:qualifiedValueShape [ sh:class af-p:AFP_0003286 ] ;
            sh:qualifiedValueShapesDisjoint true ] ;
    sh:targetClass bfo:_0000015 .

af-s:AFS_0000308 a sh:NodeShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/core/CR/2024/12/process.shapes> ;
    skos:prefLabel "planned process shape" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:deactivated true ;
    sh:message "A planned process SHOULD have a specification and a participating agent." ;
    sh:name "planned process shape" ;
    sh:property af-s:AFS_0000291 ;
    sh:severity sh:Warning ;
    sh:targetClass obi:_0000011 .

af-s:AFS_0000309 a sh:NodeShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/core/CR/2024/12/process.shapes> ;
    skos:prefLabel "information process shape" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:deactivated true ;
    sh:message "An information process SHOULD have a specification and a participating agent." ;
    sh:name "information process shape" ;
    sh:property af-s:AFS_0000291 ;
    sh:severity sh:Warning ;
    sh:targetClass af-p:AFP_0000307 .

af-s:AFS_0000480 a sh:PropertyShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/core/CR/2024/12/process.shapes> ;
    skos:prefLabel "with duration shape" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:maxCount 1 ;
    sh:message "It SHOULD have a duration." ;
    sh:minCount 1 ;
    sh:name "with duration shape" ;
    sh:node [ sh:class af-r:AFR_0000966 ;
            sh:property [ sh:class af-p:AFP_0003286 ;
                    sh:maxCount 1 ;
                    sh:message "It MUST describe exactly 1 end." ;
                    sh:minCount 1 ;
                    sh:path af-x:AFX_0002699 ] ] ;
    sh:path af-x:AFX_0000072 ;
    sh:severity sh:Warning .

af-s:AFS_0000189 a sh:NodeShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/core/CR/2024/12/process.shapes> ;
    skos:prefLabel "software with some software agent role" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:class iao:_0000010 ;
    sh:message "The type MUST be software (IAO_0000010) or a subClass thereof." ;
    sh:property [ a sh:PropertyShape ;
            sh:message "There MUST be at least 1 software agent role." ;
            sh:path af-x:AFX_0002730 ;
            sh:qualifiedMinCount 1 ;
            sh:qualifiedValueShape [ sh:class af-rl:AFRL_0000446 ;
                    sh:message "The type MUST be software agent role (AFRL_0000446)." ] ] .

af-s:AFS_0000273 a sh:PropertyShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/core/CR/2024/12/process.shapes> ;
    skos:prefLabel "has timebase leafnode" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:message "It MUST have a related timebase leaf node." ;
    sh:name "has timebase leafnode" ;
    sh:path af-x:AFX_0002802 ;
    sh:qualifiedMinCount 1 ;
    sh:qualifiedValueShape [ sh:and ( af-s:AFS_0000032 ) ;
            sh:class af-r:AFR_0001095 ;
            sh:message "Type MUST be timebase that is a leaf node." ] .

af-s:AFS_0000291 a sh:PropertyShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/core/CR/2024/12/process.shapes> ;
    skos:prefLabel "process agent shape" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:deactivated true ;
    sh:message "A process SHOULD have exactly 1 participant with an agent role in this process e.g. a software agent or human operator." ;
    sh:name "process agent shape" ;
    sh:path ro:_0000057 ;
    sh:qualifiedMaxCount 1 ;
    sh:qualifiedMinCount 1 ;
    sh:qualifiedValueShape [ sh:or ( [ sh:class iao:_0000010 ;
                        sh:property [ sh:minCount 1 ;
                                sh:node [ sh:class af-rl:AFRL_0000446 ] ;
                                sh:path af-x:AFX_0002730 ] ] [ sh:class af-m:AFM_0001083 ;
                        sh:property [ sh:minCount 1 ;
                                sh:node [ sh:class af-rl:AFRL_0000095 ] ;
                                sh:path ro:_0000087 ] ] ) ] ;
    sh:severity sh:Warning .

<http://purl.allotrope.org/shapes/adm/core/CR/2024/12/process.shapes> a owl:Ontology ;
    dct:description "Module with process shapes of Allotrope shape library." ;
    dct:license <http://purl.allotrope.org/voc/creative-commons-attribution-license> ;
    dct:publisher <http://www.allotrope.org> ;
    dct:rights <http://purl.allotrope.org/voc/attribution>,
        <http://purl.allotrope.org/voc/copyright> ;
    dct:title "Allotrope Process Shapes (CR/2024/12)" ;
    owl:imports <http://purl.allotrope.org/shapes/adm/core/CR/2021/09/common.shapes>,
        <http://purl.allotrope.org/shapes/adm/core/CR/2021/09/prefix.shacl>,
        <http://purl.allotrope.org/shapes/qudt/REC/2022/06/qudt.shapes> ;
    owl:priorVersion <http://purl.allotrope.org/shapes/adm/core/CR/2021/09/process.shapes> ;
    owl:versionIRI <http://purl.allotrope.org/shapes/adm/core/CR/2024/12/process.shapes> ;
    owl:versionInfo "CR/2024/12" ;
    skos:prefLabel "process shapes (adm::core)" .

