@prefix : . @prefix sh: . @prefix rdf: . @prefix rdfs: . @prefix xsd: . @prefix prov: . @prefix dct: . ################################################################# # prov:Activity – basic constraints + time ordering ################################################################# :ActivityShape a sh:NodeShape ; sh:targetClass prov:Activity ; # startedAtTime sh:property [ sh:path prov:startedAtTime ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ; ] ; # endedAtTime sh:property [ sh:path prov:endedAtTime ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ; ] ; # associated agent sh:property [ sh:path prov:wasAssociatedWith ; sh:class prov:Agent ; sh:minCount 1 ; ] ; # must use at least one entity (input, env, etc.) sh:property [ sh:path prov:used ; sh:minCount 1 ; ] ; # at least one generated entity via inverse prov:wasGeneratedBy sh:property [ sh:path [ sh:inversePath prov:wasGeneratedBy ] ; sh:minCount 1 ; ] ; # endedAtTime >= startedAtTime sh:sparql [ a sh:SPARQLConstraint ; sh:message "prov:endedAtTime must be >= prov:startedAtTime" ; sh:select """ PREFIX prov: PREFIX xsd: SELECT ?this WHERE { ?this prov:startedAtTime ?start ; prov:endedAtTime ?end . FILTER (xsd:dateTime(?end) < xsd:dateTime(?start)) } """ ; ] . ################################################################# # File entities (src/* and out/*) from _describe_file ################################################################# :FileEntityShape a sh:NodeShape ; # Files are exactly those with a dct:format from _describe_file sh:targetSubjectsOf dct:format ; sh:property [ sh:path dct:format ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; ] ; sh:property [ sh:path dct:extent ; sh:datatype xsd:integer ; sh:minCount 1 ; sh:maxCount 1 ; ] ; sh:property [ sh:path dct:modified ; sh:datatype xsd:dateTime ; sh:maxCount 1 ; ] . ################################################################# # Source file entities with sha256 identifier ################################################################# :SourceFileEntityShape a sh:NodeShape ; # Only src/* are given a dct:identifier in your code sh:targetSubjectsOf dct:identifier ; sh:property [ sh:path dct:identifier ; sh:datatype xsd:string ; sh:pattern "^sha256:" ; sh:minCount 1 ; sh:maxCount 1 ; ] . ################################################################# # Software agent ################################################################# :SoftwareAgentShape a sh:NodeShape ; sh:targetClass prov:SoftwareAgent ; sh:property [ sh:path rdfs:label ; sh:datatype xsd:string ; sh:minCount 1 ; ] ; sh:property [ sh:path dct:hasVersion ; sh:maxCount 1 ; ] ; sh:property [ sh:path dct:source ; sh:maxCount 1 ; ] . ################################################################# # Python environment entity (env/*) ################################################################# :EnvironmentShape a sh:NodeShape ; # env/* is the subject of dct:requires in your code sh:targetSubjectsOf dct:requires ; # typed as prov:Entity sh:property [ sh:path rdf:type ; sh:hasValue prov:Entity ; sh:minCount 1 ; ] ; # and prov:Collection sh:property [ sh:path rdf:type ; sh:hasValue prov:Collection ; sh:minCount 1 ; ] ; sh:property [ sh:path rdfs:label ; sh:datatype xsd:string ; sh:minCount 1 ; ] ; sh:property [ sh:path dct:title ; sh:minCount 1 ; ] ; sh:property [ sh:path dct:hasVersion ; sh:maxCount 1 ; ] ; sh:property [ sh:path dct:requires ; sh:minCount 1 ; ] . ################################################################# # PyPI dependency nodes (objects of dct:requires) ################################################################# :DependencyShape a sh:NodeShape ; sh:targetObjectsOf dct:requires ; sh:property [ sh:path rdf:type ; sh:hasValue rdf:Resource ; sh:minCount 1 ; ] ; sh:property [ sh:path rdfs:label ; sh:datatype xsd:string ; sh:minCount 1 ; ] . ################################################################# # Named data graph entity (graph/*) ################################################################# :GraphEntityShape a sh:NodeShape ; # graph/* is annotated with prov:generatedAtTime in your code sh:targetSubjectsOf prov:generatedAtTime ; sh:property [ sh:path prov:wasGeneratedBy ; sh:class prov:Activity ; sh:minCount 1 ; sh:maxCount 1 ; ] ; sh:property [ sh:path prov:wasAttributedTo ; sh:class prov:Agent ; sh:minCount 1 ; sh:maxCount 1 ; ] ; sh:property [ sh:path prov:generatedAtTime ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ; ] .