@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 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_0000144 a sh:NodeShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/chromatography/REC/2022/06/chromatography-data-processing.shapes> ;
    skos:prefLabel "chromatography data processing shape" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:deactivated false ;
    sh:message "A well-formed Allotrope chromatography data processing node MUST have at least 1 part of integration that MUST conform to detailed constraints AND MUST have a related software AND SHOULD have exactly 1 specification AND CAN have up to 1 part of peak identification AND CAN have further subprocesses that MUST conform to detailed constraints." ;
    sh:property [ sh:message "Chromatography data processing MUST have at least 1 integration as part that MUST conform to detailed constraints." ;
            sh:path bfo:_0000117 ;
            sh:qualifiedMinCount 1 ;
            sh:qualifiedValueShape af-s:AFS_0000254 ],
        [ sh:message "Chromatography data processing CAN have zero or 1 peak identification that MUST have a specification." ;
            sh:path bfo:_0000117 ;
            sh:qualifiedMaxCount 1 ;
            sh:qualifiedValueShape [ sh:class af-p:AFP_0003618 ;
                    sh:message "Type MUST be peak identification that MUST have a specification." ;
                    sh:property af-s:AFS_0000185 ] ],
        af-s:AFS_0000185,
        af-s:AFS_0000250 ;
    sh:targetClass af-p:AFP_0002089 .

af-s:AFS_0000259 a sh:PropertyShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/chromatography/REC/2022/06/chromatography-data-processing.shapes> ;
    skos:prefLabel "peak height property specification for totaling shape" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:deactivated false ;
    sh:message "It MUST have exactly 1 data input of a property specification that specifies peak height as the statistical feature." ;
    sh:name "peak height property specification for totaling shape" ;
    sh:path af-x:AFX_0000542 ;
    sh:qualifiedMaxCount 1 ;
    sh:qualifiedMinCount 1 ;
    sh:qualifiedValueShape [ sh:class af-r:AFR_0001286 ;
            sh:message "Type MUST be property specification that specifies peak height as the statistical feature." ;
            sh:property [ sh:hasValue af-r:AFR_0000948 ;
                    sh:maxCount 1 ;
                    sh:message "It MUST specify peak height (punning)." ;
                    sh:minCount 1 ;
                    sh:path af-x:AFX_0002704 ],
                [ sh:maxCount 1 ;
                    sh:message "It MUST have exactly 1 role of statistical population feature with scope of totaling." ;
                    sh:minCount 1 ;
                    sh:node [ sh:class af-rl:AFRL_0000325 ;
                            sh:message "Type MUST be statistical population feature with scope of totaling." ;
                            sh:property [ sh:class af-p:AFP_0003572 ;
                                    sh:maxCount 1 ;
                                    sh:message "It MUST have scope of totaling." ;
                                    sh:minCount 1 ;
                                    sh:path af-x:AFX_0002731 ] ] ;
                    sh:path af-x:AFX_0002730 ],
                [ sh:maxCount 1 ;
                    sh:message "It MUST be facet of a specification that specifies totaling." ;
                    sh:minCount 1 ;
                    sh:node [ sh:class af-r:AFR_0001501 ;
                            sh:message "Type MUST be plan specification that specifies totaling." ;
                            sh:property [ sh:class af-p:AFP_0003572 ;
                                    sh:maxCount 1 ;
                                    sh:message "It MUST specify exactly 1 totaling." ;
                                    sh:minCount 1 ;
                                    sh:path [ sh:inversePath af-x:AFX_0002805 ] ] ] ;
                    sh:path [ sh:inversePath af-x:AFX_0002803 ] ] ;
            sh:sparql [ a sh:SPARQLConstraint ;
                    sh:message "It MUST have role of statistical population feature in same process of totaling." ;
                    sh:prefixes <http://purl.allotrope.org/shapes/adm/core/REC/2022/06/prefix.shapes> ;
                    sh:select """\r
				SELECT $this WHERE {\r
					{\r
						$this ^af-x:AFX_0000542 ?totaling1 . # inverse has data input\r
						?totaling1 rdf:type/rdfs:subClassOf* af-p:AFP_0003572 . # totaling\r
						$this af-x:AFX_0002730 ?role . # has contextual role\r
						?role rdf:type/rdfs:subClassOf* af-rl:AFRL_0000325 . # statistical population feature\r
						?role af-x:AFX_0002731 ?totaling2 . # in process\r
						?totaling2 rdf:type/rdfs:subClassOf* af-p:AFP_0003572 . # totaling\r
					}\r
					FILTER(?totaling1 != ?totaling2)\r
				}\r
			""" ],
                [ a sh:SPARQLConstraint ;
                    sh:message "It MUST be facet of a specification that specifies same totaling." ;
                    sh:prefixes <http://purl.allotrope.org/shapes/adm/core/REC/2022/06/prefix.shapes> ;
                    sh:select """\r
				SELECT $this WHERE {\r
					{\r
						$this ^af-x:AFX_0000542 ?totaling1 . # inverse has data input\r
						?totaling1 rdf:type/rdfs:subClassOf* af-p:AFP_0003572 . # totaling\r
						$this ^af-x:AFX_0002803 ?spec . # inverse has facet\r
						?spec rdf:type/rdfs:subClassOf* af-r:AFR_0001501 . # plan specification\r
						?spec ^af-x:AFX_0002805 ?totaling2 . # inverse has specification\r
						?totaling2 rdf:type/rdfs:subClassOf* af-p:AFP_0003572 . # totaling\r
					}\r
					FILTER(?totaling1 != ?totaling2)\r
				}\r
			""" ] ] .

af-s:AFS_0000250 a sh:PropertyShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/chromatography/REC/2022/06/chromatography-data-processing.shapes> ;
    skos:prefLabel "chromatography processing software shape" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:deactivated false ;
    sh:message "Chromatography data processing SHOULD have a related software that MUST conform to detailed constraints." ;
    sh:name "chromatography processing software shape" ;
    sh:path ro:_0000057 ;
    sh:qualifiedMaxCount 1 ;
    sh:qualifiedMinCount 1 ;
    sh:qualifiedValueShape [ sh:class iao:_0000010 ;
            sh:message "Type MUST be software that MUST have a role of software agent role AND that MUST be identified by an identifier." ;
            sh:property [ sh:class af-rl:AFRL_0000446 ;
                    sh:message "Software MUST have a role of software agent role." ;
                    sh:minCount 1 ;
                    sh:path af-x:AFX_0002730 ],
                [ sh:message "Software MUST be identified by an identifier." ;
                    sh:minCount 1 ;
                    sh:node af-s:AFS_0000020 ;
                    sh:path [ sh:inversePath af-x:AFX_0002717 ] ] ] ;
    sh:severity sh:Warning .

af-s:AFS_0000254 a sh:NodeShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/chromatography/REC/2022/06/chromatography-data-processing.shapes> ;
    skos:prefLabel "chromatography integration shape" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:class af-p:AFP_0000970 ;
    sh:deactivated false ;
    sh:message "Type MUST be integration that MUST have at least 1 chromatogram as data input AND MUST have exactly 1 specification AND CAN have a defined end time AND CAN have a related peak list AND peaks." ;
    sh:property [ sh:message "It MUST have at least 1 chromatogram as data input." ;
            sh:path af-x:AFX_0000542 ;
            sh:qualifiedMinCount 1 ;
            sh:qualifiedValueShape [ sh:class af-r:AFR_0000236 ;
                    sh:message "Type MUST be chromatogram." ] ;
            sh:qualifiedValueShapesDisjoint true ],
        [ sh:message "It CAN have zero or 1 peak list." ;
            sh:path af-x:AFX_0000544 ;
            sh:qualifiedMaxCount 1 ;
            sh:qualifiedValueShape [ sh:class af-r:AFR_0000432 ;
                    sh:message "Type MUST be peak list." ] ],
        af-s:AFS_0000185 .

<http://purl.allotrope.org/shapes/adm/chromatography/REC/2022/06/chromatography-data-processing.shapes> a owl:Ontology ;
    dct:description "Chromatography data processing module 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 Chromatography Data Processing Shape Library (REC/2022/06)" ;
    owl:imports <http://purl.allotrope.org/shapes/adm/core/REC/2022/06/common.shapes>,
        <http://purl.allotrope.org/shapes/adm/core/REC/2022/06/prefix.shapes>,
        <http://purl.allotrope.org/shapes/adm/core/REC/2022/06/process.shapes>,
        <http://purl.allotrope.org/shapes/qudt/REC/2022/06/unit.shapes> ;
    owl:priorVersion <http://purl.allotrope.org/shapes/adm/chromatography/REC/2021/12/chromatography-data-processing.shapes> ;
    owl:versionIRI <http://purl.allotrope.org/shapes/adm/chromatography/REC/2022/06/chromatography-data-processing.shapes> ;
    owl:versionInfo "REC/2022/06" ;
    skos:prefLabel "chromatography data processing shapes" .

