]> Pierre Choffet | Git repositories - banq_wikidata.git/commitdiff
Improve conversion to wdef
authorPierre Choffet <peuc@wanadoo.fr>
Fri, 27 Mar 2026 14:53:44 +0000 (10:53 -0400)
committerPierre Choffet <peuc@wanadoo.fr>
Fri, 27 Mar 2026 14:53:44 +0000 (10:53 -0400)
marc_banq2wdef.xslt

index 21c6f3e29082225196137e7204e84eab656c18d0..489ee3d348ead75c3099f3d4c01d2486021e7a79 100644 (file)
                        <xsl:if test="substring($element-id, 1, 1) = '?'">
                                <!-- Add french label -->
                                <wdef:label>
-                                       <xsl:attribute name="interface-lang">fr</xsl:attribute>
+                                       <xsl:attribute name="wdef:interface-lang">fr</xsl:attribute>
                                        <xsl:call-template name="get-person-name">
                                                <xsl:with-param name="record-id" select="$record-id" />
                                        </xsl:call-template>
                                
                                <!-- Add french description -->
                                <wdef:description>
-                                       <xsl:attribute name="interface-lang">fr</xsl:attribute>
+                                       <xsl:attribute name="wdef:interface-lang">fr</xsl:attribute>
                                        <!-- TODO: Write better description -->
-                                       <xsl:text>artiste</xsl:text>
+                                       <xsl:text>artiste œuvrant dans le domaine de l’estampe</xsl:text>
                                </wdef:description>
                        
                                <!-- Add P31 (nature de l’élément) -->
                        </xsl:call-template>
                        
                        <!-- Add description -->
-                       <wdef:description interface-lang="fr">
+                       <wdef:description wdef:interface-lang="fr">
                                <xsl:text>édition d’un catalogue d’exposition</xsl:text>
                        </wdef:description>
                        
                        <xsl:for-each select="key('fix-by-id', $record-id)">
                                <xsl:for-each select="fix[@type='title']">
                                        <wdef:label>
-                                               <xsl:attribute name="interface-lang">
+                                               <xsl:attribute name="wdef:interface-lang">
                                                        <xsl:value-of select="@xml:lang" />
                                                </xsl:attribute>
                                                <xsl:choose>
                
                <!-- TODO: Complete this -->
                <wdef:description>
-                       <xsl:attribute name="interface-lang">fr</xsl:attribute>
+                       <xsl:attribute name="wdef:interface-lang">fr</xsl:attribute>
                        
                        <xsl:choose>
                                <xsl:when test="$work-type = 'print'">
                                                        <xsl:call-template name="check-person-to-publishing-date">
                                                                <xsl:with-param name="bibliographic-id" select="$record-id" />
                                                                <xsl:with-param name="creator-id" select="$creator-id" />
+                                                               <xsl:with-param name="zone-id" select="'100'" />
                                                        </xsl:call-template>
                                                </xsl:if>
                                        </xsl:variable>
+                                       <xsl:variable name="creator-element-id">
+                                               <xsl:call-template name="get-element-id">
+                                                       <xsl:with-param name="record-id" select="$creator-id" />
+                                                       <xsl:with-param name="record-type" select="'authority'" />
+                                               </xsl:call-template>
+                                       </xsl:variable>
+                                       
+                                       <xsl:if test="(@tag = '110' or @tag = '111') and substring($creator-element-id, 1, 1) = '?'">
+                                               <xsl:message terminate="no">
+                                                       <xsl:value-of name="element-id" select="$element-id" />
+                                                       <xsl:text> : pas d’équivalent connu pour la personne morale « </xsl:text>
+                                                       <xsl:value-of name="record-id" select="$creator-id" />
+                                                       <xsl:text> »</xsl:text>
+                                               </xsl:message>
+                                       </xsl:if>
                                        
                                        <wdef:value>
                                                <xsl:variable name="value-id" select="concat($property-id, '-V', generate-id(.))" />
                                                        <xsl:value-of select="$value-id" />
                                                </xsl:attribute>
                                                <wdef:ref-element>
-                                                       <xsl:call-template name="get-element-id">
-                                                               <xsl:with-param name="record-id" select="$creator-id" />
-                                                               <xsl:with-param name="record-type" select="'authority'" />
-                                                       </xsl:call-template>
+                                                       <xsl:value-of select="$creator-element-id" />
                                                </wdef:ref-element>
                                        </wdef:value>
                                </xsl:for-each>
                                                        <xsl:call-template name="check-person-to-publishing-date">
                                                                <xsl:with-param name="bibliographic-id" select="$record-id" />
                                                                <xsl:with-param name="creator-id" select="$creator-id" />
+                                                               <xsl:with-param name="zone-id" select="'100'" />
                                                        </xsl:call-template>
                                                </xsl:if>
                                        </xsl:variable>
+                                       <xsl:variable name="creator-element-id">
+                                               <xsl:call-template name="get-element-id">
+                                                       <xsl:with-param name="record-id" select="$creator-id" />
+                                                       <xsl:with-param name="record-type" select="'authority'" />
+                                               </xsl:call-template>
+                                       </xsl:variable>
+                                       
+                                       <xsl:if test="(@tag = '110' or @tag = '111') and substring($creator-element-id, 1, 1) = '?'">
+                                               <xsl:message terminate="no">
+                                                       <xsl:value-of name="element-id" select="$element-id" />
+                                                       <xsl:text> : pas d’équivalent connu pour la personne morale « </xsl:text>
+                                                       <xsl:value-of name="record-id" select="$creator-id" />
+                                                       <xsl:text> »</xsl:text>
+                                               </xsl:message>
+                                       </xsl:if>
                                        
                                        <wdef:value>
                                                <xsl:variable name="value-id" select="concat($property-id, '-V', generate-id(.))" />
                                                        <xsl:value-of select="$value-id" />
                                                </xsl:attribute>
                                                <wdef:ref-element>
-                                                       <xsl:call-template name="get-element-id">
-                                                               <xsl:with-param name="record-id" select="$creator-id" />
-                                                               <xsl:with-param name="record-type" select="'authority'" />
-                                                       </xsl:call-template>
+                                                       <xsl:value-of select="$creator-element-id" />
                                                </wdef:ref-element>
                                                
                                                <!-- Build roles list -->
                                                                        <xsl:attribute name="wdef:id">
                                                                                <xsl:value-of select="$qualifier-property-id" />
                                                                        </xsl:attribute>
+                                                                       <xsl:attribute name="wdef:pid">P2868</xsl:attribute>
                                                                        <wdef:value>
                                                                                <xsl:variable name="qualifier-value-id" select="concat($qualifier-property-id, '-V', generate-id(.))" />
                                                                                <xsl:attribute name="wdef:id">
                                                        <xsl:call-template name="check-person-to-publishing-date">
                                                                <xsl:with-param name="bibliographic-id" select="$record-id" />
                                                                <xsl:with-param name="creator-id" select="$creator-id" />
+                                                               <xsl:with-param name="zone-id" select="'100'" />
                                                        </xsl:call-template>
                                                </xsl:if>
                                        </xsl:variable>
+                                       <xsl:variable name="creator-element-id">
+                                               <xsl:call-template name="get-element-id">
+                                                       <xsl:with-param name="record-id" select="$creator-id" />
+                                                       <xsl:with-param name="record-type" select="'authority'" />
+                                               </xsl:call-template>
+                                       </xsl:variable>
+                                       
+                                       <xsl:if test="(@tag = '110' or @tag = '111') and substring($creator-element-id, 1, 1) = '?'">
+                                               <xsl:message terminate="no">
+                                                       <xsl:value-of name="element-id" select="$element-id" />
+                                                       <xsl:text> : pas d’équivalent connu pour la personne morale « </xsl:text>
+                                                       <xsl:value-of name="record-id" select="$creator-id" />
+                                                       <xsl:text> »</xsl:text>
+                                               </xsl:message>
+                                       </xsl:if>
                                        
                                        <wdef:value>
                                                <xsl:variable name="value-id" select="concat($property-id, '-V', generate-id(.))" />
                                                        <xsl:value-of select="$value-id" />
                                                </xsl:attribute>
                                                <wdef:ref-element>
-                                                       <xsl:call-template name="get-element-id">
-                                                               <xsl:with-param name="record-id" select="$creator-id" />
-                                                               <xsl:with-param name="record-type" select="'authority'" />
-                                                       </xsl:call-template>
+                                                       <xsl:value-of select="$creator-element-id" />
                                                </wdef:ref-element>
                                                
                                                <!-- Build roles list -->
                                                                        <xsl:attribute name="wdef:id">
                                                                                <xsl:value-of select="$qualifier-property-id" />
                                                                        </xsl:attribute>
+                                                                       <xsl:attribute name="wdef:pid">P2868</xsl:attribute>
                                                                        <wdef:value>
                                                                                <xsl:variable name="qualifier-value-id" select="concat($qualifier-property-id, '-V', generate-id(.))" />
                                                                                <xsl:attribute name="wdef:id">
                                                        <xsl:call-template name="check-person-to-publishing-date">
                                                                <xsl:with-param name="bibliographic-id" select="$record-id" />
                                                                <xsl:with-param name="creator-id" select="$creator-id" />
+                                                               <xsl:with-param name="zone-id" select="'700'" />
                                                        </xsl:call-template>
                                                </xsl:if>
                                        </xsl:variable>
+                                       <xsl:variable name="creator-element-id">
+                                               <xsl:call-template name="get-element-id">
+                                                       <xsl:with-param name="record-id" select="$creator-id" />
+                                                       <xsl:with-param name="record-type" select="'authority'" />
+                                               </xsl:call-template>
+                                       </xsl:variable>
+                                       
+                                       <xsl:if test="(@tag = '710' or @tag = '711') and substring($creator-element-id, 1, 1) = '?'">
+                                               <xsl:message terminate="no">
+                                                       <xsl:value-of name="element-id" select="$element-id" />
+                                                       <xsl:text> : pas d’équivalent connu pour la personne morale « </xsl:text>
+                                                       <xsl:value-of name="record-id" select="$creator-id" />
+                                                       <xsl:text> »</xsl:text>
+                                               </xsl:message>
+                                       </xsl:if>
                                        
                                        <wdef:value>
                                                <xsl:variable name="value-id" select="concat($property-id, '-V', generate-id(.))" />
                                                        <xsl:value-of select="$value-id" />
                                                </xsl:attribute>
                                                <wdef:ref-element>
-                                                       <xsl:call-template name="get-element-id">
-                                                               <xsl:with-param name="record-id" select="$creator-id" />
-                                                               <xsl:with-param name="record-type" select="'authority'" />
-                                                       </xsl:call-template>
+                                                       <xsl:value-of select="$creator-element-id" />
                                                </wdef:ref-element>
                                                
                                                <!-- Build roles list -->
                                                                        <xsl:attribute name="wdef:id">
                                                                                <xsl:value-of select="$qualifier-property-id" />
                                                                        </xsl:attribute>
+                                                                       <xsl:attribute name="wdef:pid">P2868</xsl:attribute>
                                                                        <wdef:value>
                                                                                <xsl:variable name="qualifier-value-id" select="concat($qualifier-property-id, '-V', generate-id(.))" />
                                                                                <xsl:attribute name="wdef:id">
                                <xsl:attribute name="wdef:id">
                                        <xsl:value-of select="$value-id" />
                                </xsl:attribute>
-                               <wdef:ref-element>Q39628</wdef:ref-element>
+                               <wdef:ref-element>Q138795882</wdef:ref-element>
                        </wdef:value>
                </wdef:property>
        </xsl:template>
                                                <xsl:attribute name="wdef:id">
                                                        <xsl:value-of select="$qualifier-property-id" />
                                                </xsl:attribute>
+                                               <xsl:attribute name="wdef:pid">P195</xsl:attribute>
                                                <wdef:value>
                                                        <xsl:variable name="qualifier-value-id" select="concat($qualifier-property-id, '-V', generate-id(.))" />
                                                        <xsl:attribute name="wdef:id">
                                                                <xsl:value-of select="$qualifier-value-id" />
                                                        </xsl:attribute>
-                                                       <wdef:ref-element>Q39628</wdef:ref-element>
+                                                       <wdef:ref-element>Q138795882</wdef:ref-element>
                                                </wdef:value>
                                        </wdef:property>
                                </wdef:qualifier>
                </wdef:property>
        </xsl:template>
        
-       <!-- Generate P6379 (identifiant BAnQ d’autorité) -->
+       <!-- Generate P6379 (collection comprenant une œuvre de la personne) -->
        <xsl:template name="generate-P6379">
                <xsl:param name="element-id" />
                
                                <xsl:attribute name="wdef:id">
                                        <xsl:value-of select="$value-id" />
                                </xsl:attribute>
-                               <wdef:ref-element>Q39628</wdef:ref-element>
+                               <wdef:ref-element>Q138795882</wdef:ref-element>
                        </wdef:value>
                </wdef:property>
        </xsl:template>
        
        <xsl:template name="generate-corporate-labels">
                <wdef:label>
-                       <xsl:attribute name="interface-lang">
+                       <xsl:attribute name="wdef:interface-lang">
                                <xsl:value-of select="@xml:lang" />
                        </xsl:attribute>
                        <xsl:value-of select="marc:datafield[@tag='110']/marc:subfield[@code='a']" />
        <xsl:template name="generate-corporate-description">
                <!-- TODO: Complete this -->
                <wdef:description>
-                       <xsl:attribute name="interface-lang">
+                       <xsl:attribute name="wdef:interface-lang">
                                <xsl:text>fr</xsl:text>
                        </xsl:attribute>
                        
        
        <xsl:template name="generate-meeting-labels">
                <wdef:label>
-                       <xsl:attribute name="interface-lang">
+                       <xsl:attribute name="wdef:interface-lang">
                                <xsl:value-of select="@xml:lang" />
                        </xsl:attribute>
                        <xsl:value-of select="marc:datafield[@tag='111']/marc:subfield[@code='a']" />
        <xsl:template name="generate-meeting-description">
                <!-- TODO: Complete this -->
                <wdef:description>
-                       <xsl:attribute name="interface-lang">
+                       <xsl:attribute name="wdef:interface-lang">
                                <xsl:text>fr</xsl:text>
                        </xsl:attribute>
                        
        <xsl:template name="check-person-to-publishing-date">
                <xsl:param name="bibliographic-id" />
                <xsl:param name="creator-id" />
+               <xsl:param name="zone-id" />
                
                <xsl:variable name="bibliographic" select="key('bibliographic-from-001', $bibliographic-id)" />
                <xsl:variable name="creator" select="key('person-authority-from-001', $creator-id)" />
                <xsl:choose>
                        <xsl:when test="not($bibliographic)">
                                <xsl:message terminate="no">
-                                       <xsl:value-of select="$bibliographic-id" />
                                        <xsl:text> : impossible de trouver la notice bibliographique </xsl:text>
                                        <xsl:value-of select="$bibliographic-id" />
                                </xsl:message>
                                        <xsl:when test="$birth-year != '' and (($publishing-year - $birth-year) &lt;= 15)">
                                                <xsl:message terminate="no">
                                                        <xsl:value-of select="$bibliographic-id" />
-                                                       <xsl:text> : le créateur </xsl:text>
+                                                       <xsl:text> (zone </xsl:text>
+                                                       <xsl:value-of select="$zone-id" />
+                                                       <xsl:text>) : le créateur </xsl:text>
                                                        <xsl:value-of select="$creator-id" />
                                                        <xsl:text> (</xsl:text>
                                                        <xsl:value-of select="$birth-year" />
                                        <xsl:when test="$death-date != '' and (($publishing-year - substring($death-date, 1, 4)) &gt; 2)">
                                                <xsl:message terminate="no">
                                                        <xsl:value-of select="$bibliographic-id" />
-                                                       <xsl:text> : le créateur </xsl:text>
+                                                       <xsl:text> (zone </xsl:text>
+                                                       <xsl:value-of select="$zone-id" />
+                                                       <xsl:text>) : le créateur </xsl:text>
                                                        <xsl:value-of select="$creator-id" />
                                                        <xsl:text> (</xsl:text>
                                                        <xsl:value-of select="$birth-year" />