RMLio / yarrrml-parser

A YARRRML parser library and CLI in Javascript
MIT License
41 stars 17 forks source link

Special character escape #112

Closed ritamargherita closed 3 years ago

ritamargherita commented 3 years ago

Issue type: :bug: Bug

Description

The forward slash "/" gets replaced with "%2F" when is found in the URI

Steps

xml as follow: `<resource xmlns="http://datacite.org/schema/kernel-4" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4.1/metadata.xsd">

10.17026/dans-z34-fjds Stichting Mondelinge Geschiedenis Indonesië (SMGI) Koninklijk Instituut voor Taal-, Land- en Volkenkunde (KITLV) Interviewcollectie Stichting Mondelinge Geschiedenis Indonesië, interview 1007 Data Archiving and Networked Services (DANS) 2011 Humanities History Social sciences dekolonisatie oral history koloniale samenleving Japanse bezetting Japanse capitulatie Bersiap interneringskampen KNIL Nederlands Indië Indonesische onafhankelijkheid Temporal coverage: 1940-1962 Fridus Steijlen (coördinator) 2011-09-22 1997-04-02 2011-08-24 nl Dataset urn:nbn:nl:ui:13-pkmq-tv easy-dataset:46951 RTF info:eu-repo/semantics/restrictedAccess DANS License De geïnterviewde kwam na de capitulatie van Japan in kampen terecht. Hierna kwam hij bij het KNIL en diende tot aan de opheffing. De bersiap tijd was verwarrend. Hij vertelt over de omstandigheden in de kampen. De zogenaamde beschermingskampen voelde als gevangenschap. De geïnterviewde wilde Nederlands-Indië behouden. De geïnterviewde vertelt over de soevereiniteitsoverdracht. Hij vertelt over de leefwijze van zijn familie en gaat in op zijn gevoelens bij het onafhankelijk worden van Indonesië. In 1954 ging hij naar Nederland. Indonesië

`

YARRRML: `prefixes: dans: https://example.org/dansOntology/ doi: http://doi.org/ dct: http://purl.org/dc/terms/ disco: http://rdf-vocabulary.ddialliance.org/discovery# opl: http://www.w3id.org/odissei/ns/terms_of_use_representation/ odrl: http://www.w3.org/ns/odrl/2/ idlab-fn: http://example.com/idlab/function/

mappings: test: sources:

  • ['dans.xml~xpath', 'resource'] s: doi:$(identifier) po:
  • [a, disco:LogicalDataSet]
  • [dct:creator, $(creators/creator/creatorName),xsd:string]
  • [dct:title, $(titles/title), xsd:string]
  • [dct:publisher, $(publisher), xsd:string]
  • [dct:subject, $(subjects/subject),xsd:string]
  • [dct:contributor, $(contributors/contributor/contributorName), xsd:string]
  • [dct:dateSubmitted, "$(dates/date[@dateType='Submitted'])", xsd:date]
  • [dct:created, "$(dates/date[@dateType='Created'])", xsd:date]
  • [dct:available, "$(dates/date[@dateType='Available'])", xsd:date]
  • [dct:language, $(language), xsd:language]
  • [dct:type, $(resourceType), xsd:string]
  • [dans:easyAltId, $(alternateIdentifiers/alternateIdentifier), xsd:string]
  • [dct:format, $(formats/format), xsd:string]
  • predicates: opl:hasAccess objects:
    • function: idlab-fn:decide parameters:
      • [idlab-fn:str, "$(rightsList/rights[1])"]
      • [idlab-fn:expectedStr, "info:eu-repo/semantics/restrictedAccess"]
      • [idlab-fn:result, opl:Restricted] type: iri
    • function: idlab-fn:decide parameters:
      • [idlab-fn:str, "$(rightsList/rights[1])"]
      • [idlab-fn:expectedStr, "info:eu-repo/semantics/openAccess"]
      • [idlab-fn:result, opl:Accessible] type: iri
  • predicates: odrl:hasPolicy objects:
  • [dct:description, $(descriptions/description), xsd:string]
  • [dct:spatial, $(geoLocations/geoLocation/geoLocationPlace), xsd:string] `

The result for the URI is: <http://doi.org/10.17026%2Fdans-z34-fjds> instead of: <http://doi.org/10.17026/dans-z34-fjds>

Environment

OS

bjdmeest commented 3 years ago

Hi Rita,

I'm afraid that's intended behavior, see template value 2.4 of the R2RML spec. If you want to join strings together without any default processing, you can use the function grel:array_join, for an example see https://github.com/RMLio/yarrrml-parser/blob/46398f0650f8e24ae728236f9e21858fc6c67cce/test/function-without-parameters/mapping.yarrrml

Does this work for you?

ritamargherita commented 3 years ago

Hi Ben, yes this works thanks!

ritamargherita commented 3 years ago

Hello there,

I am not sure if this issue has been closed already, but I just wanted to let you know that I managed to find a solution doing the following:

s: function: grel:array_join parameters:

Best, Margherita

On 31 Mar 2021, at 08:45, Ben De Meester @.**@.>> wrote:

Hi Rita,

I'm afraid that's intended behavior, see template value 2.4 of the R2RML spechttps://www.w3.org/TR/r2rml/#dfn-template-value. If you want to join strings together without any default processing, you can use the function grel:array_join, for an example see https://github.com/RMLio/yarrrml-parser/blob/46398f0650f8e24ae728236f9e21858fc6c67cce/test/function-without-parameters/mapping.yarrrml

Does this work for you?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/RMLio/yarrrml-parser/issues/112#issuecomment-810816661, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ASZY3PIM2IEFMIZ7NW5Y523TGLAILANCNFSM42CG2V6Q.