Closed jitsedesmet closed 1 year ago
@wschella During implementation of this PR I needed to create some more regular function (you don't need to look at the PR, don't worry).
While implementing this, I started wondering whether our handling of InvalidLiteral
is still optimal.
If I remember correctly, this type is created when the TermTransformer
gets an invalid lexical notation instead of throwing an error because there are functions that should still work on them.
Now we handle the error trowing in our helper like: https://github.com/comunica/sparqlee/blob/master/lib/functions/Helpers.ts#L213-L214
It seems like some functions now just don't have this kind of handling since you need to use one of the helper creators.
I suggest the .collect()
function (optionally) adds these overloads, so they don't need to be added manually.
I wanted to get this by you just to make sure I still understand these types correctly (I remember I was confused about this in the past).
Anyways, Thanks :D
I think the reason handling of invalid lexical forms is done semi-manually now is because the spec says exactly these should still work on invalid lexical forms and the others should explicitly not.
If current behaviour is not according to the new spec, or you find a simpler way to keep the same behaviour, feel free to rewrite of course :)
Wout
On Fri, 24 Feb 2023, 09:09 Jitse De Smet, @.***> wrote:
@.**** commented on this pull request.
In lib/util/DateTimeHelpers.ts https://github.com/comunica/sparqlee/pull/163#discussion_r1116635970:
+export function yearMonthDurationParser(durationStr: string): Partial
{
- const res = durationParser(durationStr);
- if (Object.entries(res).some(([ key, value ]) => value !== undefined && ![ 'year', 'month' ].includes(key))) {
- throw new Error('nono');
- }
- return res; +}
+export function dayTimeDurationParser(durationStr: string): Partial
{ - const res = durationParser(durationStr);
- const filtered = extractDayTimeDur(res);
- if (Object.entries(res).some(([ key, value ]) => value !== undefined && ![
- 'hours',
- 'minutes',
- 'seconds',
- 'day',
- ].includes(key))) {
- throw new Error('nono');
- }
- return res; +}
Alright, that's unfortunate. I'll make sure to add some comments than :) Your code fragment also looks better :) Thank you!
— Reply to this email directly, view it on GitHub https://github.com/comunica/sparqlee/pull/163#discussion_r1116635970, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACIKFSBQYU2MRLKVP4FBZ53WZBUDVANCNFSM6AAAAAATPTARKM . You are receiving this because you were mentioned.Message ID: @.***>
Alright, thank you, @wschella ! One more thing, you say:
the spec says exactly these should still work on invalid lexical forms and the others should explicitly not.
What if nothing is said? In this case it is right to assume the function should not work right? In other words, the following error should be thrown: https://github.com/comunica/sparqlee/blob/master/lib/functions/Helpers.ts#L250L254
I think so, the default for functions invoked with wrong types is to error according to https://www.w3.org/TR/sparql11-query/#evaluation.
Wout
On Fri, 24 Feb 2023 at 09:26, Jitse De Smet @.***> wrote:
Alright, thank you, @wschella https://github.com/wschella ! One more thing, you say:
the spec says exactly these should still work on invalid lexical forms and the others should explicitly not.
What if nothing is said? In this case it is right to assume the function should not work right? In other words, the following error should be thrown: https://github.com/comunica/sparqlee/blob/master/lib/functions/Helpers.ts#L250L254
— Reply to this email directly, view it on GitHub https://github.com/comunica/sparqlee/pull/163#issuecomment-1443111593, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACIKFSB2EGWK2TKZLDZUZV3WZBWB5ANCNFSM6AAAAAATPTARKM . You are receiving this because you were mentioned.Message ID: @.***>
This config has been deprecated, should I remove this? https://github.com/comunica/sparqlee/blob/master/README.md?plain=1#L66 (in a different PR?)
This config has been deprecated, should I remove this? https://github.com/comunica/sparqlee/blob/master/README.md?plain=1#L66 (in a different PR?)
Sure, but feel free to do it in this PR, since it's very minor.
I have not tried to run the spec tests, no.
When I run node ../../node_modules/rdf-test-suite/bin/Runner.js spec/sparql-engine.js https://raw.githubusercontent.com/kasei/sparql-12/xsd_datetime_duration/tests/xsd_functions/manifest.ttl -c ../../.rdf-test-suite-cache/
I get the following error:
Error: Could not parse the RDF serialization text/plain; charset=utf-8 on https://raw.githubusercontent.com/kasei/sparql-12/xsd_datetime_duration/tests/xsd_functions/manifest.ttl
at Util.parseRdfRaw (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/node_modules/rdf-test-suite/lib/Util.js:84:15)
at Util.<anonymous> (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/node_modules/rdf-test-suite/lib/Util.js:59:46)
at Generator.next (<anonymous>)
at fulfilled (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/node_modules/rdf-test-suite/lib/Util.js:5:58)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
That's weird, GH pages should provide the correct content type based on file extensions.
In any case, we'll probably have to add an extensions-based fallback to rdf-test-suite at some point (e.g. by making use of rdf-parse
).
As a temp workaround, could you modify this file (https://github.com/rubensworks/rdf-test-suite.js/blob/master/lib/Util.ts#L82, the local JS version) and a hardcoded workaround to use the N3 parser if the URL ends with .ttl
?
That should allow you to run the tests locally.
I added the following on the location you mentioned:
if (baseIRI.endsWith('.ttl')) {
return data.pipe(new GeneralizedN3StreamParser({ baseIRI, format: 'text/turtle', }));
}
if (baseIRI.endsWith('.srx')) {
return data.pipe(new RdfXmlParser({ baseIRI }));
}
This makes me able to run the tests, but all tests fail. When manually checking the bindings Comunica things seem correct (I did this for one test), the tests suite however tells me the result is wrong. I suppose the RdfXmlParser
is not the correct one?
For completeness I add the log: (the result file is: https://github.com/kasei/sparql-12/blob/xsd_datetime_duration/tests/xsd_functions/compare_duration-01.srx)
✖ compare xsd:duration values 01
This tests the equality operator on xsd:duration values
Error: Invalid query evaluation
Query:
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?id ?eq WHERE {
VALUES (?id ?l ?r) {
(1 "P1Y"^^xsd:duration "P1Y"^^xsd:duration)
(2 "P1Y"^^xsd:duration "P12M"^^xsd:duration)
(3 "P1Y"^^xsd:duration "P365D"^^xsd:duration)
(4 "P0Y"^^xsd:duration "PT0S"^^xsd:duration)
(5 "P1D"^^xsd:duration "PT24H"^^xsd:duration)
(6 "P1D"^^xsd:duration "PT23H"^^xsd:duration)
(7 "PT1H"^^xsd:duration "PT60M"^^xsd:duration)
(8 "PT1H"^^xsd:duration "PT3600S"^^xsd:duration)
(9 "-P1Y"^^xsd:duration "P1Y"^^xsd:duration)
(10 "-P0Y"^^xsd:duration "PT0S"^^xsd:duration)
}
BIND(?l = ?r AS ?eq)
}
Data links:
Result Source: https://raw.githubusercontent.com/kasei/sparql-12/xsd_datetime_duration/tests/xsd_functions/compare_duration-01.srx
Expected: [QueryResultQuads: [
{
"subject": "_:df_10_0",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#sparql",
"graph": ""
},
{
"subject": "_:df_10_1",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#variable",
"graph": ""
},
{
"subject": "_:df_10_0",
"predicate": "http://www.w3.org/2005/sparql-results#head",
"object": "_:df_10_1",
"graph": ""
},
{
"subject": "_:df_10_2",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#variable",
"graph": ""
},
{
"subject": "_:df_10_0",
"predicate": "http://www.w3.org/2005/sparql-results#head",
"object": "_:df_10_2",
"graph": ""
},
{
"subject": "_:df_10_3",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#result",
"graph": ""
},
{
"subject": "_:df_10_0",
"predicate": "http://www.w3.org/2005/sparql-results#results",
"object": "_:df_10_3",
"graph": ""
},
{
"subject": "_:df_10_4",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#literal",
"graph": ""
},
{
"subject": "_:df_10_3",
"predicate": "http://www.w3.org/2005/sparql-results#binding",
"object": "_:df_10_4",
"graph": ""
},
{
"subject": "_:df_10_5",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#literal",
"graph": ""
},
{
"subject": "_:df_10_3",
"predicate": "http://www.w3.org/2005/sparql-results#binding",
"object": "_:df_10_5",
"graph": ""
},
{
"subject": "_:df_10_6",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#result",
"graph": ""
},
{
"subject": "_:df_10_0",
"predicate": "http://www.w3.org/2005/sparql-results#results",
"object": "_:df_10_6",
"graph": ""
},
{
"subject": "_:df_10_7",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#literal",
"graph": ""
},
{
"subject": "_:df_10_6",
"predicate": "http://www.w3.org/2005/sparql-results#binding",
"object": "_:df_10_7",
"graph": ""
},
{
"subject": "_:df_10_8",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#literal",
"graph": ""
},
{
"subject": "_:df_10_6",
"predicate": "http://www.w3.org/2005/sparql-results#binding",
"object": "_:df_10_8",
"graph": ""
},
{
"subject": "_:df_10_9",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#result",
"graph": ""
},
{
"subject": "_:df_10_0",
"predicate": "http://www.w3.org/2005/sparql-results#results",
"object": "_:df_10_9",
"graph": ""
},
{
"subject": "_:df_10_10",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#literal",
"graph": ""
},
{
"subject": "_:df_10_9",
"predicate": "http://www.w3.org/2005/sparql-results#binding",
"object": "_:df_10_10",
"graph": ""
},
{
"subject": "_:df_10_11",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#literal",
"graph": ""
},
{
"subject": "_:df_10_9",
"predicate": "http://www.w3.org/2005/sparql-results#binding",
"object": "_:df_10_11",
"graph": ""
},
{
"subject": "_:df_10_12",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#result",
"graph": ""
},
{
"subject": "_:df_10_0",
"predicate": "http://www.w3.org/2005/sparql-results#results",
"object": "_:df_10_12",
"graph": ""
},
{
"subject": "_:df_10_13",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#literal",
"graph": ""
},
{
"subject": "_:df_10_12",
"predicate": "http://www.w3.org/2005/sparql-results#binding",
"object": "_:df_10_13",
"graph": ""
},
{
"subject": "_:df_10_14",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#literal",
"graph": ""
},
{
"subject": "_:df_10_12",
"predicate": "http://www.w3.org/2005/sparql-results#binding",
"object": "_:df_10_14",
"graph": ""
},
{
"subject": "_:df_10_15",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#result",
"graph": ""
},
{
"subject": "_:df_10_0",
"predicate": "http://www.w3.org/2005/sparql-results#results",
"object": "_:df_10_15",
"graph": ""
},
{
"subject": "_:df_10_16",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#literal",
"graph": ""
},
{
"subject": "_:df_10_15",
"predicate": "http://www.w3.org/2005/sparql-results#binding",
"object": "_:df_10_16",
"graph": ""
},
{
"subject": "_:df_10_17",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#literal",
"graph": ""
},
{
"subject": "_:df_10_15",
"predicate": "http://www.w3.org/2005/sparql-results#binding",
"object": "_:df_10_17",
"graph": ""
},
{
"subject": "_:df_10_18",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#result",
"graph": ""
},
{
"subject": "_:df_10_0",
"predicate": "http://www.w3.org/2005/sparql-results#results",
"object": "_:df_10_18",
"graph": ""
},
{
"subject": "_:df_10_19",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#literal",
"graph": ""
},
{
"subject": "_:df_10_18",
"predicate": "http://www.w3.org/2005/sparql-results#binding",
"object": "_:df_10_19",
"graph": ""
},
{
"subject": "_:df_10_20",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#literal",
"graph": ""
},
{
"subject": "_:df_10_18",
"predicate": "http://www.w3.org/2005/sparql-results#binding",
"object": "_:df_10_20",
"graph": ""
},
{
"subject": "_:df_10_21",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#result",
"graph": ""
},
{
"subject": "_:df_10_0",
"predicate": "http://www.w3.org/2005/sparql-results#results",
"object": "_:df_10_21",
"graph": ""
},
{
"subject": "_:df_10_22",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#literal",
"graph": ""
},
{
"subject": "_:df_10_21",
"predicate": "http://www.w3.org/2005/sparql-results#binding",
"object": "_:df_10_22",
"graph": ""
},
{
"subject": "_:df_10_23",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#literal",
"graph": ""
},
{
"subject": "_:df_10_21",
"predicate": "http://www.w3.org/2005/sparql-results#binding",
"object": "_:df_10_23",
"graph": ""
},
{
"subject": "_:df_10_24",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#result",
"graph": ""
},
{
"subject": "_:df_10_0",
"predicate": "http://www.w3.org/2005/sparql-results#results",
"object": "_:df_10_24",
"graph": ""
},
{
"subject": "_:df_10_25",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#literal",
"graph": ""
},
{
"subject": "_:df_10_24",
"predicate": "http://www.w3.org/2005/sparql-results#binding",
"object": "_:df_10_25",
"graph": ""
},
{
"subject": "_:df_10_26",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#literal",
"graph": ""
},
{
"subject": "_:df_10_24",
"predicate": "http://www.w3.org/2005/sparql-results#binding",
"object": "_:df_10_26",
"graph": ""
},
{
"subject": "_:df_10_27",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#result",
"graph": ""
},
{
"subject": "_:df_10_0",
"predicate": "http://www.w3.org/2005/sparql-results#results",
"object": "_:df_10_27",
"graph": ""
},
{
"subject": "_:df_10_28",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#literal",
"graph": ""
},
{
"subject": "_:df_10_27",
"predicate": "http://www.w3.org/2005/sparql-results#binding",
"object": "_:df_10_28",
"graph": ""
},
{
"subject": "_:df_10_29",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#literal",
"graph": ""
},
{
"subject": "_:df_10_27",
"predicate": "http://www.w3.org/2005/sparql-results#binding",
"object": "_:df_10_29",
"graph": ""
},
{
"subject": "_:df_10_30",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#result",
"graph": ""
},
{
"subject": "_:df_10_0",
"predicate": "http://www.w3.org/2005/sparql-results#results",
"object": "_:df_10_30",
"graph": ""
},
{
"subject": "_:df_10_31",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#literal",
"graph": ""
},
{
"subject": "_:df_10_30",
"predicate": "http://www.w3.org/2005/sparql-results#binding",
"object": "_:df_10_31",
"graph": ""
},
{
"subject": "_:df_10_32",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"object": "http://www.w3.org/2005/sparql-results#literal",
"graph": ""
},
{
"subject": "_:df_10_30",
"predicate": "http://www.w3.org/2005/sparql-results#binding",
"object": "_:df_10_32",
"graph": ""
}
]]
Got:
[QueryResultBindings:
Variables: [
"?id",
"?eq"
]
Bindings: [
{
"?id": {
"termType": "Literal",
"value": "1",
"language": "",
"datatype": {
"termType": "NamedNode",
"value": "http://www.w3.org/2001/XMLSchema#integer"
}
},
"?eq": {
"termType": "Literal",
"value": "true",
"language": "",
"datatype": {
"termType": "NamedNode",
"value": "http://www.w3.org/2001/XMLSchema#boolean"
}
}
},
{
"?id": {
"termType": "Literal",
"value": "2",
"language": "",
"datatype": {
"termType": "NamedNode",
"value": "http://www.w3.org/2001/XMLSchema#integer"
}
},
"?eq": {
"termType": "Literal",
"value": "true",
"language": "",
"datatype": {
"termType": "NamedNode",
"value": "http://www.w3.org/2001/XMLSchema#boolean"
}
}
},
{
"?id": {
"termType": "Literal",
"value": "3",
"language": "",
"datatype": {
"termType": "NamedNode",
"value": "http://www.w3.org/2001/XMLSchema#integer"
}
},
"?eq": {
"termType": "Literal",
"value": "false",
"language": "",
"datatype": {
"termType": "NamedNode",
"value": "http://www.w3.org/2001/XMLSchema#boolean"
}
}
},
{
"?id": {
"termType": "Literal",
"value": "4",
"language": "",
"datatype": {
"termType": "NamedNode",
"value": "http://www.w3.org/2001/XMLSchema#integer"
}
},
"?eq": {
"termType": "Literal",
"value": "true",
"language": "",
"datatype": {
"termType": "NamedNode",
"value": "http://www.w3.org/2001/XMLSchema#boolean"
}
}
},
{
"?id": {
"termType": "Literal",
"value": "5",
"language": "",
"datatype": {
"termType": "NamedNode",
"value": "http://www.w3.org/2001/XMLSchema#integer"
}
},
"?eq": {
"termType": "Literal",
"value": "true",
"language": "",
"datatype": {
"termType": "NamedNode",
"value": "http://www.w3.org/2001/XMLSchema#boolean"
}
}
},
{
"?id": {
"termType": "Literal",
"value": "6",
"language": "",
"datatype": {
"termType": "NamedNode",
"value": "http://www.w3.org/2001/XMLSchema#integer"
}
},
"?eq": {
"termType": "Literal",
"value": "false",
"language": "",
"datatype": {
"termType": "NamedNode",
"value": "http://www.w3.org/2001/XMLSchema#boolean"
}
}
},
{
"?id": {
"termType": "Literal",
"value": "7",
"language": "",
"datatype": {
"termType": "NamedNode",
"value": "http://www.w3.org/2001/XMLSchema#integer"
}
},
"?eq": {
"termType": "Literal",
"value": "true",
"language": "",
"datatype": {
"termType": "NamedNode",
"value": "http://www.w3.org/2001/XMLSchema#boolean"
}
}
},
{
"?id": {
"termType": "Literal",
"value": "8",
"language": "",
"datatype": {
"termType": "NamedNode",
"value": "http://www.w3.org/2001/XMLSchema#integer"
}
},
"?eq": {
"termType": "Literal",
"value": "true",
"language": "",
"datatype": {
"termType": "NamedNode",
"value": "http://www.w3.org/2001/XMLSchema#boolean"
}
}
},
{
"?id": {
"termType": "Literal",
"value": "9",
"language": "",
"datatype": {
"termType": "NamedNode",
"value": "http://www.w3.org/2001/XMLSchema#integer"
}
},
"?eq": {
"termType": "Literal",
"value": "false",
"language": "",
"datatype": {
"termType": "NamedNode",
"value": "http://www.w3.org/2001/XMLSchema#boolean"
}
}
},
{
"?id": {
"termType": "Literal",
"value": "10",
"language": "",
"datatype": {
"termType": "NamedNode",
"value": "http://www.w3.org/2001/XMLSchema#integer"
}
},
"?eq": {
"termType": "Literal",
"value": "true",
"language": "",
"datatype": {
"termType": "NamedNode",
"value": "http://www.w3.org/2001/XMLSchema#boolean"
}
}
}
]
]
srx
is SPARQL/XML, not RDF/XML.
Alright, yes; I added a case on: https://github.com/rubensworks/rdf-test-suite.js/blob/master/lib/testcase/sparql/TestCaseQueryEvaluation.ts#L44
if (url.endsWith('.srx')) {
contentType = 'application/sparql-results+xml';
}
Okey. Some things were still wrong (Oh how hard it is to copy spec tests correctly :'( )
These issues have been resolved. 3 spec tests still fail since they are related to the new ADJUST
that has not been implemented.
So, I think this is ready to be merged :D excided
ode ../../../rdf-test-suite.js/bin/Runner.js spec/sparql-engine.js https://raw.githubusercontent.com/kasei/sparql-12/xsd_datetime_duration/tests/xsd_functions/manifest.ttl -c ../../.rdf-test-suite-cache/
✔ compare xsd:duration values 01 (http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#compare_duration01) 46.032811ms
✔ compare xsd:yearMonthDuration values 01 (http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#compare_yearMonthDuration01) 11.421593ms
✔ compare xsd:dayTimeDuration values 01 (http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#compare_dayTimeDuration01) 5.038684ms
✔ compare xsd:date values 01 (http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#compare_time01) 6.430583ms
✔ extract xsd:date components 01 (http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#extract_date01) 3.986147ms
✔ extract xsd:time components 01 (http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#extract_time01) 3.739652ms
✖ xsd:dateTime timezone adjustment 01 (http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#adjust_dateTime01)
✖ xsd:date timezone adjustment 01 (http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#adjust_date01)
✖ xsd:time timezone adjustment 01 (http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#adjust_time01)
✔ xsd:dateTime, xsd:date, xsd:time subtraction 01 (http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#dateTime_subtract01) 3.604079ms
✔ xsd:yearMonthDuration addition 01 (http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#duration_yearMonth_add01) 8.030167ms
✔ xsd:dayTimeDuration addition 01 (http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#duration_dayTime_add01) 3.434092ms
✔ xsd:yearMonthDuration subtraction 01 (http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#duration_yearMonth_subtract01) 2.673866ms
✔ xsd:dayTimeDuration subtraction 01 (http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#duration_dayTime_subtract01) 4.500485ms
✔ xsd:date construction 01 (http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#constructor_date01) 3.267333ms
✔ xsd:date construction 02 (http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#constructor_date02) 3.607592ms
✔ xsd:time construction 01 (http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#constructor_time01) 4.17699ms
✔ xsd:time construction 02 (http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#constructor_time02) 2.764017ms
✔ xsd:duration construction 01 (http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#constructor_duration01) 4.603016ms
✔ xsd:duration construction 02 (http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#constructor_duration02) 3.522936ms
✖ xsd:dateTime timezone adjustment 01
This tests ability to change the timezone of an xsd:dateTime value
Error: Parse error on line 10:
...:dateTime) } BIND(ADJUST(?d, ?tz) AS ?
---------------------^
Expecting 'IRIREF', 'PNAME_NS', 'VAR', '(', 'INTEGER', '!', '<<', '+', '-', 'FUNC_ARITY0', 'FUNC_ARITY1', 'FUNC_ARITY2', 'IF', 'BOUND', 'BNODE', 'EXISTS', 'COUNT', 'FUNC_AGGREGATE', 'GROUP_CONCAT', 'DECIMAL', 'DOUBLE', 'BOOLEAN', 'STRING_LITERAL1', 'STRING_LITERAL2', 'STRING_LITERAL_LONG1', 'STRING_LITERAL_LONG2', 'INTEGER_POSITIVE', 'DECIMAL_POSITIVE', 'DOUBLE_POSITIVE', 'INTEGER_NEGATIVE', 'DECIMAL_NEGATIVE', 'DOUBLE_NEGATIVE', 'PNAME_LN', 'NOT', 'CONCAT', 'COALESCE', 'SUBSTR', 'REGEX', 'REPLACE', got 'a'
at Parser.parseError (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/node_modules/sparqljs/lib/SparqlParser.js:674:21)
at Parser.parse (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/node_modules/sparqljs/lib/SparqlParser.js:741:22)
at Parser.parser.parse (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/node_modules/sparqljs/sparql.js:36:37)
at ActorQueryParseSparql.run (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/packages/actor-query-parse-sparql/lib/ActorQueryParseSparql.js:23:37)
at ActorQueryParseSparql.runObservable (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/packages/core/lib/Actor.js:57:29)
at MediatorRace.mediate (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/packages/core/lib/Mediator.js:79:22)
at async QueryEngine.queryOrExplain (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/packages/actor-init-query/lib/QueryEngineBase.js:104:38)
at async QueryEngine.query (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/packages/actor-init-query/lib/QueryEngineBase.js:42:24)
at async Object.queryLdf (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/packages/actor-init-query/spec/sparql-engine-base.js:14:22)
More info: http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#adjust_dateTime01
✖ xsd:date timezone adjustment 01
This tests ability to change the timezone of an xsd:date value
Error: Parse error on line 9:
...^xsd:date) } BIND(ADJUST(?d, ?tz) AS ?
---------------------^
Expecting 'IRIREF', 'PNAME_NS', 'VAR', '(', 'INTEGER', '!', '<<', '+', '-', 'FUNC_ARITY0', 'FUNC_ARITY1', 'FUNC_ARITY2', 'IF', 'BOUND', 'BNODE', 'EXISTS', 'COUNT', 'FUNC_AGGREGATE', 'GROUP_CONCAT', 'DECIMAL', 'DOUBLE', 'BOOLEAN', 'STRING_LITERAL1', 'STRING_LITERAL2', 'STRING_LITERAL_LONG1', 'STRING_LITERAL_LONG2', 'INTEGER_POSITIVE', 'DECIMAL_POSITIVE', 'DOUBLE_POSITIVE', 'INTEGER_NEGATIVE', 'DECIMAL_NEGATIVE', 'DOUBLE_NEGATIVE', 'PNAME_LN', 'NOT', 'CONCAT', 'COALESCE', 'SUBSTR', 'REGEX', 'REPLACE', got 'a'
at Parser.parseError (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/node_modules/sparqljs/lib/SparqlParser.js:674:21)
at Parser.parse (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/node_modules/sparqljs/lib/SparqlParser.js:741:22)
at Parser.parser.parse (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/node_modules/sparqljs/sparql.js:36:37)
at ActorQueryParseSparql.run (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/packages/actor-query-parse-sparql/lib/ActorQueryParseSparql.js:23:37)
at ActorQueryParseSparql.runObservable (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/packages/core/lib/Actor.js:57:29)
at MediatorRace.mediate (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/packages/core/lib/Mediator.js:79:22)
at async QueryEngine.queryOrExplain (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/packages/actor-init-query/lib/QueryEngineBase.js:104:38)
at async QueryEngine.query (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/packages/actor-init-query/lib/QueryEngineBase.js:42:24)
at async Object.queryLdf (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/packages/actor-init-query/spec/sparql-engine-base.js:14:22)
More info: http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#adjust_date01
✖ xsd:time timezone adjustment 01
This tests ability to change the timezone of an xsd:time value
Error: Parse error on line 10:
...^xsd:time) } BIND(ADJUST(?d, ?tz) AS ?
---------------------^
Expecting 'IRIREF', 'PNAME_NS', 'VAR', '(', 'INTEGER', '!', '<<', '+', '-', 'FUNC_ARITY0', 'FUNC_ARITY1', 'FUNC_ARITY2', 'IF', 'BOUND', 'BNODE', 'EXISTS', 'COUNT', 'FUNC_AGGREGATE', 'GROUP_CONCAT', 'DECIMAL', 'DOUBLE', 'BOOLEAN', 'STRING_LITERAL1', 'STRING_LITERAL2', 'STRING_LITERAL_LONG1', 'STRING_LITERAL_LONG2', 'INTEGER_POSITIVE', 'DECIMAL_POSITIVE', 'DOUBLE_POSITIVE', 'INTEGER_NEGATIVE', 'DECIMAL_NEGATIVE', 'DOUBLE_NEGATIVE', 'PNAME_LN', 'NOT', 'CONCAT', 'COALESCE', 'SUBSTR', 'REGEX', 'REPLACE', got 'a'
at Parser.parseError (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/node_modules/sparqljs/lib/SparqlParser.js:674:21)
at Parser.parse (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/node_modules/sparqljs/lib/SparqlParser.js:741:22)
at Parser.parser.parse (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/node_modules/sparqljs/sparql.js:36:37)
at ActorQueryParseSparql.run (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/packages/actor-query-parse-sparql/lib/ActorQueryParseSparql.js:23:37)
at ActorQueryParseSparql.runObservable (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/packages/core/lib/Actor.js:57:29)
at MediatorRace.mediate (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/packages/core/lib/Mediator.js:79:22)
at async QueryEngine.queryOrExplain (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/packages/actor-init-query/lib/QueryEngineBase.js:104:38)
at async QueryEngine.query (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/packages/actor-init-query/lib/QueryEngineBase.js:42:24)
at async Object.queryLdf (/home/jitsedesmet/Documents/werken/22-jaar-comunica/comunica/packages/actor-init-query/spec/sparql-engine-base.js:14:22)
More info: http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#adjust_time01
✖ 17 / 20 tests succeeded!
This is really amazing work @jitsedesmet! Preparing a new release now...
Could you look into making a PR to Comunica to include this change?
We'll also have to update rdf-test-suite with your changes, as we need to run these tests in the CI as well.
(we'll have to run with the -e
option, to not let the CI fail because of those 3 failing tests)
Once all of that is done, can you open a PR to https://github.com/w3c/sparql-12/blob/main/SEP/SEP-0002/sep-0002.md to add Comunica to the list of supported implementation (perhaps with an ADJUST
disclaimer).
Sparql 1.2 suggests additional date support on their GitHub spec page. This PR implements the suggested features. In addition to implementing these features, this PR should also close 2 issues of the Comunica repo, mainly: https://github.com/comunica/comunica/issues/1065 and https://github.com/comunica/comunica/issues/1098 .
The PR is expected to grow pretty large, because sparqlee previously used the fact that Sparql didn't require the creation or manipulation of dates. Implementing the functionality requires rewriting how sparqlee looks at dates.
The aim has been to use JS Date as much as possible, every feedback is welcome in regard to how this was done.