- Timestamp:
- 11/30/15 14:28:22 (8 years ago)
- Location:
- metadata/trunk/toolkit/src
- Files:
-
- 5 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
metadata/trunk/toolkit/src/main/resources/toolkit/xsd/cmd-component.xsd
r6255 r6854 35 35 <xs:complexType> 36 36 <xs:sequence> 37 <xs:element name="ID" type="xs:anyURI" minOccurs="0" />38 <xs:element name="Name" type="xs:string" minOccurs=" 0"/>39 <xs:element name="Description" type="xs:string" minOccurs="0" />37 <xs:element name="ID" type="xs:anyURI" minOccurs="0" maxOccurs="1"/> 38 <xs:element name="Name" type="xs:string" minOccurs="1" maxOccurs="1"/> 39 <xs:element name="Description" type="xs:string" minOccurs="0" maxOccurs="1"/> 40 40 <!-- status information --> 41 41 <xs:element name="Status" minOccurs="1" maxOccurs="1"> … … 55 55 <xs:element name="Component" type="Component_type"> 56 56 <xs:annotation> 57 <xs:documentation>At the root level there should always be a 58 Component.</xs:documentation> 57 <xs:documentation>At the root level there should always be a Component.</xs:documentation> 59 58 </xs:annotation> 60 59 </xs:element> … … 93 92 <!-- from small (attribute) to big (component) --> 94 93 <xs:element name="AttributeList" type="AttributeList_type" minOccurs="0" maxOccurs="1"/> 95 <xs:element name="Element" type="Element_type" minOccurs="0" 96 maxOccurs="unbounded"> </xs:element> 97 <xs:element name="Component" type="Component_type" minOccurs="0" 98 maxOccurs="unbounded"/> 94 <xs:element name="Element" type="Element_type" minOccurs="0" maxOccurs="unbounded"/> 95 <xs:element name="Component" type="Component_type" minOccurs="0" maxOccurs="unbounded"/> 99 96 </xs:sequence> 100 97 </xs:group> … … 164 161 </xs:annotation> 165 162 <xs:choice> 166 <xs:element name="pattern" type="xs:string" m axOccurs="1">163 <xs:element name="pattern" type="xs:string" minOccurs="1" maxOccurs="1"> 167 164 <xs:annotation> 168 165 <xs:documentation>Specification of a regular expression the element should … … 170 167 </xs:annotation> 171 168 </xs:element> 172 <xs:element name="Vocabulary" type="Vocabulary_type" >169 <xs:element name="Vocabulary" type="Vocabulary_type" minOccurs="1" maxOccurs="1"> 173 170 <xs:annotation> 174 171 <xs:documentation>Specification of an open or closed vocabulary</xs:documentation> … … 186 183 </xs:element> 187 184 </xs:sequence> 188 <xs:attribute name="URI" type="xs:anyURI" />185 <xs:attribute name="URI" type="xs:anyURI" use="optional"/> 189 186 <!-- optionally selects a label --> 190 <xs:attribute name="ValueProperty" type="xs:string" />187 <xs:attribute name="ValueProperty" type="xs:string" use="optional"/> 191 188 <!-- optionally selects a language --> 192 <xs:attribute name="ValueLanguage" type="xs:language" />189 <xs:attribute name="ValueLanguage" type="xs:language" use="optional"/> 193 190 </xs:complexType> 194 191 … … 231 228 <xs:sequence> 232 229 <xs:element name="Documentation" type="Documentation_type" minOccurs="0" maxOccurs="unbounded"/> 233 <xs:element name="ValueScheme" type="ValueScheme_type" minOccurs="0" >230 <xs:element name="ValueScheme" type="ValueScheme_type" minOccurs="0" maxOccurs="1"> 234 231 <xs:annotation> 235 232 <xs:documentation>For the use of a regular expression or a … … 257 254 </xs:annotation> 258 255 </xs:attribute> 259 <xs:attribute name="ConceptLink" type="xs:anyURI" >256 <xs:attribute name="ConceptLink" type="xs:anyURI" use="optional"> 260 257 <xs:annotation> 261 258 <xs:documentation>A link to the ISOcat data category registry (or any other concept … … 263 260 </xs:annotation> 264 261 </xs:attribute> 265 <xs:attribute name="ValueScheme" type="allowed_attributetypes_type" >262 <xs:attribute name="ValueScheme" type="allowed_attributetypes_type" use="optional"> 266 263 <xs:annotation> 267 264 <xs:documentation>For the use of simple XML types as the type of … … 269 266 </xs:annotation> 270 267 </xs:attribute> 271 <xs:attribute name="Required" type="xs:boolean" >268 <xs:attribute name="Required" type="xs:boolean" use="optional"> 272 269 <xs:annotation> 273 270 <xs:documentation>Is the attribute required or not?</xs:documentation> … … 283 280 </xs:annotation> 284 281 </xs:attribute> 285 <xs:attribute name="ConceptLink" type="xs:anyURI" >282 <xs:attribute name="ConceptLink" type="xs:anyURI" use="optional"> 286 283 <xs:annotation> 287 284 <xs:documentation>A link to the ISOcat data category registry (or any other concept … … 289 286 </xs:annotation> 290 287 </xs:attribute> 291 <xs:attribute name="ValueScheme" type="allowed_attributetypes_type" >288 <xs:attribute name="ValueScheme" type="allowed_attributetypes_type" use="optional"> 292 289 <xs:annotation> 293 290 <xs:documentation>Used to specify that an element has a simple XML type (string, … … 295 292 </xs:annotation> 296 293 </xs:attribute> 297 <xs:attribute name="CardinalityMin" type="cardinality_type" >294 <xs:attribute name="CardinalityMin" type="cardinality_type" use="optional" default="1"> 298 295 <xs:annotation> 299 296 <xs:documentation>Minimal number of occurrences.</xs:documentation> 300 297 </xs:annotation> 301 298 </xs:attribute> 302 <xs:attribute name="CardinalityMax" type="cardinality_type" >299 <xs:attribute name="CardinalityMax" type="cardinality_type" use="optional" default="1"> 303 300 <xs:annotation> 304 301 <xs:documentation>Maximal number of occurrences.</xs:documentation> 305 302 </xs:annotation> 306 303 </xs:attribute> 307 <xs:attribute name="Multilingual" type="xs:boolean" >304 <xs:attribute name="Multilingual" type="xs:boolean" use="optional"> 308 305 <xs:annotation> 309 306 <xs:documentation>Indicates that this element can have values in multiple languages … … 317 314 318 315 <xs:attributeGroup name="component_attributes"> 319 <xs:attribute name="name" type="xs:Name"/> 320 <xs:attribute name="ComponentId" type="xs:anyURI"> 316 <xs:annotation> 317 <xs:appinfo> 318 <sch:pattern id="c_atts"> 319 <sch:title>Check component attributes</sch:title> 320 <sch:rule context="Component"> 321 <sch:assert test="normalize-space(@name)!='' or normalize-space(@ComponentId)!=''">A Component should have a name or a ComponentId!</sch:assert> 322 </sch:rule> 323 </sch:pattern> 324 </xs:appinfo> 325 </xs:annotation> 326 <xs:attribute name="name" type="xs:Name" use="optional"/> 327 <xs:attribute name="ComponentId" type="xs:anyURI" use="optional"> 321 328 <xs:annotation> 322 329 <xs:documentation>Indicates that a component (using its unique ComponentId issued by … … 324 331 </xs:annotation> 325 332 </xs:attribute> 326 <xs:attribute name="ConceptLink" type="xs:anyURI" >333 <xs:attribute name="ConceptLink" type="xs:anyURI" use="optional"> 327 334 <xs:annotation> 328 335 <xs:documentation>A link to the ISOcat data category registry (or any other concept … … 330 337 </xs:annotation> 331 338 </xs:attribute> 332 <xs:attribute name="CardinalityMin" type="cardinality_type" />333 <xs:attribute name="CardinalityMax" type="cardinality_type" />334 <xs:attribute ref="xml:base" />339 <xs:attribute name="CardinalityMin" type="cardinality_type" use="optional" default="1"/> 340 <xs:attribute name="CardinalityMax" type="cardinality_type" use="optional" default="1"/> 341 <xs:attribute ref="xml:base" use="optional"/> 335 342 <xs:anyAttribute namespace="http://www.clarin.eu/cmdi/cues/display/1.0" processContents="lax"/> 336 343 </xs:attributeGroup> … … 424 431 <xs:documentation>controlled vocabularies</xs:documentation> 425 432 </xs:annotation> 426 <xs:choice minOccurs="0" maxOccurs="unbounded"> 427 <xs:element name="item" type="item_type"> 428 <xs:annotation> 429 <xs:documentation>An item from a controlled vocabulary.</xs:documentation> 430 </xs:annotation> 431 </xs:element> 432 <xs:element name="appinfo" type="xs:string"> 433 <xs:sequence> 434 <xs:element name="appinfo" type="xs:string" minOccurs="0" maxOccurs="1"> 433 435 <xs:annotation> 434 436 <xs:documentation>End-user guidance about the value of the controlled vocabulary … … 436 438 </xs:annotation> 437 439 </xs:element> 438 </xs:choice> 440 <xs:element name="item" type="item_type" minOccurs="0" maxOccurs="unbounded"> 441 <xs:annotation> 442 <xs:documentation>An item from a controlled vocabulary.</xs:documentation> 443 </xs:annotation> 444 </xs:element> 445 </xs:sequence> 439 446 </xs:complexType> 440 447 … … 452 459 <xs:simpleContent> 453 460 <xs:extension base="xs:string"> 454 <xs:attribute type="xs:anyURI" name="ConceptLink" >461 <xs:attribute type="xs:anyURI" name="ConceptLink" use="optional"> 455 462 <xs:annotation> 456 463 <xs:documentation>A link to the ISOcat data category registry (or any other … … 459 466 </xs:annotation> 460 467 </xs:attribute> 461 <xs:attribute type="xs:string" name="AppInfo" >468 <xs:attribute type="xs:string" name="AppInfo" use="optional"> 462 469 <xs:annotation> 463 470 <xs:documentation>End-user guidance about the value of this controlled -
metadata/trunk/toolkit/src/main/resources/toolkit/xslt/comp2schema.xsl
r6833 r6854 135 135 <xsl:template match="Element/ValueScheme[exists(Vocabulary/enumeration)]" mode="types"> 136 136 137 <xsl:message>DBG: create complex types</xsl:message>138 139 137 <!-- only handle the ValueScheme if this is the first occurence of the Component --> 140 138 <xsl:variable name="Component" select="ancestor::Component[exists(@ComponentId)]"/> 141 139 <xsl:if test="empty($Component/preceding::Component[@ComponentId=$Component/@ComponentId])"> 142 <xsl:message>DBG: first occurence</xsl:message>143 140 144 141 <!-- create a unique suffix (the path to the element) to ensure the unicity of the types to be created --> -
metadata/trunk/toolkit/src/test/java/eu/clarin/cmd/toolkit/TestCMDToolkit.java
r6262 r6854 197 197 198 198 @Test 199 public void testAdelheid2() throws Exception { 200 String profile = "/toolkit/Adelheid/profiles/clarin.eu:cr1:p_1311927752306_1_2.xml"; 201 String record = "/toolkit/Adelheid/records/Adelheid_1_2-invalid.cmdi"; 202 203 // validate the 1.2 profile 204 boolean validProfile = validateCMDSpec(profile,new javax.xml.transform.stream.StreamSource(new java.io.File(TestCMDToolkit.class.getResource(profile).toURI()))); 205 206 // assertions 207 // the upgraded profile should be a valid CMDI 1.2 profile 208 assertTrue(validProfile); 209 // so there should be no errors 210 assertEquals(0, countErrors(validateCMDSpec)); 211 212 Document profileSchema = transformCMDSpecInXSD(profile,new javax.xml.transform.stream.StreamSource(new java.io.File(TestCMDToolkit.class.getResource(profile).toURI()))); 213 SchemAnon profileAnon = new SchemAnon(new DOMSource(profileSchema)); 214 215 // validate the 1.2 record 216 boolean validRecord = validateCMDRecord(profile,profileAnon,record,new javax.xml.transform.stream.StreamSource(new java.io.File(TestCMDToolkit.class.getResource(record).toURI()))); 217 218 // assertions 219 // the record should be a invalid as it misses a the required CoreVersion attribute 220 assertFalse(validRecord); 221 } 222 223 @Test 199 224 public void testTEI() throws Exception { 200 225 String record = "/toolkit/TEI/records/sundhed_dsn.teiHeader.ref.xml"; … … 248 273 assertFalse(validRecord); 249 274 } 275 276 @Test 277 public void testCMD() throws Exception { 278 String profile = "/toolkit/CMD/profiles/components.xml"; 279 280 // validate the 1.2 profile 281 boolean validProfile = validateCMDSpec(profile,new javax.xml.transform.stream.StreamSource(new java.io.File(TestCMDToolkit.class.getResource(profile).toURI()))); 282 283 // assertions 284 assertFalse(validProfile); 285 } 250 286 }
Note: See TracChangeset
for help on using the changeset viewer.