Closed mcm104 closed 4 years ago
Hi,
Unfortunately, objectmaps which generate more than one term and languagemaps do not interplay very well in the RMLMapper (as of now). I can propose two workarounds for this issue, both based on changing the iterator so the objectmap only generates one term.
If you change the iterator of ex:VariantTitleMap
to go over each P10086
node separately (/RDF/Description/P10086[@lang]
), on each iteration there is only one literal and one language tag, leading to correct behaviour.
This way four separate VariantTitle blank nodes are created:
@prefix bf: <http://id.loc.gov/ontologies/bibframe/> .
<https://trellis.sinopia.io/repository/washington/d0d9f78e-05f1-4594-bdcb-b396ce68f618>
a bf:Work;
bf:title _:0 .
_:0 a bf:VariantTitle;
bf:mainTitle "Lórax (Beber)"@pt .
<https://trellis.sinopia.io/repository/washington/d0d9f78e-05f1-4594-bdcb-b396ce68f618>
bf:title _:1 .
_:1 a bf:VariantTitle;
bf:mainTitle "Loraks"@af .
<https://trellis.sinopia.io/repository/washington/d0d9f78e-05f1-4594-bdcb-b396ce68f618>
bf:title _:2 .
_:2 a bf:VariantTitle;
bf:mainTitle "Driad"@ru .
<https://trellis.sinopia.io/repository/washington/d0d9f78e-05f1-4594-bdcb-b396ce68f618>
bf:title _:3 .
_:3 a bf:VariantTitle;
bf:mainTitle "Lórax"@es .
(The full mapping file are attached as mapping1.ttl
.)
If you need the four mainTitle
properties to have the same subject, you can achieve this by generating the same IRI for the four subjects.
This can be achieved by using the same iterator as in the previous workaround, and with the following subjectmap for ex:VariantTitleMap
:
rr:subjectMap [
rr:template "ex:VariantTitle/{../@about}";
rr:class bf:VariantTitle
];
This reference ../@about
walks up (..
) from the P10086
nodes to the shared Description
node, and generates an IRI from the latter's properties.
(The full mappings are attached as mapping2.ttl
.)
This leads to the following output:
@prefix bf: <http://id.loc.gov/ontologies/bibframe/> .
<ex:VariantTitle/https%3A%2F%2Ftrellis.sinopia.io%2Frepository%2Fwashington%2Fd0d9f78e-05f1-4594-bdcb-b396ce68f618>
a bf:VariantTitle;
bf:mainTitle "Driad"@ru, "Loraks"@af, "Lórax"@es, "Lórax (Beber)"@pt .
<https://trellis.sinopia.io/repository/washington/d0d9f78e-05f1-4594-bdcb-b396ce68f618>
a bf:Work;
bf:title <ex:VariantTitle/https%3A%2F%2Ftrellis.sinopia.io%2Frepository%2Fwashington%2Fd0d9f78e-05f1-4594-bdcb-b396ce68f618> .
This output looks more like the output you gave, but obviously the IRI <ex:VariantTitle/https...>
is meaningless. So you should either replace it again with a blank node in a post-processing step, or use a function in RML to generate a more meaningful IRI.
Thank you for your response! I'm not seeing the attachments you mentioned -- could you please post those again?
Ah yes of course, the attachments are these:
data.txt mapping1.txt mapping2.txt output1.txt output2.txt
(Github does not support sharing .ttl
files, so the extensions had to be changed to .txt
.)
Thank you! This is very helpful!
Hello!
We've noticed an issue with our output when using the property
rml:languageMap
. When we have multiple values with different language tags, the output will tag all those values with the language tag of the first value. Here is an example:Data:
Map:
Output:
As you can see, these values should be labeled as Russian, Afrikaans, Spanish, and Portuguese, but they've all been labeled as Portuguese. Is there something I can do to the XPath expression in rml:languageMap to prevent this?