eyeleng 1.0.12 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -4
- package/reports/w3c-shacl12-rules-earl.ttl +1055 -1336
- package/test/run.js +0 -1
- package/tools/w3c-rdf.js +11 -7
- package/tools/w3c-shacl12-rules.js +11 -6
package/test/run.js
CHANGED
package/tools/w3c-rdf.js
CHANGED
|
@@ -8,7 +8,6 @@ const {
|
|
|
8
8
|
runW3cRdfManifests,
|
|
9
9
|
formatW3cRdfProgressLine,
|
|
10
10
|
formatW3cRdfManifestsResult,
|
|
11
|
-
rdfManifestsToEarl,
|
|
12
11
|
writeRdfEarlReport,
|
|
13
12
|
defaultRdfReportPath,
|
|
14
13
|
} = require('../src/rdfManifest.js');
|
|
@@ -19,12 +18,18 @@ function argValue(argv, name) {
|
|
|
19
18
|
return argv[index + 1] || null;
|
|
20
19
|
}
|
|
21
20
|
|
|
21
|
+
function loggerForMode({ json, earl }) {
|
|
22
|
+
// Keep stdout machine-readable or empty in output modes. Progress still stays visible.
|
|
23
|
+
return json || earl ? console.error : console.log;
|
|
24
|
+
}
|
|
25
|
+
|
|
22
26
|
async function main(argv = process.argv.slice(2)) {
|
|
23
27
|
const json = argv.includes('--json');
|
|
24
28
|
const earl = argv.includes('--earl');
|
|
25
29
|
const noReport = argv.includes('--no-report');
|
|
26
|
-
const quiet =
|
|
30
|
+
const quiet = argv.includes('--quiet');
|
|
27
31
|
const output = argValue(argv, '--output') || defaultRdfReportPath();
|
|
32
|
+
const log = loggerForMode({ json, earl });
|
|
28
33
|
const manifests = argv.filter((arg, index) => {
|
|
29
34
|
if (arg.startsWith('--')) return false;
|
|
30
35
|
if (argv[index - 1] === '--output') return false;
|
|
@@ -33,19 +38,18 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
33
38
|
const resources = manifests.length ? manifests : defaultW3cRdfManifestUrls;
|
|
34
39
|
const result = await runW3cRdfManifests(resources, {
|
|
35
40
|
onManifestStart(resource, index, total) {
|
|
36
|
-
if (!quiet)
|
|
41
|
+
if (!quiet) log(`${C.y}==${C.n} W3C RDF manifest ${index + 1}/${total}: ${resource}`);
|
|
37
42
|
},
|
|
38
43
|
onProgress(item, index) {
|
|
39
|
-
if (!quiet)
|
|
44
|
+
if (!quiet) log(formatW3cRdfProgressLine(item, index, { colors: C }));
|
|
40
45
|
},
|
|
41
46
|
});
|
|
42
47
|
if (!noReport) {
|
|
43
48
|
const reportPath = writeRdfEarlReport(result, output, { assertedBy: '<https://github.com/eyereasoner/eyeleng>' });
|
|
44
|
-
if (!quiet)
|
|
49
|
+
if (!quiet) log(`${C.dim}EARL report: ${path.relative(path.join(__dirname, '..'), reportPath)}${C.n}`);
|
|
45
50
|
}
|
|
46
51
|
if (json) process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
47
|
-
else if (earl) process.stdout.write(`${
|
|
48
|
-
else process.stdout.write(`${formatW3cRdfManifestsResult(result, { colors: C })}\n`);
|
|
52
|
+
else if (!earl) process.stdout.write(`${formatW3cRdfManifestsResult(result, { colors: C })}\n`);
|
|
49
53
|
return result.counts.fail === 0 ? 0 : 1;
|
|
50
54
|
}
|
|
51
55
|
|
|
@@ -8,7 +8,6 @@ const {
|
|
|
8
8
|
runShacl12RulesManifest,
|
|
9
9
|
formatShacl12RulesProgressLine,
|
|
10
10
|
formatShacl12RulesManifestResult,
|
|
11
|
-
shacl12RulesManifestToEarl,
|
|
12
11
|
writeShacl12RulesEarlReport,
|
|
13
12
|
defaultReportPath,
|
|
14
13
|
} = require('../src/shacl12RulesManifest.js');
|
|
@@ -19,12 +18,18 @@ function argValue(argv, name) {
|
|
|
19
18
|
return argv[index + 1] || null;
|
|
20
19
|
}
|
|
21
20
|
|
|
21
|
+
function loggerForMode({ json, earl }) {
|
|
22
|
+
// Keep stdout machine-readable or empty in output modes. Progress still stays visible.
|
|
23
|
+
return json || earl ? console.error : console.log;
|
|
24
|
+
}
|
|
25
|
+
|
|
22
26
|
async function main(argv = process.argv.slice(2)) {
|
|
23
27
|
const json = argv.includes('--json');
|
|
24
28
|
const earl = argv.includes('--earl');
|
|
25
29
|
const noReport = argv.includes('--no-report');
|
|
26
|
-
const quiet =
|
|
30
|
+
const quiet = argv.includes('--quiet');
|
|
27
31
|
const output = argValue(argv, '--output') || defaultReportPath();
|
|
32
|
+
const log = loggerForMode({ json, earl });
|
|
28
33
|
const manifests = argv.filter((arg, index) => {
|
|
29
34
|
if (arg.startsWith('--')) return false;
|
|
30
35
|
if (argv[index - 1] === '--output') return false;
|
|
@@ -32,20 +37,20 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
32
37
|
});
|
|
33
38
|
const manifest = manifests[0] || process.env.EYELENG_SHACL12_RULES_MANIFEST || defaultShacl12RulesManifestUrl;
|
|
34
39
|
|
|
40
|
+
if (!quiet) log(`${C.y}==${C.n} W3C SHACL 1.2 Rules manifest: ${manifest}`);
|
|
35
41
|
const result = await runShacl12RulesManifest(manifest, {
|
|
36
42
|
onProgress(item, index) {
|
|
37
|
-
if (!quiet)
|
|
43
|
+
if (!quiet) log(formatShacl12RulesProgressLine(item, index, { colors: C }));
|
|
38
44
|
},
|
|
39
45
|
});
|
|
40
46
|
|
|
41
47
|
if (!noReport) {
|
|
42
48
|
const reportPath = writeShacl12RulesEarlReport(result, output);
|
|
43
|
-
if (!quiet)
|
|
49
|
+
if (!quiet) log(`${C.dim}EARL report: ${path.relative(path.join(__dirname, '..'), reportPath)}${C.n}`);
|
|
44
50
|
}
|
|
45
51
|
|
|
46
52
|
if (json) process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
47
|
-
else if (earl) process.stdout.write(`${
|
|
48
|
-
else process.stdout.write(`${formatShacl12RulesManifestResult(result, { colors: C })}\n`);
|
|
53
|
+
else if (!earl) process.stdout.write(`${formatShacl12RulesManifestResult(result, { colors: C })}\n`);
|
|
49
54
|
return result.counts.fail === 0 ? 0 : 1;
|
|
50
55
|
}
|
|
51
56
|
|