Opened 11 years ago
Closed 11 years ago
#282 closed enhancement (fixed)
Include component specification header information in schema as appinfo
Reported by: | twagoo | Owned by: | twagoo |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | ComponentSchema | Version: | |
Keywords: | Cc: | keeloo, dietuyt |
Description
The /CMD_ComponentSpec/Header element in component specifications (conforming with the general component schema) contains meta-information on the specified component, e.g.:
<Header> <ID>clarin.eu:cr1:p_1349361150622 </ID> <Name>data</Name> <Description>dc and metashare v3.0</Description> </Header>
for applications that read the resulting schema (transformed by comp2schema xslt), this information can be useful but is not accessible. It has been proposed to include it in the schema as an element in xs:annotation/xs:appinfo, for example (in context):
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:cmd="http://www.clarin.eu/cmd/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:dcr="http://www.isocat.org/ns/dcr" xmlns:ann="http://www.clarin.eu" targetNamespace="http://www.clarin.eu/cmd/" elementFormDefault="qualified"> <xs:annotation> <xs:appinfo> <ann:Header> <ann:ID>clarin.eu:cr1:p_1349361150622</ann:ID> <ann:Name>data</ann:Name> <ann:Description>dc and metashare v3.0</ann:Description> </ann:Header> </xs:appinfo> </xs:annotation>
the ann namespace will be used to indicate annotation
Attachments (3)
Change History (7)
Changed 11 years ago by
Attachment: | comp2schema.xsl added |
---|
comment:1 Changed 11 years ago by
Proposed patch:
Index: /Users/twagoo/Documents/Repositories/svn.clarin.eu/metadata/trunk/toolkit/xslt/comp2schema-v2/comp2schema.xsl =================================================================== --- /Users/twagoo/Documents/Repositories/svn.clarin.eu/metadata/trunk/toolkit/xslt/comp2schema-v2/comp2schema.xsl (revision 2550) +++ /Users/twagoo/Documents/Repositories/svn.clarin.eu/metadata/trunk/toolkit/xslt/comp2schema-v2/comp2schema.xsl (working copy) @@ -60,7 +60,14 @@ <xsl:template match="/CMD_ComponentSpec"> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:dcr="http://www.isocat.org/ns/dcr" xmlns:cmd="http://www.clarin.eu/cmd/" targetNamespace="http://www.clarin.eu/cmd/" elementFormDefault="qualified"> - + + <!-- put the header information from the component specification in the schema as appinfo --> + <xs:annotation> + <xs:appinfo xmlns:ann="http://www.clarin.eu"> + <xsl:apply-templates select="Header" mode="Header"/> + </xs:appinfo> + </xs:annotation> + <!-- import this for the use of the xml:lang attribute --> <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/> @@ -71,8 +78,8 @@ <!-- then create simple type for the ResourceProxy --> <xsl:call-template name="PrintHeaderType"/> + - <xs:element name="CMD"> <xs:complexType> @@ -103,8 +110,14 @@ </xs:schema> </xsl:template> + + <xsl:template match="*" mode="Header"> + <xsl:element name="ann:{name()}" namespace="http://www.clarin.eu"> + <xsl:value-of select="text()"/> + <xsl:apply-templates select="*" mode="Header" /> + </xsl:element> + </xsl:template> - <xsl:template name="CreateComplexTypes"> <xsl:apply-templates select="CMD_Component" mode="types"/> </xsl:template> Index: /Users/twagoo/Documents/Repositories/svn.clarin.eu/metadata/trunk/toolkit/xslt/comp2schema-v2/cleanup-xsd.xsl =================================================================== --- /Users/twagoo/Documents/Repositories/svn.clarin.eu/metadata/trunk/toolkit/xslt/comp2schema-v2/cleanup-xsd.xsl (revision 2550) +++ /Users/twagoo/Documents/Repositories/svn.clarin.eu/metadata/trunk/toolkit/xslt/comp2schema-v2/cleanup-xsd.xsl (working copy) @@ -14,6 +14,8 @@ <xsl:template match="/xs:schema" mode="clean"> <xs:schema xmlns:cmd="http://www.clarin.eu/cmd/"> <xsl:copy-of select="@*"/> + <!-- Keep the annotation with header information --> + <xsl:copy-of select="xs:annotation" /> <xsl:apply-templates select="xs:import" mode="clean"/> <!-- Remove double entries for named simpleType and complexType definitions at the begin of the XSD. --> <xsl:for-each-group select="./xs:simpleType" group-by="@name">
comment:2 Changed 11 years ago by
Cc: | keeloo dietuyt added |
---|---|
Owner: | changed from dietuyt to twagoo |
Status: | new → accepted |
Sample output:
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:dcr="http://www.isocat.org/ns/dcr" xmlns:ann="http://www.clarin.eu" xmlns:cmd="http://www.clarin.eu/cmd/" targetNamespace="http://www.clarin.eu/cmd/" elementFormDefault="qualified"> <xs:annotation> <xs:appinfo> <ann:Header> <ann:ID>clarin.eu:cr1:p_1271859438204</ann:ID> <ann:Name>imdi-profile-instance</ann:Name> <ann:Description>IMDI metadata</ann:Description> </ann:Header> </xs:appinfo> </xs:annotation> <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/> <xs:simpleType name="simpletype-Date-clarin.eu.cr1.c_1271859438201"> <xs:restriction base="xs:string"> <xs:pattern value="([0-9]+)((-[0-9]+)(-[0-9]+)?)?(/([0-9]+)((-[0-9]+)(-[0-9]+)?)?)?|Unknown|Unspecified" /> </xs:restriction> </xs:simpleType> ....
see imdi-session.xsd for the entire file
comment:3 Changed 11 years ago by
Kees-Jan, Dieter, I believe we have the blessings from the CMDI community (no comments on our proposal on the mailing list). I think the above change implements it but maybe you can have a look at it too, see if it actually fits our needs (specifically VLO) and if the XSLT is correct before we put it into production.
See cleanup-xsd.xsl and comp2schema.xsl for the new versions (not committed to svn in because this would trigger a deployment) and comment 2 for an output example.
comment:4 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
Committed in [2626] and now in production
proposed update of comp2schema