[ 
https://issues.apache.org/jira/browse/JENA-1072?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15559611#comment-15559611
 ] 

Bruno P. Kinoshita commented on JENA-1072:
------------------------------------------

YASGUI.YASQE is a really interesting project! It extends CodeMirror (literally, 
it includes CodeMirror and 'extends' JavaScript objects). Then it provides the 
logic for parsing SPARQL.

Debugging the JavaScript code, it is possible to see that it correctly parses 
the ASK token. The ASK token then contains a list of possible next tokens, that 
include IRI. This is the JavaScript regex used to match a IRI.

{code}
var IRI_REF = '<[^<>\"\'\|\{\}\^\\\x00-\x20]*>';
{code}

From: 
https://github.com/OpenTriply/YASGUI.YASQE/blob/994c5a42866ab41dac03c832b49f872c83361a27/lib/grammar/tokenizer.js#L10

The SPARQL 1.1 definition of an IRI can be found here: 
https://www.w3.org/TR/sparql11-query/#QSynIRI

I started trying to understand the all the rules, but thought easier to rely on 
the [rfc3987 Python module|https://pypi.python.org/pypi/rfc3987] for testing it.

{code}
>>> from rfc3987 import parse
>>> parse("http://en.wikipedia.org/wiki/Good_Love_(Meli'sa_Morgan_album)", 
>>> rule='IRI')
{'authority': 'en.wikipedia.org', 'scheme': 'http', 'path': 
"/wiki/Good_Love_(Meli'sa_Morgan_album)", 'fragment': None, 'query': None}
{code}

Testing the JavaScript regex online (e.g. https://regex101.com/ and selecting 
JavaScript), with expression _<[^<>\"\'\|\{\}\^\\\x00-\x20]*>_, and input 
_<http://en.wikipedia.org/wiki/Good_Love_(Meli'sa_Morgan_album)>_ returns no 
matches. But removing the single quote fixes it. So I believe the YASGUI.YASQE 
rule for IRI is missing something.

> Triple with apostrophe (') highlighted reds
> -------------------------------------------
>
>                 Key: JENA-1072
>                 URL: https://issues.apache.org/jira/browse/JENA-1072
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: Fuseki
>    Affects Versions: Fuseki 2.3.0
>            Reporter: Frantisek Hartman
>            Assignee: Bruno P. Kinoshita
>         Attachments: Screenshot_2016-10-09_19-33-52.png, 
> Screenshot_2016-10-09_19-57-15.png, Screenshot_2016-10-09_20-50-46.png
>
>
> Example query:
> {code}
> ASK {
> <http://en.wikipedia.org/wiki/Good_Love_(Meli'sa_Morgan_album)> 
> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
> <http://xmlns.com/foaf/0.1/Document> .
> }
> {code}
> The query returns correct result, but the ui highlights the IRI with 
> apostrophe red.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to