@prefix amrf: <https://w3id.org/amrf/> .
@prefix amrfsh: <https://w3id.org/amrf/shapes#> .
@prefix bibo: <http://purl.org/ontology/bibo/> .
@prefix bioschemas: <https://bioschemas.org/> .
@prefix bsc: <https://bioschemas.org/properties/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix dqv: <http://www.w3.org/ns/dqv#> .
@prefix edam: <http://edamontology.org/> .
@prefix obo: <http://purl.obolibrary.org/obo/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix p-plan: <http://purl.org/net/p-plan#> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <https://schema.org/> .
@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#> .

owl:Class rdfs:subClassOf rdfs:Class .

owl:DatatypeProperty rdfs:subClassOf rdf:Property .

amrf:shapes a owl:Ontology ;
    dcterms:bibliographicCitation "Quirós Quiroga, M. (2026). AMRF: AntiMicrobial Resistance Framework vocabulary and SHACL shapes (0.2.0). Zenodo. https://doi.org/10.5281/zenodo.24678512" ;
    dcterms:created "2026-10-16"^^xsd:date ;
    dcterms:creator <https://orcid.org/0009-0005-7434-9883> ;
    dcterms:issued "2026-11-30"^^xsd:date ;
    dcterms:license <https://creativecommons.org/licenses/by/4.0/> ;
    dcterms:publisher <https://deal.us.es> ;
    dcterms:title "AMRF shapes: validation of antimicrobial resistance model descriptions"@en ;
    bibo:doi "10.5281/zenodo.24678512" ;
    rdfs:seeAlso amrf: ;
    owl:priorVersion amrf:0.1.0 ;
    owl:versionIRI <https://w3id.org/amrf/shapes/0.2.0> ;
    owl:versionInfo "0.2.0" .

amrfsh:ActionShape a sh:NodeShape ;
    sh:property [ sh:class schema:EntryPoint ;
            sh:maxCount 1 ;
            sh:message "The action that runs a model needs exactly one schema:target, a schema:EntryPoint."@en ;
            sh:minCount 1 ;
            sh:path schema:target ] ;
    sh:targetObjectsOf schema:potentialAction .

amrfsh:ActivityShape a sh:NodeShape ;
    sh:message "A finished activity needs prov:endedAtTime and a prov:SoftwareAgent (at least Cocos)."@en ;
    sh:or ( [ sh:in ( schema:PotentialActionStatus schema:ActiveActionStatus ) ;
                sh:path schema:actionStatus ] [ sh:property [ sh:minCount 1 ;
                        sh:path prov:endedAtTime ],
                    [ sh:path prov:wasAssociatedWith ;
                        sh:qualifiedMinCount 1 ;
                        sh:qualifiedValueShape [ sh:class prov:SoftwareAgent ] ] ] ) ;
    sh:property [ sh:maxCount 1 ;
            sh:message "An activity needs exactly one schema:name, the step it ran."@en ;
            sh:minCount 1 ;
            sh:path schema:name ],
        [ sh:in ( schema:PotentialActionStatus schema:ActiveActionStatus schema:CompletedActionStatus schema:FailedActionStatus ) ;
            sh:maxCount 1 ;
            sh:message "An activity needs exactly one schema:actionStatus: potential, active, completed or failed."@en ;
            sh:minCount 1 ;
            sh:path schema:actionStatus ],
        [ sh:datatype xsd:dateTime ;
            sh:maxCount 1 ;
            sh:message "An activity starts at most once (prov:startedAtTime, an xsd:dateTime)."@en ;
            sh:path prov:startedAtTime ],
        [ sh:datatype xsd:dateTime ;
            sh:maxCount 1 ;
            sh:message "An activity ends at most once (prov:endedAtTime, an xsd:dateTime)."@en ;
            sh:path prov:endedAtTime ],
        [ sh:message "An activity needs an agent (prov:wasAssociatedWith): at least the step of the registry it ran."@en ;
            sh:minCount 1 ;
            sh:path prov:wasAssociatedWith ] ;
    sh:targetSubjectsOf schema:actionStatus .

amrfsh:DataEntryShape a sh:NodeShape ;
    sh:message "A piece of data needs a schema:encodingFormat, unless it is a Gene report (edam:data_0916)."@en ;
    sh:or ( [ sh:minCount 1 ;
                sh:path schema:encodingFormat ] [ sh:hasValue edam:data_0916 ;
                sh:path schema:additionalType ] ) ;
    sh:property [ sh:maxCount 1 ;
            sh:message "A piece of data needs exactly one schema:name, its role."@en ;
            sh:minCount 1 ;
            sh:path schema:name ],
        [ sh:maxCount 1 ;
            sh:message "A piece of data needs exactly one schema:additionalType, an EDAM data term."@en ;
            sh:minCount 1 ;
            sh:node amrfsh:EdamData ;
            sh:path schema:additionalType ],
        [ sh:maxCount 1 ;
            sh:message "A piece of data has at most one schema:encodingFormat, an EDAM format term."@en ;
            sh:node amrfsh:EdamFormat ;
            sh:path schema:encodingFormat ],
        [ sh:datatype xsd:string ;
            sh:maxCount 1 ;
            sh:message "The checksum of a file (schema:sha256) is one SHA-256: 64 lowercase hexadecimal digits."@en ;
            sh:path schema:sha256 ;
            sh:pattern "^[0-9a-f]{64}$" ] ;
    sh:targetClass schema:DataDownload .

amrfsh:EntryPointShape a sh:NodeShape ;
    sh:property [ sh:datatype xsd:string ;
            sh:maxCount 1 ;
            sh:message "An entry point needs exactly one schema:urlTemplate, where the job is sent."@en ;
            sh:minCount 1 ;
            sh:minLength 1 ;
            sh:path schema:urlTemplate ],
        [ sh:in ( "POST" ) ;
            sh:maxCount 1 ;
            sh:message "An entry point of a model is called with schema:httpMethod \"POST\"."@en ;
            sh:minCount 1 ;
            sh:path schema:httpMethod ] ;
    sh:targetClass schema:EntryPoint .

amrfsh:ModelShape a sh:NodeShape ;
    sh:property [ sh:message "A model needs a schema:softwareVersion."@en ;
            sh:minCount 1 ;
            sh:path schema:softwareVersion ],
        [ sh:message "A model needs at least one amrf:predictsResistanceTo, and each must be an ARO antibiotic."@en ;
            sh:minCount 1 ;
            sh:node amrfsh:Antibiotic ;
            sh:path amrf:predictsResistanceTo ],
        [ sh:message "A model needs at least one schema:taxonomicRange, and each must be an NCBITaxon term (NCBITaxon_2, Bacteria, for any organism)."@en ;
            sh:minCount 1 ;
            sh:node amrfsh:Taxon ;
            sh:path schema:taxonomicRange ],
        [ sh:message "A model should declare its schema:author."@en ;
            sh:minCount 1 ;
            sh:path schema:author ;
            sh:severity sh:Warning ],
        [ sh:message "A model should declare its schema:license."@en ;
            sh:minCount 1 ;
            sh:path schema:license ;
            sh:severity sh:Warning ],
        [ sh:message "A model should declare how to cite it (schema:citation)."@en ;
            sh:minCount 1 ;
            sh:path schema:citation ;
            sh:severity sh:Warning ] ;
    sh:target [ a sh:SPARQLTarget ;
            sh:select """
            SELECT ?this WHERE { ?this <https://schema.org/featureList> <http://edamontology.org/operation_3482> . }
        """ ] .

amrfsh:OwnTermShape a sh:NodeShape ;
    sh:property [ sh:message "An AMRF term needs an rdfs:label."@en ;
            sh:minCount 1 ;
            sh:path rdfs:label ],
        [ sh:message "An AMRF term needs an rdfs:comment that defines it."@en ;
            sh:minCount 1 ;
            sh:path rdfs:comment ],
        [ sh:message "An AMRF term needs a skos:editorialNote explaining why no existing term fits."@en ;
            sh:minCount 1 ;
            sh:path skos:editorialNote ],
        [ sh:hasValue amrf: ;
            sh:message "An AMRF term needs rdfs:isDefinedBy amrf:."@en ;
            sh:path rdfs:isDefinedBy ] ;
    sh:target [ a sh:SPARQLTarget ;
            sh:select """
            SELECT DISTINCT ?this WHERE {
                ?this ?p ?o .
                FILTER (isIRI(?this) && STRSTARTS(STR(?this), "https://w3id.org/amrf/")
                        && !STRSTARTS(STR(?this), "https://w3id.org/amrf/shapes")
                        && ?this != <https://w3id.org/amrf/>)
            }
        """ ] .

amrfsh:ParameterShape a sh:NodeShape ;
    sh:message "A parameter needs a schema:encodingFormat, unless it is a Gene report (edam:data_0916)."@en ;
    sh:or ( [ sh:minCount 1 ;
                sh:path schema:encodingFormat ] [ sh:hasValue edam:data_0916 ;
                sh:path schema:additionalType ] ) ;
    sh:property [ sh:hasValue <https://bioschemas.org/profiles/FormalParameter/1.0-RELEASE> ;
            sh:message "A parameter must declare dcterms:conformsTo the Bioschemas FormalParameter 1.0 profile."@en ;
            sh:path dcterms:conformsTo ],
        [ sh:maxCount 1 ;
            sh:message "A parameter needs exactly one schema:additionalType, an EDAM data term."@en ;
            sh:minCount 1 ;
            sh:node amrfsh:EdamData ;
            sh:path schema:additionalType ],
        [ sh:maxCount 1 ;
            sh:message "A parameter has at most one schema:encodingFormat, an EDAM format term."@en ;
            sh:node amrfsh:EdamFormat ;
            sh:path schema:encodingFormat ],
        [ sh:maxCount 1 ;
            sh:message "A parameter needs exactly one schema:name, its role."@en ;
            sh:minCount 1 ;
            sh:path schema:name ] ;
    sh:targetObjectsOf bsc:input,
        bsc:output .

amrfsh:PlanStepShape a sh:NodeShape ;
    sh:property [ sh:class p-plan:Plan ;
            sh:maxCount 1 ;
            sh:message "A step of a plan belongs to exactly one p-plan:Plan."@en ;
            sh:minCount 1 ;
            sh:path p-plan:isStepOfPlan ] ;
    sh:targetClass p-plan:Step .

amrfsh:PluginFileShape a sh:NodeShape ;
    sh:property [ sh:maxCount 1 ;
            sh:message "A file of a plug-in needs exactly one schema:name, its path in the folder of the plug-in."@en ;
            sh:minCount 1 ;
            sh:path schema:name ],
        [ sh:maxCount 1 ;
            sh:message "A file of a plug-in needs exactly one schema:sha256: 64 lowercase hexadecimal digits."@en ;
            sh:minCount 1 ;
            sh:path schema:sha256 ;
            sh:pattern "^[0-9a-f]{64}$" ] ;
    sh:targetClass schema:MediaObject .

amrfsh:PredictionResultShape a sh:NodeShape ;
    sh:message "A result needs a verdict (its NCIT type), a probability (schema:value) or both."@en ;
    sh:or ( [ sh:minCount 1 ;
                sh:path schema:value ] [ sh:path rdf:type ;
                sh:qualifiedMinCount 1 ;
                sh:qualifiedValueShape [ sh:in ( obo:NCIT_C85562 obo:NCIT_C85560 obo:NCIT_C85563 obo:NCIT_C206382 obo:NCIT_C191300 ) ] ] ) ;
    sh:property [ sh:maxCount 1 ;
            sh:message "A result is about exactly one ARO term (obo:IAO_0000136): an antibiotic or a class."@en ;
            sh:minCount 1 ;
            sh:path obo:IAO_0000136 ],
        [ sh:class prov:Activity ;
            sh:maxCount 1 ;
            sh:message "A result is generated by exactly one prediction (prov:wasGeneratedBy, a prov:Activity)."@en ;
            sh:minCount 1 ;
            sh:path prov:wasGeneratedBy ],
        [ sh:datatype xsd:decimal ;
            sh:maxCount 1 ;
            sh:maxInclusive 1 ;
            sh:message "The probability of resistance of a result (schema:value) is one xsd:decimal from 0 to 1."@en ;
            sh:minInclusive 0 ;
            sh:path schema:value ],
        [ sh:message "A result has at most one verdict: an NCIT resistance, intermediate, susceptibility, presumptive positive or not detected result."@en ;
            sh:path rdf:type ;
            sh:qualifiedMaxCount 1 ;
            sh:qualifiedValueShape [ sh:in ( obo:NCIT_C85562 obo:NCIT_C85560 obo:NCIT_C85563 obo:NCIT_C206382 obo:NCIT_C191300 ) ] ] ;
    sh:target [ a sh:SPARQLTarget ;
            sh:select """
            SELECT ?this WHERE {
                ?this <http://purl.obolibrary.org/obo/IAO_0000136> ?term ;
                      <http://www.w3.org/ns/prov#wasGeneratedBy> ?activity .
                FILTER STRSTARTS(STR(?term), "http://purl.obolibrary.org/obo/ARO_")
            }
        """ ] .

amrfsh:QualityMeasurementShape a sh:NodeShape ;
    sh:property [ sh:maxCount 1 ;
            sh:message "A measurement is of exactly one metric (dqv:isMeasurementOf), a term such as STATO F1 score."@en ;
            sh:minCount 1 ;
            sh:nodeKind sh:IRI ;
            sh:path dqv:isMeasurementOf ],
        [ sh:maxCount 1 ;
            sh:message "A measurement has exactly one numeric dqv:value."@en ;
            sh:minCount 1 ;
            sh:or ( [ sh:datatype xsd:decimal ] [ sh:datatype xsd:integer ] [ sh:datatype xsd:double ] ) ;
            sh:path dqv:value ],
        [ sh:maxCount 1 ;
            sh:message "A measurement says on which data it was computed (dqv:computedOn): training, validation..."@en ;
            sh:minCount 1 ;
            sh:path dqv:computedOn ],
        [ sh:message "What a measurement is about (obo:IAO_0000136) is an antibiotic (ARO) or an organism (NCBITaxon)."@en ;
            sh:nodeKind sh:IRI ;
            sh:or ( [ sh:node amrfsh:Antibiotic ] [ sh:node amrfsh:Taxon ] ) ;
            sh:path obo:IAO_0000136 ] ;
    sh:targetClass dqv:QualityMeasurement ;
    sh:targetObjectsOf dqv:hasQualityMeasurement .

amrfsh:SampleShape a sh:NodeShape ;
    sh:property [ sh:maxCount 1 ;
            sh:message "A sample needs exactly one schema:identifier."@en ;
            sh:minCount 1 ;
            sh:path schema:identifier ],
        [ sh:message "A sample needs a schema:name."@en ;
            sh:minCount 1 ;
            sh:path schema:name ],
        [ sh:message "The organism of a sample (schema:taxonomicRange) must be an NCBITaxon term; leave it out if unknown."@en ;
            sh:node amrfsh:Taxon ;
            sh:path schema:taxonomicRange ],
        [ sh:class schema:DataDownload ;
            sh:message "The parts of a sample (schema:hasPart) must be schema:DataDownload entries."@en ;
            sh:path schema:hasPart ] ;
    sh:targetClass schema:Dataset .

amrfsh:SoftwareAgentShape a sh:NodeShape ;
    sh:property [ sh:maxCount 1 ;
            sh:message "A piece of software needs exactly one schema:name."@en ;
            sh:minCount 1 ;
            sh:path schema:name ],
        [ sh:maxCount 1 ;
            sh:message "A piece of software has at most one schema:softwareVersion, and it is not empty."@en ;
            sh:minLength 1 ;
            sh:path schema:softwareVersion ],
        [ sh:message "A piece of software should declare its schema:softwareVersion (it is missing when the service that ran it did not report it)."@en ;
            sh:minCount 1 ;
            sh:path schema:softwareVersion ;
            sh:severity sh:Warning ] ;
    sh:targetClass prov:SoftwareAgent .

amrfsh:ToolShape a sh:NodeShape ;
    sh:property [ sh:maxCount 1 ;
            sh:message "A tool needs exactly one schema:identifier."@en ;
            sh:minCount 1 ;
            sh:path schema:identifier ],
        [ sh:message "A tool needs a schema:name (Bioschemas minimum)."@en ;
            sh:minCount 1 ;
            sh:path schema:name ],
        [ sh:message "A tool needs a schema:description (Bioschemas minimum)."@en ;
            sh:minCount 1 ;
            sh:minLength 1 ;
            sh:path schema:description ],
        [ sh:message "A tool needs a schema:url, the web page of the tool (Bioschemas minimum)."@en ;
            sh:minCount 1 ;
            sh:nodeKind sh:IRI ;
            sh:path schema:url ],
        [ sh:hasValue <https://bioschemas.org/profiles/ComputationalTool/1.0-RELEASE> ;
            sh:message "A tool must declare dcterms:conformsTo the Bioschemas ComputationalTool 1.0 profile."@en ;
            sh:path dcterms:conformsTo ],
        [ sh:message "A tool needs at least one schema:featureList, and each must be an EDAM operation."@en ;
            sh:minCount 1 ;
            sh:node amrfsh:EdamOperation ;
            sh:path schema:featureList ],
        [ sh:class bioschemas:FormalParameter ;
            sh:message "A tool needs at least one bsc:input, and each must be a bioschemas:FormalParameter."@en ;
            sh:minCount 1 ;
            sh:path bsc:input ],
        [ sh:class bioschemas:FormalParameter ;
            sh:message "A tool needs at least one bsc:output, and each must be a bioschemas:FormalParameter."@en ;
            sh:minCount 1 ;
            sh:path bsc:output ] ;
    sh:targetClass schema:SoftwareApplication .

amrfsh:EdamOperation a sh:NodeShape ;
    sh:property [ sh:hasValue edam:operation_0004 ;
            sh:message "Not an EDAM operation (or not in terms.ttl: run manage.py fetch_terms)."@en ;
            sh:path [ sh:zeroOrMorePath rdfs:subClassOf ] ] .

amrfsh:Antibiotic a sh:NodeShape ;
    sh:property [ sh:hasValue obo:ARO_1000003 ;
            sh:message "Not an ARO antibiotic molecule (or not in terms.ttl: run manage.py fetch_terms)."@en ;
            sh:path [ sh:zeroOrMorePath rdfs:subClassOf ] ] .

amrfsh:EdamData a sh:NodeShape ;
    sh:property [ sh:hasValue edam:data_0006 ;
            sh:message "Not an EDAM data term (or not in terms.ttl: run manage.py fetch_terms)."@en ;
            sh:path [ sh:zeroOrMorePath rdfs:subClassOf ] ] .

amrfsh:EdamFormat a sh:NodeShape ;
    sh:property [ sh:hasValue edam:format_1915 ;
            sh:message "Not an EDAM format (or not in terms.ttl: run manage.py fetch_terms)."@en ;
            sh:path [ sh:zeroOrMorePath rdfs:subClassOf ] ] .

amrfsh:Taxon a sh:NodeShape ;
    sh:property [ sh:hasValue obo:NCBITaxon_1 ;
            sh:message "Not an NCBITaxon organism (or not in terms.ttl: run manage.py fetch_terms)."@en ;
            sh:path [ sh:zeroOrMorePath rdfs:subClassOf ] ] .

