-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DRAFT: RDF-Star support #78
Conversation
b02085d
to
31a3bb9
Compare
lib/IManifest.ts
Outdated
@@ -35,7 +36,7 @@ export async function manifestFromResource(testCaseHandlers: {[uri: string]: ITe | |||
manifestFromSpecificationResource(testCaseHandlers, options, specificationResource) }))))) : null, | |||
subManifests: await Promise.all<IManifest>([].concat.apply([], | |||
resource.properties.include.map((includeList: Resource) => includeList.list | |||
.map(manifestFromResource.bind(null, testCaseHandlers, options))))), | |||
.map(resource => new ManifestLoader({ testCaseHandlers }).from(resource.value, options))))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rubensworks - everything is working as I would now expect when I'm running the spec tests on SPARQL.js.
Without this change the test suites of nested submanifests were not run. This change also causes 3 failures in the test suite; as the test suite is now trying to fetch non-existent manifests when previously the fetch function was not invoked.
I believe that this is actually the behavior that is wanted, and that the tests should be fixed. But since I'm not overly familiar with this repository I would appreciate if you could confirm my logic is correct before I forge ahead and mock those tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's been a while since I worked in this code, but if I remember correctly, the helpers inside IManifest
were not supposed to be aware of ManifestLoader
, only the other way around (to avoid cycles in the architecture).
I suspect there may be a mismatch in how (sub)manifests are structured in the RDF-star test suite versus how its currently implemented here.
So we may to loosen the implementation here to handle that case, which should be possible without directly invoking ManifestLoader
I think.
If I remember correctly, submanifests are also used in the SPARQL 1.1 test suite (as used in comunica).
Perhaps this can help in identifying the mismatch?
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rubensworks so the problem is that the root manifest does mf:include
on uris with the .ttl
extension (see https://w3c.github.io/rdf-star/tests/manifest.ttl); however the manifest within the document that is traversed to does not contain that extension (see https://w3c.github.io/rdf-star/tests/turtle/syntax/manifest.ttl).
On the other hand
rdf-test-suite.js/lib/IManifest.ts
Lines 37 to 38 in 5b795e0
resource.properties.include.map((includeList: Resource) => includeList.list | |
.map(manifestFromResource.bind(null, testCaseHandlers, options))))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same problem that is discussed in w3c/rdf-star#269 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO this is poor practise for linked data publishing. However w3c/rdf-star#269 (comment) doesn't actually specify whether the URI in the entries list is the URL at which the manifest entries should be located or whether it is the IRI of the manifest itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrm, that's annoying indeed. Let's report it (again?), and add a hardcoded workaround for this case?
Pull Request Test Coverage Report for Build 3513089150
💛 - Coveralls |
I believe this is ready to go @rubensworks :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super, thanks @jeswr!
Will release a new version once you have confirmed my 2 comments.
// @see https://github.com/rubensworks/rdf-test-suite.js/pull/78/files#r1026326410 | ||
((resource.properties.include.length > 0 || !objectLoader) | ||
? resource | ||
: (objectLoader.resources?.[resource.value.slice(0, resource.value.lastIndexOf('.')).replace(/\/manifest$/, '#manifest')] ?? resource) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you do a quick manual check to see if this doesn't break anything when running the tests in other places? For example Comunica and https://github.com/rubensworks/jsonld-streaming-parser.js ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've now checked both @rubensworks - and it is the same before and after switching to this version.
PS are you aware that the jsonld-streaming-parser is failing 4 spec tests at the moment (this occurred both before and after switching from the npm release to the current branch)
✖ property-scoped contexts which are alias of @nest
Nesting terms may have property-scoped contexts defined.
Error: Illegal keyword alias in term value, found: 'nest': '{"@id":"@nest"}'
at ContextParser.parseInnerContexts (/home/jeswr/github/jsonld-streaming-parser.js/node_modules/jsonld-context-parser/lib/ContextParser.js:550:35)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async ContextParser.parse (/home/jeswr/github/jsonld-streaming-parser.js/node_modules/jsonld-context-parser/lib/ContextParser.js:663:13)
at async EntryHandlerKeywordContext.handle (/home/jeswr/github/jsonld-streaming-parser.js/lib/entryhandler/keyword/EntryHandlerKeywordContext.js:33:46)
at async JsonLdParser.newOnValueJob (/home/jeswr/github/jsonld-streaming-parser.js/lib/JsonLdParser.js:201:21)
at async JsonLdParser.executeBufferedJobs (/home/jeswr/github/jsonld-streaming-parser.js/lib/JsonLdParser.js:407:21)
More info: https://w3c.github.io/json-ld-api/tests/toRdf-manifest#tc037
✖ Bibframe example (poor-mans inferrence)
Nesting terms may have property-scoped contexts defined.
Error: Illegal keyword alias in term value, found: 'contributionByRole': '{"@id":"@nest"}'
at ContextParser.parseInnerContexts (/home/jeswr/github/jsonld-streaming-parser.js/node_modules/jsonld-context-parser/lib/ContextParser.js:550:35)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async ContextParser.parse (/home/jeswr/github/jsonld-streaming-parser.js/node_modules/jsonld-context-parser/lib/ContextParser.js:663:13)
at async EntryHandlerKeywordContext.handle (/home/jeswr/github/jsonld-streaming-parser.js/lib/entryhandler/keyword/EntryHandlerKeywordContext.js:33:46)
at async JsonLdParser.newOnValueJob (/home/jeswr/github/jsonld-streaming-parser.js/lib/JsonLdParser.js:201:21)
at async JsonLdParser.executeBufferedJobs (/home/jeswr/github/jsonld-streaming-parser.js/lib/JsonLdParser.js:407:21)
More info: https://w3c.github.io/json-ld-api/tests/toRdf-manifest#tc038
✖ compact IRI as @vocab
Verifies that @vocab defined as a compact IRI expands properly
Error: Invalid data parsing
Input: {
"@context": [
{
"@version": 1.1,
"ex": {
"@id": "http://example.org/",
"@prefix": true
}
},
{
"@vocab": "ex:ns/"
}
],
"foo": "bar"
}
Expected: [
{
"subject": "_:b219_b0",
"predicate": "http://example.org/ns/foo",
"object": "\"bar\"",
"graph": ""
}
]
Got: [
{
"subject": "_:df_221_0",
"predicate": "ex:ns/foo",
"object": "\"bar\"",
"graph": ""
}
]
More info: https://w3c.github.io/json-ld-api/tests/toRdf-manifest#te124
✖ term as @vocab
Verifies that @vocab defined as a term expands properly
Error: Invalid data parsing
Input: {
"@context": [
{
"@version": 1.1,
"ex": {
"@id": "http://example.org/",
"@prefix": true
}
},
{
"@vocab": "ex"
}
],
"foo": "bar"
}
Expected: [
{
"subject": "_:b220_b0",
"predicate": "http://example.org/foo",
"object": "\"bar\"",
"graph": ""
}
]
Got: [
{
"subject": "_:df_222_0",
"predicate": "https://w3c.github.io/json-ld-api/tests/toRdf/exfoo",
"object": "\"bar\"",
"graph": ""
}
]
More info: https://w3c.github.io/json-ld-api/tests/toRdf-manifest#te125
✖ 458 / 462 tests succeeded! (skipped 11)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, perfect, thanks for checking!
PS are you aware that the jsonld-streaming-parser is failing 4 spec tests at the moment
Ah, that's new! Probably because of a recent addition in the test suite.
Will probably run into this very soon when implementing JSON-LD-star there :-)
Released as 1.20.0. |
This is to track the branch containing the addition of RDF-Star support - it is still in progress, and no action is required by anyone but myself at this time.
Currently following the suggestion of w3c/rdf-star#269 (comment) to customize some of the loading to support the way the manifest file is published.
Solves #77
There are 2 key issues that I am running into at the moment
I'm yet to diagnose if these have the same root cause