@prefix af-c: <http://purl.allotrope.org/ontologies/common#> .
@prefix af-p: <http://purl.allotrope.org/ontologies/process#> .
@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 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_0000449 a sh:NodeShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/lc-uv/REC/2024/12/lc-uv-results-only.sequence.shapes> ;
    skos:prefLabel "LCUV results-only sequence shape" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:message "A well-formed results-only sequence SHOULD have exactly 1 identifier AND indices for runs." ;
    sh:name "LCUV results-only sequence shape" ;
    sh:or ( af-s:AFS_0000448 af-s:AFS_0000450 ) ;
    sh:targetClass af-p:AFP_0003692 .

af-s:AFS_0000448 a sh:NodeShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/lc-uv/REC/2024/12/lc-uv-results-only.sequence.shapes> ;
    skos:prefLabel "with identifier and indices" ;
    sh:and ( af-s:AFS_0000451 [ sh:message "It SHOULD have an identifier." ;
                sh:property af-s:AFS_0000022 ;
                sh:severity sh:Warning ] ),
        ( af-s:AFS_0000001 ) ;
    sh:message "A sequence MUST have indices for LCUV runs AND SHOULD have an identifier." .

af-s:AFS_0000450 a sh:NodeShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/lc-uv/REC/2024/12/lc-uv-results-only.sequence.shapes> ;
    skos:prefLabel "filter shape for sequence" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:message "Filter shape without any constraints for nodes other than sequences." ;
    sh:name "filter shape for sequence" ;
    sh:not [ sh:message "Filter shape for sequences: A sequence MUST have at least 1 part of a chromatography process." ;
            sh:property [ sh:class af-p:AFP_0001321 ;
                    sh:minCount 1 ;
                    sh:path bfo:_0000051 ] ] .

af-s:AFS_0000451 a sh:NodeShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/lc-uv/REC/2024/12/lc-uv-results-only.sequence.shapes> ;
    skos:prefLabel "with an indexed collection for LCUV runs" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:message "It MUST have an indexed collection of LCUV runs." ;
    sh:name "with an indexed collection for LCUV runs" ;
    sh:property [ sh:message "It MUST be described by an indexed collection of LCUV runs." ;
            sh:path [ sh:inversePath af-x:AFX_0002699 ] ;
            sh:qualifiedMaxCount 1 ;
            sh:qualifiedMinCount 1 ;
            sh:qualifiedValueShape [ sh:and ( af-s:AFS_0000161 [ sh:message "It MUST have indices." ;
                                sh:property [ sh:path [ sh:inversePath af-x:AFX_0000388 ] ;
                                        sh:qualifiedMinCount 1 ;
                                        sh:qualifiedValueShape af-s:AFS_0000025 ] ] [ sh:message "It MUST only have indexed items that are proxies for LCUV runs." ;
                                sh:property [ sh:minCount 1 ;
                                        sh:node [ sh:class af-c:AFC_0000161 ;
                                                sh:message "It MUST be a list item THAT is a proxy for an LCUV run." ;
                                                sh:property [ sh:maxCount 1 ;
                                                        sh:message "It MUST be a proxy for exactly 1 LCUV run." ;
                                                        sh:minCount 1 ;
                                                        sh:node [ sh:class af-p:AFP_0000748 ;
                                                                sh:message "It MUST be an LCUV run" ] ;
                                                        sh:path af-x:AFX_0002821 ],
                                                    [ sh:message "It MUST have at least 1 index." ;
                                                        sh:minCount 1 ;
                                                        sh:node af-s:AFS_0000025 ;
                                                        sh:path [ sh:inversePath af-x:AFX_0002819 ] ] ] ;
                                        sh:path ro:_0002351 ] ] [ sh:message "It MUST be an aggregation of only LCUV runs that are subprocesses of the same sequence that the aggregation describes." ;
                                sh:sparql [ a sh:SPARQLConstraint ;
                                        sh:message "It MUST be an aggregation of only LCUV runs that are subprocesses of the same sequence that the aggregation describes." ;
                                        sh:prefixes <http://purl.allotrope.org/shapes/adm/core/REC/2021/12/prefix.shacl> ;
                                        sh:select """
							SELECT $this WHERE {
								{
									$this af-x:AFX_0002699 ?sequence1 . # describes
									?sequence1 rdf:type/rdfs:subClassOf* obi:_0000011 . # planned process
									$this ro:_0002351 ?item . # has member
									?item af-x:AFX_0002821 ?hplcrun . # proxy for
									?hplcrun ^bfo:_0000117 ?sequence2 . # has occurrent part
									?sequence2 rdf:type/rdfs:subClassOf* obi:_0000011 . # planned process
								}
								FILTER(?sequence1 != ?sequence1)
							}
						""" ] ] ) ;
                    sh:message "It MUST be an aggregation with indices for LCUV runs." ] ] .

<http://purl.allotrope.org/shapes/adm/lc-uv/REC/2024/12/lc-uv-results-only.sequence.shapes> a owl:Ontology ;
    dct:description "Sequence module of the Allotrope LC-UV Results-only 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 LC-UV Results-Only Sequence Shape Library - (REC/2024/12)" ;
    owl:imports <http://purl.allotrope.org/shapes/adm/core/REC/2021/12/prefix.shacl>,
        <http://purl.allotrope.org/shapes/adm/core/REC/2022/06/common.shapes>,
        <http://purl.allotrope.org/shapes/adm/core/REC/2022/06/identifier.shapes>,
        <http://purl.allotrope.org/shapes/adm/core/REC/2022/06/indexed-datum.shapes> ;
    owl:priorVersion <http://purl.allotrope.org/shapes/adm/lc-uv/REC/2020/06/lc-uv-results-only.sequence.shapes> ;
    owl:versionIRI <http://purl.allotrope.org/shapes/adm/lc-uv/REC/2024/12/lc-uv-results-only.sequence.shapes> ;
    owl:versionInfo "REC/2024/12" ;
    skos:prefLabel "LC-UV results-only sequence shapes" .

