Changeset 5310 for CMDI-Interoperability
- Timestamp:
- 05/29/14 13:10:47 (11 years ago)
- Location:
- CMDI-Interoperability/CMD2RDF/trunk/xsl
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
CMDI-Interoperability/CMD2RDF/trunk/xsl/CMD2RDF.xsl
r3792 r5310 70 70 </xsl:function> 71 71 72 <!-- make sure we use a clean ID --> 73 <xsl:function name="cmd:id"> 74 <xsl:param name="id"/> 75 <xsl:sequence select="replace($id,'.*(clarin.eu:cr[0-9]+:p_[0-9]+).*','$1')"/> 76 </xsl:function> 77 72 78 <!-- the registry URL for a profile --> 73 79 <xsl:function name="cmd:ppath"> 74 80 <xsl:param name="id"/> 75 81 <xsl:param name="ext"/> 76 <xsl:sequence select="concat($registry,'/rest/registry/profiles/', $id,'/',$ext)"/>82 <xsl:sequence select="concat($registry,'/rest/registry/profiles/',cmd:id($id),'/',$ext)"/> 77 83 </xsl:function> 78 84 … … 81 87 <xsl:param name="id"/> 82 88 <xsl:param name="ext"/> 83 <xsl:sequence select="concat($registry,'/rest/registry/components/', $id,'/',$ext)"/>89 <xsl:sequence select="concat($registry,'/rest/registry/components/',cmd:id($id),'/',$ext)"/> 84 90 </xsl:function> 85 91 -
CMDI-Interoperability/CMD2RDF/trunk/xsl/CMD2RDFcache.xsl
r5238 r5310 13 13 > 14 14 15 <xsl:include href="../../../ ../SMC/src/xsl/smc_commons.xsl"/>15 <xsl:include href="../../../SMC/src/src/xsl/smc_commons.xsl"/> 16 16 17 17 <!-- load a profile from the registry --> -
CMDI-Interoperability/CMD2RDF/trunk/xsl/CMDRecord2RDF.xsl
r5237 r5310 7 7 <!ENTITY oa 'http://www.w3.org/ns/oa#'> 8 8 ]> 9 <xsl:stylesheet 10 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" 11 xmlns:dcr="http://www.isocat.org/ns/dcr.rdf#" 12 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 13 xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" 14 xmlns:cmd="http://www.clarin.eu/cmd/" 15 xmlns:cmdm="http://www.clarin.eu/cmd/general.rdf#" 16 xmlns:ore="http://www.openarchives.org/ore/terms/" 17 xmlns:oa="http://www.w3.org/ns/oa#" 18 xmlns:dcterms="http://purl.org/dc/terms/" 19 xmlns:dc="http://purl.org/dc/elements/1.1/" 20 > 21 9 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:dcr="http://www.isocat.org/ns/dcr.rdf#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:cmd="http://www.clarin.eu/cmd/" xmlns:cmdm="http://www.clarin.eu/cmd/general.rdf#" xmlns:ore="http://www.openarchives.org/ore/terms/" xmlns:oa="http://www.w3.org/ns/oa#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 10 22 11 <xsl:output method="xml" encoding="UTF-8"/> 23 12 24 13 <!-- allow to rewrite the urls --> 25 14 <xsl:param name="base_strip" select="base-uri()"/> 26 15 <xsl:param name="base_add" select="''"/> 27 16 28 17 <xsl:variable name="about" select="replace(if ($base_strip=base-uri()) then base-uri() else replace(base-uri(), $base_strip, $base_add),'([./])(xml|cmdi)$','$1rdf')"/> 29 18 30 19 <xsl:include href="CMD2RDF.xsl"/> 31 20 32 21 <xsl:template match="text()"/> 33 22 34 23 <!-- let's create some RDF --> 35 24 <xsl:template match="/cmd:CMD"> … … 46 35 <xsl:apply-templates select="cmd:Resources" mode="other"/> 47 36 </oa:Annotation> 48 <!-- The CMDI is an ORE ResourceMap to other metadata descriptions --> 37 <!-- The CMDI is an ORE ResourceMap to other metadata descriptions --> 49 38 <xsl:if test="exists(cmd:Resources/ResourceProxyList/ResourceProxy[ResourceType='Metadata'])"> 50 39 <ore:ResourceMap rdf:about="{$about}"> … … 59 48 </rdf:RDF> 60 49 </xsl:template> 61 50 62 51 <xsl:template match="cmd:MdCreator"> 63 52 <rdf:Description rdf:about="{concat('#',generate-id(/cmd:CMD/cmd:Components/*))}"> … … 75 64 </rdf:Description> 76 65 </xsl:template> 77 66 78 67 <xsl:template match="cmd:MdSelfLink"> 79 68 <rdf:Description rdf:about="{concat('#',generate-id(/cmd:CMD/cmd:Components/*))}"> … … 83 72 </rdf:Description> 84 73 </xsl:template> 85 74 86 75 <xsl:template match="cmd:MdProfile"> 87 76 <!-- TODO? --> 88 77 </xsl:template> 89 78 90 79 <xsl:template match="cmd:MdCollectionDisplayName"> 91 80 <!-- TODO --> 92 81 </xsl:template> 93 82 94 83 <xsl:template match="text()" mode="resources"/> 95 84 <xsl:template match="cmd:ResourceProxy[cmd:ResourceType!='Resource']" mode="resources"/> … … 105 94 </oa:hasTarget> 106 95 </xsl:template> 107 96 108 97 <xsl:template match="text()" mode="metadata"/> 109 98 <xsl:template match="cmd:ResourceProxy[cmd:ResourceType!='Metadata']" mode="metadata"/> … … 129 118 --> 130 119 </xsl:template> 131 120 132 121 <!-- the CMD body --> 133 122 <xsl:template match="/cmd:CMD/cmd:Components"> 134 123 <!-- get the profile id --> 135 <!-- and ignore if there are multiple MdProfile and just take the first!! 136 although probably this more a case for the schema validation! --> 137 <xsl:variable name="id" select="(/cmd:CMD/cmd:Header/cmd:MdProfile)[1]"/> 124 <xsl:variable name="id"> 125 <xsl:choose> 126 <xsl:when test="exists(/cmd:CMD/cmd:Header/cmd:MdProfile)"> 127 <!-- and ignore if there are multiple MdProfile and just take the first!! 128 although probably this more a case for the schema validation! --> 129 <xsl:sequence select="cmd:id((/cmd:CMD/cmd:Header/cmd:MdProfile)[1])"/> 130 </xsl:when> 131 <xsl:when test="exists(/cmd:CMD/@xsi:schemaLocation)"> 132 <xsl:sequence select="cmd:id(/cmd:CMD/@xsi:schemaLocation)"/> 133 </xsl:when> 134 <xsl:otherwise> 135 <xsl:message terminate="yes"> 136 <xsl:text>ERR: the CMDI record doesn't refer to its profile!</xsl:text> 137 </xsl:message> 138 </xsl:otherwise> 139 </xsl:choose> 140 </xsl:variable> 141 <if test="not(startsWith($id,'clarin.eu:'))"> 142 <xsl:text>ERR: the CMDI record doesn't refer to a profile in the CR!</xsl:text> 143 </if> 138 144 <!-- load the profile --> 139 145 <xsl:variable name="profile" select="cmd:profile($id)"/> … … 147 153 </xsl:apply-templates> 148 154 </xsl:template> 149 155 150 156 <!-- a CMD component --> 151 157 <xsl:template match="CMD_Component"> … … 212 218 </xsl:template> 213 219 214 <!-- a CMD element --> 220 <!-- a CMD element --> 215 221 <xsl:template match="CMD_Element"> 216 222 <xsl:param name="context" tunnel="yes"/> … … 254 260 </xsl:for-each> 255 261 </xsl:template> 256 262 257 263 <!-- a CMD attribute --> 258 264 <xsl:template match="Attribute"> -
CMDI-Interoperability/CMD2RDF/trunk/xsl/CMDRecord2RDFcache.xsl
r5238 r5310 18 18 xmlns:dcterms="http://purl.org/dc/terms/" 19 19 xmlns:dc="http://purl.org/dc/elements/1.1/" 20 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 20 21 > 21 22 … … 31 32 <xsl:template match="/cmd:CMD/cmd:Components"> 32 33 <!-- get the profile id --> 33 <!-- and ignore if there are multiple MdProfile and just take the first!! 34 although probably this more a case for the schema validation! --> 35 <xsl:variable name="id" select="(/cmd:CMD/cmd:Header/cmd:MdProfile)[1]"/> 34 <!-- get the profile id --> 35 <xsl:variable name="id"> 36 <xsl:choose> 37 <xsl:when test="exists(/cmd:CMD/cmd:Header/cmd:MdProfile)"> 38 <!-- and ignore if there are multiple MdProfile and just take the first!! 39 although probably this more a case for the schema validation! --> 40 <xsl:sequence select="cmd:id((/cmd:CMD/cmd:Header/cmd:MdProfile)[1])"/> 41 </xsl:when> 42 <xsl:when test="exists(/cmd:CMD/@xsi:schemaLocation)"> 43 <xsl:sequence select="cmd:id(/cmd:CMD/@xsi:schemaLocation)"/> 44 </xsl:when> 45 <xsl:otherwise> 46 <xsl:message terminate="yes"> 47 <xsl:text>ERR: the CMDI record doesn't refer to its profile!</xsl:text> 48 </xsl:message> 49 </xsl:otherwise> 50 </xsl:choose> 51 </xsl:variable> 52 <if test="not(startsWith($id,'clarin.eu:'))"> 53 <xsl:text>ERR: the CMDI record doesn't refer to a profile in the CR!</xsl:text> 54 </if> 36 55 <!-- prefetch the profile into the cache on the fly. 37 56 the profile (if freshly fetched) will however only be available in subsequent calls
Note: See TracChangeset
for help on using the changeset viewer.