Triply-Dev / YASGUI.YASQE-deprecated

Deprecated, see https://github.com/TriplyDB/Yasgui for the Yasgui monorepo
MIT License
73 stars 36 forks source link

Change tokenizer: add reserved Virtuoso function (sql:) to excluded p… #107

Closed ozq closed 7 years ago

ozq commented 7 years ago

Issue: tokenizer dosen't consider sql: reserved function. (code: if (!state.prefixes[prefNs] && ["bif", "xsd"].indexOf(prefNs) < 0) { ... })

So, in the next sparql code: SELECT ?resourceUri ?cardTemplate_sp ?cardTemplate (sql:BEST_LANGMATCH(?_cardTemplate, 'ru; en; all', '') AS ?_cardTemplate) there will be syntax error, that sql prefix is not defined.

Solution: I've added sql prefix to excluded validation prefixes array: (code: if (!state.prefixes[prefNs] && ["bif", "xsd", "sql"].indexOf(prefNs) < 0) { ... })

Info about Virtuoso/PL functions and built-in SQL functions:

A SPARQL expression can contain calls to Virtuoso/PL functions and built-in SQL functions in both the WHERE clause and in the result set. Two namespace prefixes, bif and sql are reserved for these purposes. (http://docs.openlinksw.com/virtuoso/rdfsqlfromsparql/)

LaurensRietveld commented 7 years ago

Thanks, though I dislike vendor specific exceptions,this one is pretty small. I'll add it to yasgui this week. Will close the pr though and add your snippet myself through,as I'd like to keep all the dist files out of the Pr's as they'll result in merge conflicts

LaurensRietveld commented 7 years ago

This is added now to YASQE 2.11.14