Skip to content

Validation rules (v0.2)

The profile’s machine-checkable rules are published as SHACL: fairscape-shapes.ttl (shapes version 0.2.0). Run them with:

Terminal window
pip install 'fairscape-models[shacl]'
from fairscape_models.validation.shacl import validate_shacl
report = validate_shacl("./my-crate") # crate dir, metadata file, dict or ROCrateV1_2
report.passes # True iff there are no Violations; Warnings are advisory
report.results # severity, shape, message, focusNode, path

Any SHACL engine (e.g. pyshacl -s fairscape-shapes.ttl ro-crate-metadata.json) gives the same results.

Graph rules

These rules check how entities link to each other, which the per-entity JSON Schemas cannot express. A Violation is raised only when this file alone proves the defect. When a flagged reference could legitimately point into a sibling crate of a release, the rule is a Warning. Edge rules match both the schema: and evi: expansions of each key, and skip targets that have no @type in this crate.

Reference edges point at a node of the right type

Severity: Violation — fails conformance · Applies to: the whole graph, once · Shape: fsh:ProvenanceEdgeTypingShape

EdgeTarget, when described in this crate, must be
dataSchemaevi:Schema
generated, derivedFromnot an Activity — the data entity, never the process
generatedByActivity (Computation/Experiment/Activity)
usedByComputationevi:Computation
usedByExperimentevi:Experiment
usedDataset, trainedOnevi:Dataset
usedInstrumentevi:Instrument
usedMLModelevi:MLModel
usedSampleevi:Sample
usedSoftwareevi:Software
SPARQL
SELECT $this ?subj ?value WHERE {
?subj evi:Schema ?value .
FILTER EXISTS { ?value rdf:type ?t } FILTER NOT EXISTS { ?value rdf:type evi:Schema } }
SELECT $this ?subj ?value WHERE {
?subj ( schema:generated | evi:generated | schema:derivedFrom | evi:derivedFrom ) ?value .
?value rdf:type ?at .
FILTER( STRENDS(STR(?at),"Computation") || STRENDS(STR(?at),"Experiment") || STRENDS(STR(?at),"Activity") ) }
SELECT $this ?subj ?value WHERE {
?subj ( schema:generatedBy | evi:generatedBy ) ?value .
FILTER EXISTS { ?value rdf:type ?t }
FILTER NOT EXISTS { ?value rdf:type ?at .
FILTER( STRENDS(STR(?at),"Computation") || STRENDS(STR(?at),"Experiment") || STRENDS(STR(?at),"Activity") ) } }
SELECT $this ?subj ?value WHERE {
?subj ( schema:usedByComputation | evi:usedByComputation ) ?value .
FILTER EXISTS { ?value rdf:type ?t } FILTER NOT EXISTS { ?value rdf:type evi:Computation } }
SELECT $this ?subj ?value WHERE {
?subj ( schema:usedByExperiment | evi:usedByExperiment ) ?value .
FILTER EXISTS { ?value rdf:type ?t } FILTER NOT EXISTS { ?value rdf:type evi:Experiment } }
SELECT $this ?subj ?value WHERE {
?subj ( schema:usedDataset | evi:usedDataset | schema:trainedOn | evi:trainedOn ) ?value .
FILTER EXISTS { ?value rdf:type ?t } FILTER NOT EXISTS { ?value rdf:type evi:Dataset } }
SELECT $this ?subj ?value WHERE {
?subj ( schema:usedInstrument | evi:usedInstrument ) ?value .
FILTER EXISTS { ?value rdf:type ?t } FILTER NOT EXISTS { ?value rdf:type evi:Instrument } }
SELECT $this ?subj ?value WHERE {
?subj ( schema:usedMLModel | evi:usedMLModel ) ?value .
FILTER EXISTS { ?value rdf:type ?t } FILTER NOT EXISTS { ?value rdf:type evi:MLModel } }
SELECT $this ?subj ?value WHERE {
?subj ( schema:usedSample | evi:usedSample ) ?value .
FILTER EXISTS { ?value rdf:type ?t } FILTER NOT EXISTS { ?value rdf:type evi:Sample } }
SELECT $this ?subj ?value WHERE {
?subj ( schema:usedSoftware | evi:usedSoftware ) ?value .
FILTER EXISTS { ?value rdf:type ?t } FILTER NOT EXISTS { ?value rdf:type evi:Software } }

ark: references should resolve within this crate (else warn)

Severity: Warning — reported, crate still conforms · Applies to: the whole graph, once · Shape: fsh:DanglingReferenceShape

  • N ark: reference(s) point to a node not described in this crate. Expected for a release/nested crate that links sibling crates; if this crate should be self-contained, they are broken links.
SPARQL
SELECT $this ( COUNT( DISTINCT ?value ) AS ?n ) WHERE {
?subj ?p ?value .
FILTER( isIRI(?value) && STRSTARTS(STR(?value), "ark:") )
FILTER NOT EXISTS { ?value rdf:type ?anyType }
}
GROUP BY $this
HAVING ( COUNT( DISTINCT ?value ) > 0 )

ARK identifiers are well-formed (ark:NNNNN/…)

Severity: Warning — reported, crate still conforms · Applies to: the whole graph, once · Shape: fsh:ArkIdentifierFormatShape

  • Malformed ARK identifier Y (expected ark:NNNNN/name, no spaces or commas). A trailing comma is the usual culprit.
SPARQL
SELECT $this ?value WHERE {
?value ?p ?o .
FILTER( isIRI(?value) && STRSTARTS(STR(?value), "ark:") )
FILTER( ! REGEX(STR(?value), "^ark:[0-9]{5}/[^ ,]+$") )
}

A Dataset must name an author

Severity: Violation — fails conformance · Applies to: every evi:Dataset node · Shape: fsh:DatasetAuthorShape

  • author: required — a name (xsd:string) or an @id reference

Per-class structure

One shape per entity type, generated from the fairscape_models Pydantic classes (the same source as the JSON Schemas). All are open shapes: properties not listed are allowed. Card. is the allowed number of values (0..1, 1..1, 0..*, 1..*).

ROCrateMetadataElem

Applies to every evi:ROCrate node.

PropertyPathStatusCard.ValueConstraintsDescription
descriptionschema:descriptionrequired1..1xsd:stringA human-readable description of the dataset.
nameschema:namerequired1..1xsd:stringA human-readable name for the dataset.
versionschema:versionrequired1..1xsd:stringVersion string for this release of the dataset (e.g. ‘1.0’, ‘2.3.1’).
completenessschema:completenessoptional0..1xsd:stringAssessment of how complete the dataset is relative to its intended scope (e.g. percentage of expected records present, known gaps).
conditionsOfAccessschema:conditionsOfAccessoptional0..1xsd:stringTerms and conditions governing access to and use of this dataset, including any data use agreements required.
confidentialityLevelschema:confidentialityLeveloptional0..1xsd:stringHL7 Confidentiality code indicating the level of confidentiality or sensitivity of the dataset (e.g. ‘normal’, ‘restricted’, ‘very restricted’).
contactEmailschema:contactEmailoptional0..1xsd:stringEmail address for questions or correspondence about the dataset.
contentSizeschema:contentSizeoptional0..1xsd:stringTotal size of the dataset content (e.g. ‘2.4 GB’, ‘150 MB’). Used in AI-Ready Characterization scoring.
copyrightNoticeschema:copyrightNoticeoptional0..1xsd:stringCopyright statement for the dataset, including year and rights holder.
d4d:contentWarning<d4d:contentWarning>optional0..1xsd:stringDoes the dataset contain any data that might be offensive, insulting, threatening, or otherwise anxiety-provoking if viewed directly? (D4D_Composition: ContentWarning)
d4d:informedConsent<d4d:informedConsent>optional0..1xsd:stringDetails about informed consent procedures used in human subjects research — consent type, documentation, withdrawal mechanisms, and scope. (D4D_Human: InformedConsent)
dataGovernanceCommitteeschema:dataGovernanceCommitteeoptional0..1anyName or contact for the data governance committee responsible for oversight, access control, and policy enforcement for this dataset. Accepts a plain name string, a reference stub, or an inline Person.
datePublishedschema:datePublishedoptional0..1xsd:stringDate the dataset was published or made publicly available (ISO 8601).
deidentifiedschema:deidentifiedoptional0..1anyWhether the dataset has been de-identified to remove or obscure personally identifiable information.
ethicalReviewschema:ethicalReviewoptional0..1xsd:stringWere any ethical or compliance review processes conducted (e.g. by an Institutional Review Board)? If so, describe the process, frequency of review, and outcomes. Or provide a contact for ethical review information.
evi:computationCountevi:computationCountoptional0..1anyPre-aggregated count of Computation and Experiment entities across all sub-crates. Used in AI-Ready Provenance scoring.
evi:datasetCountevi:datasetCountoptional0..1anyPre-aggregated count of Dataset entities across all sub-crates. Used in AI-Ready Provenance scoring in place of counting entities at query time.
evi:entitiesWithChecksumsevi:entitiesWithChecksumsoptional0..1anyPre-aggregated count of entities that have md5, sha256, or hash set. Used with evi:totalEntities to compute checksum coverage percentage.
evi:entitiesWithSummaryStatsevi:entitiesWithSummaryStatsoptional0..1anyPre-aggregated count of entities that have hasSummaryStatistics set. Used in AI-Ready Characterization scoring.
evi:formatsevi:formatsoptional0..*xsd:stringPre-aggregated list of unique file format values (up to 5) across all entities. Used in AI-Ready Computability scoring.
evi:processedevi:processedoptional0..1anyFlag indicating whether this release-level RO-Crate has been processed and aggregated metrics computed.
evi:schemaCountevi:schemaCountoptional0..1anyPre-aggregated count of Schema entities across all sub-crates. Used in AI-Ready Characterization scoring.
evi:softwareCountevi:softwareCountoptional0..1anyPre-aggregated count of Software entities across all sub-crates. Used in AI-Ready Provenance scoring.
evi:totalContentSizeBytesevi:totalContentSizeBytesoptional0..1anyPre-aggregated total content size in bytes across all sub-crate datasets. Used in AI-Ready Characterization scoring.
evi:totalEntitiesevi:totalEntitiesoptional0..1anyPre-aggregated total count of Dataset and Software entities. Used as denominator for checksum coverage in AI-Ready Pre-Model Explainability scoring.
fdaRegulatedschema:fdaRegulatedoptional0..1anyWhether this dataset is subject to FDA regulations (e.g. clinical trial data, medical device data).
hashschema:hashoptional0..1xsd:stringHash of the digital object content (if not MD5)
hasPartschema:hasPartoptional0..*@id referenceDataset, Software, Computation, and other entities that are part of this RO-Crate, referenced by identifier.
hasSummaryStatisticsschema:hasSummaryStatisticsoptional0..1anyReference to a summary statistics entity describing distributions, counts, and key statistics for this dataset.
humanSubjectExemptionschema:humanSubjectExemptionoptional0..1xsd:stringIf human subjects research qualifies for exemption from full IRB review, the applicable exemption category (e.g. 45 CFR 46 Exemption 4).
humanSubjectResearchschema:humanSubjectResearchoptional0..1xsd:stringDoes this dataset involve human subjects? Indicate Yes/No and describe the nature of human subjects involvement.
identifierschema:identifieroptional0..1xsd:stringDOI or other external persistent identifier for the dataset (used for Findability and Sustainability scoring).
irbschema:irboptional0..1anyInstitutional Review Board (IRB) information — approval status, approving institution, and contact details.
irbProtocolIdschema:irbProtocolIdoptional0..1xsd:stringIRB protocol identifier number assigned by the reviewing institution.
isPartOfschema:isPartOfoptional0..*@id referenceParent organization(s) or project(s) this crate belongs to, referenced by identifier.
keywordsschema:keywordsoptional0..*xsd:stringKeywords or tags describing the dataset, used for discovery and search.
licenseschema:licenseoptional0..1xsd:stringWill the dataset be distributed under a copyright or other IP license? Provide a link to or copy of the license terms (e.g. CC BY 4.0, MIT).
md5schema:md5optional0..1xsd:stringMD5 checksum of the digital object content
principalInvestigatorschema:principalInvestigatoroptional0..1anyA key individual (Principal Investigator) responsible for or overseeing dataset creation. Accepts a plain name string, a reference stub ({“@id”: ”…”}) to a Person in @graph, or an inline Person object.
prohibitedUsesschema:prohibitedUsesoptional0..1xsd:stringExplicit statement of prohibited or forbidden uses for this dataset — uses that are not permitted by license, ethics, or policy. Stronger than discouraged uses.
publisherschema:publisheroptional0..1xsd:stringOrganization or person responsible for publishing or distributing the dataset.
rai:annotationsPerItemrai:annotationsPerItemoptional0..1xsd:stringNumber of annotations collected per data item. Multiple annotations per item enable calculation of inter-annotator agreement. (rai:annotationsPerItem)
rai:dataAnnotationProtocolrai:dataAnnotationProtocoloptional0..1xsd:stringAnnotation methodology, tasks, and protocols followed during labeling. Includes annotation guidelines, quality control procedures, task definitions, workforce type, annotation characteristics, and label distributions. (rai:dataAnnotationProtocol)
rai:dataCollectionrai:dataCollectionoptional0..1xsd:stringWhat mechanisms or procedures were used to collect the data (e.g. hardware sensors, manual curation, software APIs)? Also covers how these mechanisms were validated. (rai:dataCollection)
rai:dataCollectionMissingDatarai:dataCollectionMissingDataoptional0..1xsd:stringDocumentation of missing data in the dataset, including patterns (e.g. MCAR, MAR, MNAR), known or suspected causes (e.g. sensor failures, participant dropout, privacy constraints), and strategies used to handle missing values. (rai:dataCollectionMissingData)
rai:dataCollectionRawDatarai:dataCollectionRawDataoptional0..1xsd:stringDescription of raw data sources before preprocessing, cleaning, or labeling. Documents where the original data comes from and how it can be accessed. (rai:dataCollectionRawData)
rai:dataImputationProtocolrai:dataImputationProtocoloptional0..1xsd:stringDescription of data imputation methodology, including techniques used to handle missing values (e.g. mean/median imputation, forward fill, model-based imputation) and rationale for chosen approaches. (rai:dataImputationProtocol)
rai:dataSocialImpactrai:dataSocialImpactoptional0..1xsd:stringIs there anything about the dataset’s composition or collection that might impact future uses or create risks/harm (e.g. unfair treatment, legal or financial risks)? Describe potential impacts and any mitigation strategies. (rai:dataSocialImpact)
usageInfoschema:usageInfooptional0..1xsd:stringAdditional usage information or instructions for working with this dataset.

ROCrateMetadataFileElem

Applies to every schema:CreativeWork node.

PropertyPathStatusCard.ValueConstraintsDescription
aboutschema:aboutrequired1..1@id reference
conformsToschema:conformsTorequired1..1@id reference

Dataset

Applies to every evi:Dataset node.

PropertyPathStatusCard.ValueConstraintsDescription
datePublishedschema:datePublishedrequired1..1xsd:string
descriptionschema:descriptionrequired1..1xsd:stringmin length 10
formatschema:formatrequired1..1xsd:string
nameschema:namerequired1..1xsd:string
additionalDocumentationschema:additionalDocumentationoptional0..1xsd:string
columnCountschema:columnCountoptional0..1anyNumber of columns / fields for tabular datasets.
contentSizeschema:contentSizeoptional0..1xsd:stringTotal size of the dataset content (e.g. ‘2.4 GB’, ‘150 MB’).
derivedFromschema:derivedFromoptional0..*@id reference
evi:Schemaevi:Schemaoptional0..1@id reference
hasSummaryStatisticsschema:hasSummaryStatisticsoptional0..1anyReference to a summary statistics entity describing distributions, counts, and key statistics for this dataset.
isPartOfschema:isPartOfoptional0..*@id reference
keywordsschema:keywordsoptional0..*xsd:string
rowCountschema:rowCountoptional0..1anyNumber of rows / records for tabular datasets.
sampleSizeschema:sampleSizeoptional0..1anyNumber of samples represented by the dataset (often == rowCount for tabular data, but may differ).
usedByComputationschema:usedByComputationoptional0..*@id reference
versionschema:versionoptional0..1xsd:string

Software

Applies to every evi:Software node.

PropertyPathStatusCard.ValueConstraintsDescription
descriptionschema:descriptionrequired1..1xsd:stringmin length 10
formatschema:formatrequired1..1xsd:string
nameschema:namerequired1..1xsd:string
additionalDocumentationschema:additionalDocumentationoptional0..1xsd:string
dateModifiedschema:dateModifiedoptional0..1xsd:string
isPartOfschema:isPartOfoptional0..*@id reference
usedByComputationschema:usedByComputationoptional0..*@id reference
versionschema:versionoptional0..1xsd:string

MLModel

Applies to every evi:MLModel node.

PropertyPathStatusCard.ValueConstraintsDescription
descriptionschema:descriptionrequired1..1xsd:stringmin length 10
formatschema:formatrequired1..1xsd:string
nameschema:namerequired1..1xsd:string
additionalDocumentationschema:additionalDocumentationoptional0..1xsd:string
dateModifiedschema:dateModifiedoptional0..1xsd:string
derivedFromschema:derivedFromoptional0..*@id reference
isPartOfschema:isPartOfoptional0..*@id reference
modelArchitectureschema:modelArchitectureoptional0..1xsd:string
modelTaskschema:modelTaskoptional0..1xsd:string
trainedOnschema:trainedOnoptional0..*@id reference
usedByComputationschema:usedByComputationoptional0..*@id reference
versionschema:versionoptional0..1xsd:string

Computation

Applies to every evi:Computation node.

PropertyPathStatusCard.ValueConstraintsDescription
dateCreatedschema:dateCreatedrequired1..1xsd:string
descriptionschema:descriptionrequired1..1xsd:stringmin length 10
nameschema:namerequired1..1xsd:string
runByschema:runByrequired1..1any
additionalDocumentationschema:additionalDocumentationoptional0..1xsd:string
associatedPublicationschema:associatedPublicationoptional0..1xsd:string
evi:annotatedByevi:annotatedByoptional0..*@id reference
generatedschema:generatedoptional0..*@id reference
isPartOfschema:isPartOfoptional0..*@id reference
usedDatasetschema:usedDatasetoptional0..*@id reference
usedMLModelschema:usedMLModeloptional0..*@id reference
usedSoftwareschema:usedSoftwareoptional0..*@id reference

Experiment

Applies to every evi:Experiment node.

PropertyPathStatusCard.ValueConstraintsDescription
datePerformedschema:datePerformedrequired1..1xsd:string
descriptionschema:descriptionrequired1..1xsd:stringmin length 10
experimentTypeschema:experimentTyperequired1..1xsd:string
nameschema:namerequired1..1xsd:string
runByschema:runByrequired1..1any
associatedPublicationschema:associatedPublicationoptional0..1xsd:string
generatedschema:generatedoptional0..*@id reference
isPartOfschema:isPartOfoptional0..*@id reference
protocolschema:protocoloptional0..1xsd:string
usedInstrumentschema:usedInstrumentoptional0..*@id reference
usedSampleschema:usedSampleoptional0..*@id reference
usedStainschema:usedStainoptional0..*@id reference
usedTreatmentschema:usedTreatmentoptional0..*@id reference

Schema

Applies to every evi:Schema node.

PropertyPathStatusCard.ValueConstraintsDescription
descriptionschema:descriptionrequired1..1xsd:stringmin length 5
nameschema:namerequired1..1xsd:string
propertiesschema:propertiesrequired1..1any
additionalPropertiesschema:additionalPropertiesoptional0..1any
headerschema:headeroptional0..1any
isPartOfschema:isPartOfoptional0..*@id reference
keywordsschema:keywordsoptional0..*xsd:string
licenseschema:licenseoptional0..1xsd:string
publishedschema:publishedoptional0..1any
requiredschema:requiredoptional0..*xsd:string
separatorschema:separatoroptional0..1xsd:string
typeschema:typeoptional0..1xsd:string
urlschema:urloptional0..1any

Sample

Applies to every evi:Sample node.

PropertyPathStatusCard.ValueConstraintsDescription
descriptionschema:descriptionrequired1..1xsd:stringmin length 1
nameschema:namerequired1..1xsd:string
cellLineReferenceschema:cellLineReferenceoptional0..1@id reference
isPartOfschema:isPartOfoptional0..*@id reference
keywordsschema:keywordsoptional0..*xsd:string

Instrument

Applies to every evi:Instrument node.

PropertyPathStatusCard.ValueConstraintsDescription
descriptionschema:descriptionrequired1..1xsd:stringmin length 10
manufacturerschema:manufacturerrequired1..1xsd:stringmin length 4
modelschema:modelrequired1..1xsd:string
nameschema:namerequired1..1xsd:string
additionalDocumentationschema:additionalDocumentationoptional0..1xsd:string
associatedPublicationschema:associatedPublicationoptional0..1xsd:string
contentUrlschema:contentUrloptional0..1xsd:string
isPartOfschema:isPartOfoptional0..*@id reference
usedByExperimentschema:usedByExperimentoptional0..*@id reference

Annotation

Applies to every evi:Annotation node.

PropertyPathStatusCard.ValueConstraintsDescription
createdByschema:createdByrequired1..1any
dateCreatedschema:dateCreatedrequired1..1xsd:string
descriptionschema:descriptionrequired1..1xsd:stringmin length 10
nameschema:namerequired1..1xsd:string
associatedPublicationschema:associatedPublicationoptional0..1xsd:string
generatedschema:generatedoptional0..*@id reference
isPartOfschema:isPartOfoptional0..*@id reference
usedDatasetschema:usedDatasetoptional0..*@id reference

BioChemEntity

Applies to every evi:BioChemEntity node.

PropertyPathStatusCard.ValueConstraintsDescription
nameschema:namerequired1..1xsd:string
associatedDiseaseschema:associatedDiseaseoptional0..1@id reference
descriptionschema:descriptionoptional0..1xsd:string
isPartOfschema:isPartOfoptional0..*@id reference
usedByschema:usedByoptional0..*@id reference

MedicalCondition

Applies to every schema:MedicalCondition node.

PropertyPathStatusCard.ValueConstraintsDescription
descriptionschema:descriptionrequired1..1xsd:string
nameschema:namerequired1..1xsd:string
drugschema:drugoptional0..*@id reference
isPartOfschema:isPartOfoptional0..*@id reference
usedByschema:usedByoptional0..*@id reference