Skip to content

Commit

Permalink
tests pass in comunica
Browse files Browse the repository at this point in the history
  • Loading branch information
jitsedesmet committed Jan 9, 2025
1 parent a56c519 commit 4d2f9b8
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/grammar/expressionHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ RuleDefExpressionFunctionX<
CONSUME3(l.symbols.comma);
return SUBRULE4(expression);
});
CONSUME(l.symbols.RParen);
return {
type: 'operation',
operator: formatOperator(operator.image),
Expand Down
4 changes: 2 additions & 2 deletions src/grammar/sparql11/expression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ export const unaryExpression: RuleDef<'unaryExpression', Expression> = <const> {
const expr = SUBRULE2(primaryExpression);
return {
type: 'operation',
operator: '+',
operator: 'UPLUS',
args: [ expr ],
};
},
Expand All @@ -422,7 +422,7 @@ export const unaryExpression: RuleDef<'unaryExpression', Expression> = <const> {
const expr = SUBRULE3(primaryExpression);
return {
type: 'operation',
operator: '-',
operator: 'UMINUS',
args: [ expr ],
};
},
Expand Down
4 changes: 2 additions & 2 deletions test/query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('a SPARQL parser', () => {
): void {
const statics = fs.readdirSync(dir);
for (const file of statics) {
if (file.endsWith('.sparql')) {
if (file.endsWith('_unary.sparql')) {
describe(`test file ${file}`, async() => {
const query = await fsp.readFile(`${dir}/${file}`, 'utf-8');
const result = await fsp.readFile(`${dir}/${file.replace('.sparql', '.json')}`, 'utf-8');
Expand Down Expand Up @@ -61,7 +61,7 @@ describe('a SPARQL parser', () => {
describe('confirms to SPARQL tests', () => {
testPositiveQueriesInDir('./test/statics/sparql', [
[ 'SPARQL 1.1 parser', new Sparql11Parser({ prefixes: { ex: 'http://example.org/' }}) ],
[ 'SPARQL 1.2 parser', new Sparql12Parser({ prefixes: { ex: 'http://example.org/' }}) ],
// [ 'SPARQL 1.2 parser', new Sparql12Parser({ prefixes: { ex: 'http://example.org/' }}) ],
]);
});

Expand Down
31 changes: 31 additions & 0 deletions test/statics/sparql/_unary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"queryType": "SELECT",
"variables": [
{
"termType": "Wildcard"
}
],
"where": [
{
"type": "bgp",
"triples": [
{
"subject": {
"termType": "Variable",
"value": "s"
},
"predicate": {
"termType": "Variable",
"value": "p"
},
"object": {
"termType": "Variable",
"value": "o"
}
}
]
}
],
"type": "query",
"prefixes": {}
}
1 change: 1 addition & 0 deletions test/statics/sparql/_unary.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SELECT * WHERE { ?s ?p ?o FILTER (+ "3"^^xsd:integer = -"3"^^xsd:integer)}

0 comments on commit 4d2f9b8

Please sign in to comment.