diff --git a/lib/IManifest.ts b/lib/IManifest.ts index 0db9ba1..d8eef6f 100644 --- a/lib/IManifest.ts +++ b/lib/IManifest.ts @@ -35,7 +35,7 @@ export async function manifestFromResource(testCaseHandlers: {[uri: string]: ITe manifestFromSpecificationResource(testCaseHandlers, options, specificationResource) }))))) : null, subManifests: await Promise.all([].concat.apply([], resource.properties.include.map((includeList: Resource) => includeList.list - .map(manifestFromResource.bind(null, testCaseHandlers, options))))), + .map(resource => manifestFromResource(testCaseHandlers, options, resource))))), testEntries: (await Promise.all>([].concat.apply([], resource.properties.entries.map( (entryList: Resource) => (entryList.list || [entryList]) diff --git a/lib/ManifestLoader.ts b/lib/ManifestLoader.ts index 8387cfb..7bbbbf6 100644 --- a/lib/ManifestLoader.ts +++ b/lib/ManifestLoader.ts @@ -64,7 +64,14 @@ export class ManifestLoader { includeJobs.push(this.import(objectLoader, include.value, options)); } } - await Promise.all(includeJobs); + const jobs: Resource[] = await Promise.all(includeJobs); + + console.log('------------------------------------------------------------'); + console.log('include jobs') + console.log(jobs) + console.log('------------------------------------------------------------'); + // console.log(jobs.map(job => this.from(job.term.value))) + return manifest; } diff --git a/lib/TestSuiteRunner.ts b/lib/TestSuiteRunner.ts index 124c277..377dd7f 100644 --- a/lib/TestSuiteRunner.ts +++ b/lib/TestSuiteRunner.ts @@ -87,6 +87,7 @@ export class TestSuiteRunner { config: ITestSuiteConfig, results: ITestResult[], ) { + console.log('top level running manifest', manifest) // Execute all tests in this manifest if (manifest.testEntries) { for (const test of manifest.testEntries) { @@ -125,6 +126,7 @@ export class TestSuiteRunner { // Recursively handle all sub-manifests if (manifest.subManifests) { for (const subManifest of manifest.subManifests) { + // console.log('running subManifest', subManifest) await (this.runManifestConcrete(subManifest, handler, config, results)); } } diff --git a/lib/Util.ts b/lib/Util.ts index 2dc9242..964ceb5 100644 --- a/lib/Util.ts +++ b/lib/Util.ts @@ -85,7 +85,7 @@ export class Util { || contentType.indexOf('text/turtle') >= 0 || contentType.indexOf('application/n-triples') >= 0 || contentType.indexOf('application/n-quads') >= 0) { - return data.pipe(new GeneralizedN3StreamParser({ baseIRI, format: contentType })); + return data.pipe(new GeneralizedN3StreamParser({ baseIRI, format: contentType, })); } if (contentType.indexOf('application/rdf+xml') >= 0) { return data.pipe(new RdfXmlParser({ baseIRI })); diff --git a/test/ManifestLoader-test.ts b/test/ManifestLoader-test.ts index f461597..1033310 100644 --- a/test/ManifestLoader-test.ts +++ b/test/ManifestLoader-test.ts @@ -27,6 +27,17 @@ const streamifyString = require('streamify-string'); a mf:Manifest ; rdfs:label "SPARQL 1.1 tests". +`); + break; + case 'http://valid1/with/slash/manifest.jsonld': + body = streamifyString(` +@prefix rdf: . +@prefix rdfs: . +@prefix mf: . +@prefix qt: . + + a mf:Manifest ; + rdfs:label "SPARQL 1.1 tests". `); break; case 'http://validsub1': @@ -65,6 +76,42 @@ const streamifyString = require('streamify-string'); mf:include ("http://invalid1"). `); break; + case 'https://w3c.github.io/rdf-star/tests/manifest.jsonld': + body = streamifyString(` + ## [1] https://www.w3.org/Consortium/Legal/2008/04-testsuite-license + ## [2] https://www.w3.org/Consortium/Legal/2008/03-bsd-license + + PREFIX rdf: + PREFIX rdfs: + PREFIX mf: + PREFIX rdft: + PREFIX trs: + PREFIX dct: + PREFIX xsd: + PREFIX foaf: + PREFIX skos: + + trs:manifest rdf:type mf:Manifest ; + rdfs:label "RDF-star test suite"@en ; + skos:prefLabel "La suite des tests pour RDF-star"@fr; + skos:prefLabel "Conjunto de pruebas para RDF-star"@es; + dct:issued "2021-06-21"^^xsd:date ; + rdfs:seeAlso ; + dct:modified "2021-07-18"^^xsd:date ; + dct:licence ; + dct:creator [ foaf:homepage ; foaf:name " RDF-star Interest Group within the W3C RDF-DEV Community Group" ] ; + mf:include ( + + + + + + + + + ) . + `); + break; default: body = streamifyString('ABC'); break; @@ -139,6 +186,28 @@ describe('ManifestLoader', () => { }); }); + it('should apply / => # conversion required by RDF-star test suite', () => { + return expect(loader.from('http://valid1/with/slash/manifest.jsonld')).resolves.toEqual({ + comment: null, + label: 'SPARQL 1.1 tests', + specifications: null, + subManifests: [], + testEntries: [], + uri: 'http://valid1/with/slash#manifest', + }); + }); + + it('should load sub-manifests for the RDF-star test suite', () => { + return expect(loader.from('https://w3c.github.io/rdf-star/tests/manifest.jsonld')).resolves.toEqual({ + comment: null, + label: 'SPARQL 1.1 tests', + specifications: null, + subManifests: [], + testEntries: [], + uri: 'https://w3c.github.io/rdf-star/tests#manifest', + }); + }); + it('should error on invalid submanifests', () => { return expect(loader.from('http://invalidsub1')).rejects.toBeTruthy(); });