vliz-be-opsci / pysubyt

python module for Linked Data production (aka semantic uplifting) through Templating
MIT License
0 stars 0 forks source link

quotes in ttl formatting #59

Closed laurianvm closed 6 months ago

laurianvm commented 7 months ago

the abstract of dataset 4412 in marineinfo contains double quotes --> this resulted in a syntax error when using ttl formatting functionality {{ ... | ttl("@en") }} (temporarily fixed with: https://gitlab.vliz.be/it/dev/imis/-/commit/b6eada89214d0e9baef79ff1a72362c6cd21f8c7)

Could it be made possible to set/select the quote type (",',""") when using ttl formatting?

marc-portier commented 6 months ago

I think this is already in there? Note that this code part actually got moved to pyrdfj2

see https://github.com/vliz-be-opsci/pyrdfj2/blob/main/pyrdfj2/j2_functions.py#L128

also | ttl() has been renamed to | xsd()
(this was driven by the fact that it is equally functional in a sparql context (which is not ttl) -- but we kept ttl working inside pysubyt)

all in all, you should thus be able to use | xsd("@en", "xsd:string", "'")

laurianvm commented 6 months ago

thank you for clarifying; will make a note that the twig implementation of this functionality is updated accordingly

marc-portier commented 6 months ago

well, in that case --> do point them to our implementation starting at https://github.com/vliz-be-opsci/pyrdfj2/blob/main/pyrdfj2/j2_functions.py#L97

motivation: the problems you see actually disclose there might also be missing support for proper detection of using the triple-quote strategy to properly format turtle string-content

the proper way is to

see also the tests we have for those edge-cases https://github.com/vliz-be-opsci/pyrdfj2/blob/main/tests/test_j2_functions.py#L137