BASE <http://rdf-vocabulary.ddialliance.org/discoveryShapes>
PREFIX disco: <http://rdf-vocabulary.ddialliance.org/discovery#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX org: <http://www.w3.org/ns/org#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>

START=<StudyShape>
<StudyShape> CLOSED { a [disco:Study]?;
  dcterms:title LITERAL;
  dcterms:identifier LITERAL;
  dcterms:creator CLOSED {
    rdfs:label LITERAL;
    skos:notation LITERAL?;
    org:memberOf CLOSED { rdfs:label LITERAL; }?;
  }+;
  dcterms:temporal CLOSED {
    a [dcterms:PeriodOfTime]? ;
    disco:startDate xsd:date;
    disco:endDate xsd:date;
    rdfs:comment LITERAL;
  };
  dcterms:spatial CLOSED { a [dcterms:Location]?;
    rdfs:label LITERAL;
  };
  dcterms:subject CLOSED { skos:definition LITERAL }+ ;
  dcterms:abstract LITERAL;
  owl:versionInfo LITERAL; 
  disco:universe @<UniverseShape>;
  disco:instrument @<QuestionnaireShape>;
  disco:product @<DatasetShape>;
  disco:analysisUnit @<AnalysisUnitShape>;
  disco:kindOfData @<KindOfDataShape>;
  disco:variable @<VariableShape> OR @<empty>+
}

<UniverseShape> { a [disco:Universe]?;
  skos:definition LITERAL
}

<DatasetShape> CLOSED {
  a [disco:LogicalDataSet]?;
  disco:instrument @<QuestionnaireShape>;
  dcterms:accessRights @<AccessRightsShape>;
  disco:dataFile @<DataFileShape>;
  disco:variable @<VariableShape> OR @<empty>+
}

<empty> CLOSED {  }

<AccessRightsShape> CLOSED { a [dcterms:RightsStatement]?;
  dcterms:description LITERAL;
  rdfs:seeAlso IRI
}

<AnalysisUnitShape> CLOSED { a [disco:AnalysisUnit]? ;
  skos:definition LITERAL
}

<KindOfDataShape> CLOSED { a [skos:Concept] ;
  rdfs:label LITERAL
}

<QuestionnaireShape> CLOSED { a [disco:Questionnaire]?;
  disco:question @<QuestionShape>+
}

<QuestionShape> CLOSED { a [disco:Question]?;
  disco:questionText LITERAL
}

<VariableShape> CLOSED { a [disco:Variable]?;
  dcterms:identifier LITERAL;
  skos:prefLabel LITERAL+;
  dcterms:description LITERAL;
  disco:basedOn @<RepresentedVariableShape>;
  disco:question @<QuestionShape>
}

<RepresentedVariableShape> {
  disco:universe @<UniverseShape>;
  disco:representation @<skosConceptSchemeShape>;
  disco:concept @<ConceptShape>;
  skos:prefLabel LITERAL+;
  dcterms:description LITERAL
}

<skosConceptSchemeShape> CLOSED { a [skos:ConceptScheme disco:Representation]*;
  skos:hasTopConcept @<skosConceptShape>+
}

<skosConceptShape> CLOSED { a [skos:Concept]?;
  skos:notation LITERAL?;
  skos:prefLabel LITERAL+;
  skos:inScheme @<skosConceptSchemeShape>
}

<ConceptShape> CLOSED { a [skos:Concept]?;
  skos:prefLabel LITERAL+;
  skos:inScheme @<skosConceptSchemeShape>
}

# @@

<DataFileShape> {
  dcterms:identifier LITERAL;
  dcterms:description LITERAL;
  disco:caseQuantity .;
  dcterms:format LITERAL;
  dcterms:provenance LITERAL;
  owl:versionInfo LITERAL;
  dcterms:spatial {
    a [dcterms:Location];
    rdfs:label LITERAL
  };
  dcterms:temporal LITERAL;
  dcterms:subject LITERAL
}