Closed idoiamurua closed 9 years ago
The same applies to $xpath.one function. If the input LIDO record contains <lido:inscriptionsWrap/>
:
...
<lido:objectIdentificationWrap>
<lido:titleWrap>
<lido:titleSet>
<lido:appellationValue lido:pref="preferred">La Primavera / Spring</lido:appellationValue>
<lido:appellationValue lido:pref="preferred" xml:lang="en">La Primavera / Spring</lido:appellationValue>
</lido:titleSet>
</lido:titleWrap>
<lido:inscriptionsWrap/>
<lido:repositoryWrap>
...
and I place in the mapping file:
## OBJECT INSCRIPTIONS BEGIN
#set($inscriptionsWrap = $xpath.one("descriptiveMetadata/objectIdentificationWrap/inscriptionsWrap",$root))
#if ($inscriptionsWrap)
#set($inscriptions = $xpath.many("descriptiveMetadata/objectIdentificationWrap/inscriptionsWrap/inscriptions/inscriptionDescription/descriptiveNoteValue",$root))
it throws the same mapping exception, but in the second set (the one with xpath.many)
If I place in the mapping file:
## OBJECT INSCRIPTIONS BEGIN
#set($inscriptionsWrap = $xpath.one("descriptiveMetadata/objectIdentificationWrap/inscriptionsWrap/inscriptions",$root))
#if ($inscriptionsWrap)
#set($inscriptions = $xpath.many("descriptiveMetadata/objectIdentificationWrap/inscriptionsWrap/inscriptions/inscriptionDescription/descriptiveNoteValue",$root))
it throws the same mapping exception, but in the first set (the one with xpath.one)
org.apache.velocity.exception.MethodInvocationException: Invocation of method 'one' in class eu.aliada.rdfizer.pipeline.format.xml.OXPath threw exception java.lang.ClassCastException: eu.aliada.rdfizer.pipeline.format.xml.ImmutableNodeList cannot be cast to org.w3c.dom.NodeList at lido.n3.vm[line 49, column 33]
@agazzarini I have just updated the LIDO mapping template to check for the following empty tags:
<lido:inscriptionsWrap/>
<lido:displayStateEditionWrap/>
<lido:objectDescriptionWrap/>
<lido:rightsWorkWrap/>
in the following way:
#set($inscriptionsWrap = $xpath.one("descriptiveMetadata/objectIdentificationWrap/inscriptionsWrap",$root))
#set($inscriptionsWrapValue = $inscriptionsWrap.textContent)
#if ($function.isNotNullAndNotEmpty($inscriptionsWrapValue))
Ok, many thanks (sorry for the absence, I'm fighting with a production issue)
On 09/25/2015 12:20 PM, Idoia wrote:
@agazzarini https://github.com/agazzarini I have just updated the LIDO mapping template to check for the following empty tags:
|lido:inscriptionsWrap/ lido:displayStateEditionWrap/ lido:objectDescriptionWrap/ lido:rightsWorkWrap/ |
in the following way:
|#set($inscriptionsWrap = $xpath.one("descriptiveMetadata/objectIdentificationWrap/inscriptionsWrap",$root))
set($inscriptionsWrapValue = $inscriptionsWrap.textContent) #if
($function.isNotNullAndNotEmpty($inscriptionsWrapValue)) |
— Reply to this email directly or view it on GitHub https://github.com/ALIADA/aliada-tool/issues/122#issuecomment-143181954.
@agazzarini I was just trying to RDFize one LIDO record that Cristina has sent to me, which contains tags of the following type:
that is, tags that are empty but that according to the LIDO mapping, the RDFizer tries to process them with sentences of the following type:
The tag is empty, so the "many" function throws an exception because it cannot convert to a NodeList. The exception thrown by the RDFizer is the following:
Any idea on how to avoid this situation?