Skip to content

Commit

Permalink
* allow less operator in filter clauses and don't switch to uri mode …
Browse files Browse the repository at this point in the history
…there
  • Loading branch information
BrummbQ committed Oct 27, 2015
1 parent 77df076 commit c2764ee
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions library/Erfurt/Sparql/Parser.php
Expand Up @@ -112,7 +112,7 @@ public static function tokenize($queryString)

$inLiteral = false;
$longLiteral = false;

for ($i=0; $i<$len; ++$i) {
if (in_array($queryString[$i], $removeableSpecialChars) && !$inLiteral && !$inTelUri) {
if (isset($tokens[$n]) && $tokens[$n] !== '') {
Expand Down Expand Up @@ -224,15 +224,19 @@ public static function tokenize($queryString)
$inUri = false;
continue;
} else if ($queryString[$i] === '<') {
$inUri = true;
if ($tokens[$n] === '') {
$tokens[$n] = '<';
continue;
} else {
$tokens[++$n] = '<';
continue;
}
// this is a less operator, if we are in a filter clause and this is the second argument and also followed by a whitespace
if (isset($tokens[$n-3]) && $tokens[$n-3] !== 'FILTER' && isset($queryString[$i+1]) && $queryString[$i+1] !== ' ') {
// this is an uri
$inUri = true;

if ($tokens[$n] === '') {
$tokens[$n] = '<';
continue;
} else {
$tokens[++$n] = '<';
continue;
}
}
}

$tokens[$n] .= $queryString{$i};
Expand Down

0 comments on commit c2764ee

Please sign in to comment.