default namespace d19794244e1a1480 = "http://www.isocat.org/ns/dcif" namespace local = "" namespace inh = inherit namespace sch = "http://purl.oclc.org/dsdl/schematron" sch:ns [ uri = "http://www.isocat.org/ns/dcif" prefix = "dcif" ] sch:pattern [ name = "known language" sch:rule [ context = "dcif:language" role = "warning" sch:let [ name = "lang" value = "." ] sch:let [ name = "languages" value = """document('http://www.isocat.org/rest/info/languages.xml')""" ] sch:assert [ test = """exists(index-of(($languages//language/@tag,$languages//language/tokenize(@tags,'\s+')),$lang))""" """This language isn't known by ISOcat.""" ] ] ] sch:pattern [ name = "known profile" sch:rule [ context = "dcif:profile" sch:let [ name = "prof" value = "." ] sch:let [ name = "profiles" value = """document('http://www.isocat.org/rest/info/profiles.xml')""" ] sch:assert [ test = "$profiles//profile/@name = $prof" """This profile isn't known by ISOcat.""" ] ] ] sch:pattern [ name = "known data type" sch:rule [ context = "dcif:dataType" sch:let [ name = "type" value = "." ] sch:let [ name = "types" value = """document('http://www.isocat.org/rest/info/data-types.xml')""" ] sch:assert [ test = "$types//datatype/@name = $type" """This data type isn't known by ISOcat.""" ] ] ] sch:pattern [ name = "known rule type" sch:rule [ context = "dcif:ruleType" sch:let [ name = "type" value = "." ] sch:let [ name = "types" value = """document('http://www.isocat.org/rest/info/rule-types.xml')""" ] sch:assert [ test = "$types//rule-type/@rule_type = $type" """This rule type isn't known by ISOcat.""" ] ] ] sch:pattern [ name = "a value has to be a simple DC" sch:rule [ context = "dcif:value" sch:assert [ test = """@pid = /dcif:dataCategorySelection/dcif:dataCategory[@type='simple']/@pid""" "Only simple DCs can be values." ] ] ] start = dataCategorySelection dataCategorySelection = element dataCategorySelection { attribute dcif-version { "1.2" }, attribute name { text }?, attribute owner { text }?, ( globalInformation? & dataCategory+ ) } globalInformation = element globalInformation { ( text | any )+ } dataCategory = element dataCategory { attribute pid { xsd:anyURI }, dataCategorySummary?, dataCategoryLineage?, ( ( attribute type { "container" | "complex" | "simple" } ) | ( containerDataCategory | complexDataCategory | simpleDataCategory ) | ( administrationInformationSection & descriptionSection & ( containerDataCategory | complexDataCategory | simpleDataCategory ) ) ) } dataCategorySummary = attribute identifier { xsd:NCName }, attribute owner { xsd:string }, attribute version { xsd:string }, attribute name { xsd:string }?, attribute definition { xsd:string }? dataCategoryLineage = attribute first { xsd:anyURI }?, attribute previous { xsd:anyURI }?, attribute next { xsd:anyURI }?, attribute latest { xsd:anyURI }? administrationInformationSection = element administrationInformationSection { administrationRecord } administrationRecord = element administrationRecord { element identifier { xsd:NCName } & element version { xsd:string } & element registrationStatus { "private" | "candidate" | "standard" | "deprecated" | "superseded" } & element origin { xsd:string }? & element justification { xsd:string }? & element explanatoryComment { xsd:string, attribute xml:lang { xsd:language }? }* & element unresolvedIssue { xsd:string, attribute xml:lang { xsd:language }? }* & element effectiveDate { xsd:date }? & element untilDate { xsd:date }? & element creation { element creationDate { xsd:date } & element changeDescription { xsd:string, attribute xml:lang { xsd:language }? } } & element lastChange { element lastChangeDate { xsd:date } & element changeDescription { xsd:string, attribute xml:lang { xsd:language }? } }? } descriptionSection = element descriptionSection { element profile { xsd:string }+ & languageSection+ & dataElementNameSection* >> sch:pattern [ name = "mandatory english language section with a name section and a definition" sch:rule [ context = "dcif:descriptionSection" sch:assert [ test = """dcif:languageSection[dcif:language=('en','eng')][exists(dcif:definitionSection)][exists(dcif:nameSection)]""" "All DCs should have an english language section with a definition and a name." ] ] ] } languageSection = element languageSection { element language { xsd:language } & element definitionSection { element definition { xsd:string, attribute xml:lang { xsd:language }? } & element source { xsd:string } & element note { xsd:string, attribute xml:lang { xsd:language }? }? }* & exampleSection* & explanationSection* & element note { xsd:string, attribute xml:lang { xsd:language }? }* & nameSection* >> sch:pattern [ name = "one language section per language" sch:rule [ context = "dcif:languageSection" sch:assert [ test = "not(dcif:language = (preceding-sibling::dcif:languageSection,following-sibling::dcif:languageSection)/dcif:language)" "Only one language section per language per DC." ] ] ] } exampleSection = element exampleSection { element example { xsd:string, attribute xml:lang { xsd:language }? } & element source { xsd:string }? } explanationSection = element explanationSection { element explanation { xsd:string, attribute xml:lang { xsd:language }? } & element source { xsd:string }? } nameSection = element nameSection { element name { attribute xml:lang { xsd:language }?, xsd:string } & element nameStatus { "standardized name" | "preferred name" | "admitted name" | "deprecated name" | "superseded name" } } dataElementNameSection = element dataElementNameSection { element dataElementName { xsd:string } & element source { xsd:string } } containerDataCategory = attribute type { "container" } complexDataCategory = attribute type { "complex" }, ( openDataCategory | closedDataCategory | constrainedDataCategory ) >> sch:pattern [ name = "all conceptual domains should have the same data type" sch:rule [ context = """dcif:dataCategory[@type='complex']""" sch:assert [ test = "not(dcif:conceptualDomain/dcif:dataType != .//dcif:conceptualDomain/dcif:dataType)" "All conceptual domains of a complex DC should have the same data type." ] ] ] openDataCategory = openConceptualDomain & constrainedLinguisticSection* openConceptualDomain = element conceptualDomain { attribute type { "open" }, element dataType { xsd:string } } closedDataCategory = profileValueDomain+ & closedLinguisticSection* >> sch:pattern [ name = "for each profile there should be a profile value domain" sch:rule [ context = """dcif:dataCategory[@type='complex'][dcif:conceptualDomain[@type='closed']]""" sch:assert [ test = "dcif:descriptionSection/dcif:profile = dcif:conceptualDomain/dcif:profile" "For each profile a closed DC is a member there should be a profile specific conceptual domain." ] ] ] profileValueDomain = element conceptualDomain { attribute type { "closed" }, ( element dataType { xsd:string } & element profile { xsd:string } & element value { attribute pid { xsd:anyURI }, dataCategorySummary? }+ ) >> sch:pattern [ name = "one profile value domain per profile" sch:rule [ context = """dcif:dataCategory/dcif:conceptualDomain[@type='closed']""" sch:assert [ test = "not(dcif:profile = (preceding-sibling::dcif:conceptualDomain,following-sibling::dcif:conceptualDomain)/dcif:profile)" "Only one profile specific conceptual domain per profile per DC." ] ] ] >> sch:pattern [ name = "a profile value domain can only exists for a profile the DC is a member of" sch:rule [ context = """dcif:dataCategory/dcif:conceptualDomain[@type='closed']""" sch:assert [ test = "dcif:profile = ancestor::dcif:dataCategory/dcif:descriptionSection/dcif:profile" "A profile specific conceptual domain can only exist for a profile the closed DC is a member of." ] ] ] >> sch:pattern [ name = "all simple DCs in a profile value domain should be member of that profile" sch:rule [ context = """dcif:dataCategory/dcif:conceptualDomain[@type='closed'][dcif:profile='Private']/dcif:value""" role = "warning" sch:let [ name = "prof" value = "parent::dcif:conceptualDomain/dcif:profile" ] sch:let [ name = "pid" value = "@pid" ] sch:assert [ test = "/dcif:dataCategorySelection/dcif:dataCategory[@pid=$pid]/dcif:descriptionSection/dcif:profile=$prof" "A simple DC used as a value in a profile specific conceptual domain should be a member of that profile." ] ] sch:rule [ context = """dcif:dataCategory/dcif:conceptualDomain[@type='closed'][dcif:profile!='Private']/dcif:value""" sch:let [ name = "prof" value = "parent::dcif:conceptualDomain/dcif:profile" ] sch:let [ name = "pid" value = "@pid" ] sch:assert [ test = "/dcif:dataCategorySelection/dcif:dataCategory[@pid=$pid]/dcif:descriptionSection/dcif:profile=$prof" "A simple DC used as a value in a profile specific conceptual domain should be a member of that profile." ] ] ] } closedLinguisticSection = element linguisticSection { attribute type { "closed" }, ( linguisticSection & valueDomain? ) } linguisticSection = element language { xsd:language } & exampleSection* & explanationSection* & element note { xsd:string, attribute xml:lang { xsd:language }? >> sch:pattern [ name = "one linguistic section per language" sch:rule [ context = "dcif:linguisticSection" sch:assert [ test = "not(dcif:language = (preceding-sibling::dcif:linguisticSection,following-sibling::dcif:linguisticSection)/dcif:language)" "Only one language section per language per DC." ] ] ] }* valueDomain = element conceptualDomain { attribute type { "closed" }, ( element dataType { xsd:string } & element value { attribute pid { xsd:anyURI }, dataCategorySummary? }+ ) >> sch:pattern [ name = """a value domain of a linguistic section can't extend the closed DCs value domain""" sch:rule [ context = """dcif:dataCategory/dcif:linguisticSection[@type='closed']/dcif:conceptualDomain/dcif:value""" sch:assert [ test = "@pid = ancestor::dcif:dataCategory/dcif:conceptualDomain/dcif:value/@pid" "A value in a linguistic section related conceptual domain should already be an allowed value in one of the closed DCs conceptual domains." ] ] ] } constrainedDataCategory = conceptualDomainRule+ & constrainedLinguisticSection* conceptualDomainRule = element conceptualDomain { attribute type { "constrained" }, ( element dataType { xsd:string } & element ruleType { xsd:string } & element rule { ( text | any )+ }+ ) >> sch:pattern [ name = "one conceptual domain per rule type" sch:rule [ context = """dcif:conceptualDomain[@type='constrained']""" sch:assert [ test = "not(dcif:ruleType = (preceding-sibling::dcif:conceptualDomain,following-sibling::dcif:conceptualDomain)/dcif:ruleType)" "Only one conceptual domain per rule type." ] ] ] } constrainedLinguisticSection = element linguisticSection { attribute type { "constrained" }, ( linguisticSection & conceptualDomainRule* ) } simpleDataCategory = attribute type { "simple" }, element isA { attribute pid { xsd:anyURI }, dataCategorySummary? >> sch:pattern [ name = "the parent DC of a simple DC has to be a simple DC" sch:rule [ context = "dcif:isA" sch:assert [ test = """@pid = /dcif:dataCategorySelection/dcif:dataCategory[@type='simple']/@pid""" "Only simple DCs can be parent DCs." ] ] ] >> sch:pattern [ name = """the parent DC of a simple DC can't be the same DC""" sch:rule [ context = "dcif:isA" sch:assert [ test = "@pid != ancestor::dcif:dataCategory/@pid" """A simple DCs can't be its own parent.""" ] ] ] }? any = element * - d19794244e1a1480:* { attribute * - d19794244e1a1480:* { text }*, ( text | any )* }