@prefix af-e: <http://purl.allotrope.org/ontologies/equipment#> .
@prefix af-m: <http://purl.allotrope.org/ontologies/material#> .
@prefix af-p: <http://purl.allotrope.org/ontologies/process#> .
@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 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_0000432 a sh:PropertyShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/liquid-chromatography/REC/2022/06/lc-process.shapes> ;
    skos:prefLabel "LC can have injection" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:message "An LC process MUST have as an occurrent part at least 1 injection process." ;
    sh:path bfo:_0000117 ;
    sh:qualifiedMinCount 1 ;
    sh:qualifiedValueShape [ sh:class af-p:AFP_0001611 ] .

af-s:AFS_0000435 a sh:NodeShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/liquid-chromatography/REC/2022/06/lc-process.shapes> ;
    skos:prefLabel "LC process shape" ;
    sh:and ( af-s:AFS_0000001 af-s:AFS_0001766 ) ;
    sh:message "An LC process MUST have exactly 1 LC system as participant. It SHOULD have at least 1 identifier. It SHOULD have exactly 1 material input with the role of experiment sample." ;
    sh:property [ sh:message "An LC process MUST have as a participant exactly 1 LC system." ;
            sh:path ro:_0000057 ;
            sh:qualifiedMaxCount 1 ;
            sh:qualifiedMinCount 1 ;
            sh:qualifiedValueShape [ sh:or ( [ sh:class af-e:AFE_0002197 ] [ sh:class af-e:AFE_0000224 ] ) ] ;
            sh:qualifiedValueShapesDisjoint true ] .

af-s:AFS_0000459 a sh:NodeShape ;
    rdfs:isDefinedBy <http://purl.allotrope.org/shapes/adm/liquid-chromatography/REC/2022/06/lc-process.shapes> ;
    skos:prefLabel "LC submitting shape" ;
    sh:and ( af-s:AFS_0000001 ) ;
    sh:message "An LC submitting MUST have exactly 1 person as participant that MUST have a role of submitter. It MUST have exactly 1 material input and the same material as output." ;
    sh:property [ sh:class bfo:_0000040 ;
            sh:maxCount 1 ;
            sh:message "An LC submitting MUST have exactly 1 material input." ;
            sh:minCount 1 ;
            sh:path af-x:AFX_0000696 ],
        [ sh:class bfo:_0000040 ;
            sh:maxCount 1 ;
            sh:message "An LC submitting MUST have exactly 1 material output." ;
            sh:minCount 1 ;
            sh:path af-x:AFX_0000546 ],
        [ sh:message "An LC submitting MUST have as a participant exactly 1 submitter." ;
            sh:path ro:_0000057 ;
            sh:qualifiedMaxCount 1 ;
            sh:qualifiedMinCount 1 ;
            sh:qualifiedValueShape [ sh:and ( [ sh:class af-m:AFM_0001083 ;
                                sh:message "It MUST be a person with role of submitter." ;
                                sh:property [ sh:message "It MUST have role of submitter." ;
                                        sh:path ro:_0000087 ;
                                        sh:qualifiedMaxCount 1 ;
                                        sh:qualifiedMinCount 1 ;
                                        sh:qualifiedValueShape [ sh:class af-rl:AFRL_0000441 ;
                                                sh:message "It MUST be submitter role that is realized in a submitting process." ;
                                                sh:property [ sh:class af-p:AFP_0003646 ;
                                                        sh:maxCount 1 ;
                                                        sh:message "It MUST be realized in a submitting process." ;
                                                        sh:minCount 1 ;
                                                        sh:path bfo:_0000054 ] ] ;
                                        sh:qualifiedValueShapesDisjoint true ] ] [ sh:message "The person MUST have a submitter role realized in the same submitting process." ;
                                sh:sparql [ a sh:SPARQLConstraint ;
                                        sh:message "The person MUST have a submitter role realized in the same submitting process." ;
                                        sh:prefixes <http://purl.allotrope.org/shapes/adm/core/REC/2022/06/prefix.shapes> ;
                                        sh:select """\r
							SELECT $this WHERE {\r
								{\r
									$this rdf:type/rdfs:subClassOf* af-m:AFM_0001083 . # person\r
									$this ro:_0000087 ?role . # has role\r
									?role rdf:type/rdfs:subClassOf* af-rl:AFRL_0000441 . # submitter role\r
									?role bfo:_0000054 ?submitting1 . # realized in\r
									?submitting1 rdf:type/rdfs:subClassOf* af-p:AFP_0003646 . # submitting\r
									$this ^ro:_0000057 ?submitting2 . # inverse has participant\r
									?submitting2 rdf:type/rdfs:subClassOf* af-p:AFP_0003646 . # submitting\r
								}\r
								FILTER(?submitting1 != ?submitting2)\r
							}\r
						""" ] ] ) ;
                    sh:message "It MUST be a submitter in the same submitting process." ] ;
            sh:qualifiedValueShapesDisjoint true ] ;
    sh:sparql [ a sh:SPARQLConstraint ;
            sh:message "The material input and output MUST be identical." ;
            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_0000696 ?material1 . # has material input\r
					$material1 rdf:type/rdfs:subClassOf* bfo:_0000040 . # material\r
					$this af-x:AFX_0000546 ?material2 . # has material output\r
					$material2 rdf:type/rdfs:subClassOf* bfo:_0000040 . # material\r
				}\r
				FILTER(?material1 != ?material2)\r
			}\r
		""" ] ;
    sh:targetClass af-p:AFP_0003646 .

<http://purl.allotrope.org/shapes/adm/liquid-chromatography/REC/2022/06/lc-process.shapes> a owl:Ontology ;
    dct:description "module of the Allotrope LC Process 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 Process Shape Library - (REC/2022/06)" ;
    owl:imports <http://purl.allotrope.org/shapes/adm/chromatography/REC/2022/06/chromatography-process.shapes>,
        <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/prefix.shapes>,
        <http://purl.allotrope.org/shapes/adm/liquid-chromatography/REC/2022/06/lc-injection.shapes>,
        <http://purl.allotrope.org/shapes/qudt/REC/2022/06/qudt.shapes>,
        <http://purl.allotrope.org/shapes/qudt/REC/2022/06/unit.shapes> ;
    owl:priorVersion <http://purl.allotrope.org/shapes/adm/liquid-chromatography/REC/2022/03/lc-process.shapes> ;
    owl:versionIRI <http://purl.allotrope.org/shapes/adm/liquid-chromatography/REC/2022/06/lc-process.shapes> ;
    owl:versionInfo "REC/2022/06" ;
    skos:changeNote "[2020-11-17] Created ontology from LC-UV module in order to separate LC and UV. [Allotrope]" ;
    skos:prefLabel "LC process shapes" .

