@jbr-experiment/largerdfbench 0.0.0-stage → 6.7.0
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/LICENSE.txt +21 -0
- package/README.md +254 -2
- package/components/ExperimentHandlerLargeRdfBench.jsonld +44 -0
- package/components/ExperimentLargeRdfBench.jsonld +490 -0
- package/components/components.jsonld +12 -0
- package/components/context.jsonld +91 -0
- package/index.d.ts +2 -0
- package/index.js +19 -0
- package/index.ts +2 -0
- package/lib/DatasetSampler.d.ts +73 -0
- package/lib/DatasetSampler.js +164 -0
- package/lib/ExperimentHandlerLargeRdfBench.d.ts +12 -0
- package/lib/ExperimentHandlerLargeRdfBench.js +46 -0
- package/lib/ExperimentLargeRdfBench.d.ts +159 -0
- package/lib/ExperimentLargeRdfBench.js +483 -0
- package/lib/LineageComputer.d.ts +183 -0
- package/lib/LineageComputer.js +368 -0
- package/lib/QueryPatterns.d.ts +115 -0
- package/lib/QueryPatterns.js +264 -0
- package/lib/SampleValidator.d.ts +85 -0
- package/lib/SampleValidator.js +168 -0
- package/lib/ZenodoArchive.d.ts +92 -0
- package/lib/ZenodoArchive.js +199 -0
- package/lib/templates/equivalent-queries/C2.sparql +23 -0
- package/lib/templates/equivalent-queries/C5.sparql +27 -0
- package/package.json +89 -4
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { IHdtDocumentLike } from './LineageComputer';
|
|
2
|
+
import { PatternMatcher } from './QueryPatterns';
|
|
3
|
+
/**
|
|
4
|
+
* Statistics on a sampled dataset.
|
|
5
|
+
*/
|
|
6
|
+
export interface ISampledDatasetStats {
|
|
7
|
+
subjectRate: number;
|
|
8
|
+
triples: number;
|
|
9
|
+
subjects: number;
|
|
10
|
+
matchingInFull: number;
|
|
11
|
+
sampledSubjects: number;
|
|
12
|
+
matching: number;
|
|
13
|
+
other: number;
|
|
14
|
+
lineage: number;
|
|
15
|
+
witnesses: number;
|
|
16
|
+
sampleTriples: number;
|
|
17
|
+
sha256: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The number of matches of a query pattern per dataset, over the full data and over the sample.
|
|
21
|
+
*/
|
|
22
|
+
export interface IPatternCounts {
|
|
23
|
+
pattern: string;
|
|
24
|
+
full: Record<string, number>;
|
|
25
|
+
sample: Record<string, number>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Samples datasets. Per dataset, subjects are sampled at its subject rate. Of a sampled subject, all triples that match
|
|
29
|
+
* a query pattern are kept, and its other triples are kept at the other triples rate.
|
|
30
|
+
* Then, the answer lineage of all queries is added, so that query results equal those over the full data, and one
|
|
31
|
+
* witness triple for each query pattern that matches the full dataset but nothing in the sample, so that the same
|
|
32
|
+
* datasets are relevant to each query pattern as in the full data.
|
|
33
|
+
*/
|
|
34
|
+
export declare class DatasetSampler {
|
|
35
|
+
readonly options: {
|
|
36
|
+
documents: Record<string, IHdtDocumentLike>;
|
|
37
|
+
queries: string[];
|
|
38
|
+
subjectRates: Record<string, number>;
|
|
39
|
+
otherTriplesRate: number;
|
|
40
|
+
seed: string;
|
|
41
|
+
lineageDirectory: string;
|
|
42
|
+
outputDirectory: string;
|
|
43
|
+
log: (message: string) => void;
|
|
44
|
+
pageSize?: number;
|
|
45
|
+
};
|
|
46
|
+
static readonly PAGE_SIZE = 500000;
|
|
47
|
+
constructor(options: {
|
|
48
|
+
documents: Record<string, IHdtDocumentLike>;
|
|
49
|
+
queries: string[];
|
|
50
|
+
subjectRates: Record<string, number>;
|
|
51
|
+
otherTriplesRate: number;
|
|
52
|
+
seed: string;
|
|
53
|
+
lineageDirectory: string;
|
|
54
|
+
outputDirectory: string;
|
|
55
|
+
log: (message: string) => void;
|
|
56
|
+
pageSize?: number;
|
|
57
|
+
});
|
|
58
|
+
/**
|
|
59
|
+
* Sample all datasets into N-Triples files in the output directory.
|
|
60
|
+
*/
|
|
61
|
+
sampleAll(): Promise<{
|
|
62
|
+
datasets: Record<string, ISampledDatasetStats>;
|
|
63
|
+
patterns: IPatternCounts[];
|
|
64
|
+
}>;
|
|
65
|
+
/**
|
|
66
|
+
* Sample a single dataset.
|
|
67
|
+
* @param ds The dataset name.
|
|
68
|
+
* @param matcher A matcher for the query patterns.
|
|
69
|
+
* @param fullCounts The matches per pattern and dataset over the full data, which is updated.
|
|
70
|
+
* @param sampleCounts The matches per pattern and dataset over the sample, which is updated.
|
|
71
|
+
*/
|
|
72
|
+
sample(ds: string, matcher: PatternMatcher, fullCounts: Record<string, number>[], sampleCounts: Record<string, number>[]): Promise<ISampledDatasetStats>;
|
|
73
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.DatasetSampler = void 0;
|
|
27
|
+
const node_crypto_1 = require("node:crypto");
|
|
28
|
+
const Path = __importStar(require("node:path"));
|
|
29
|
+
const fs = __importStar(require("fs-extra"));
|
|
30
|
+
const n3_1 = require("n3");
|
|
31
|
+
const rdf_string_ttl_1 = require("rdf-string-ttl");
|
|
32
|
+
const QueryPatterns_1 = require("./QueryPatterns");
|
|
33
|
+
/**
|
|
34
|
+
* Samples datasets. Per dataset, subjects are sampled at its subject rate. Of a sampled subject, all triples that match
|
|
35
|
+
* a query pattern are kept, and its other triples are kept at the other triples rate.
|
|
36
|
+
* Then, the answer lineage of all queries is added, so that query results equal those over the full data, and one
|
|
37
|
+
* witness triple for each query pattern that matches the full dataset but nothing in the sample, so that the same
|
|
38
|
+
* datasets are relevant to each query pattern as in the full data.
|
|
39
|
+
*/
|
|
40
|
+
class DatasetSampler {
|
|
41
|
+
constructor(options) {
|
|
42
|
+
this.options = options;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Sample all datasets into N-Triples files in the output directory.
|
|
46
|
+
*/
|
|
47
|
+
async sampleAll() {
|
|
48
|
+
const matcher = new QueryPatterns_1.PatternMatcher(this.options.queries);
|
|
49
|
+
const fullCounts = matcher.patterns.map(() => ({}));
|
|
50
|
+
const sampleCounts = matcher.patterns.map(() => ({}));
|
|
51
|
+
await fs.ensureDir(this.options.outputDirectory);
|
|
52
|
+
const datasets = {};
|
|
53
|
+
for (const ds of Object.keys(this.options.documents)) {
|
|
54
|
+
datasets[ds] = await this.sample(ds, matcher, fullCounts, sampleCounts);
|
|
55
|
+
this.options.log(` ${ds}: ${datasets[ds].sampleTriples} of ${datasets[ds].triples} triples`);
|
|
56
|
+
}
|
|
57
|
+
const patterns = matcher.patterns
|
|
58
|
+
.map((pattern, i) => ({ pattern: pattern.key, full: fullCounts[i], sample: sampleCounts[i] }))
|
|
59
|
+
.sort((a, b) => Math.max(0, ...Object.values(b.full)) - Math.max(0, ...Object.values(a.full)) ||
|
|
60
|
+
a.pattern.localeCompare(b.pattern));
|
|
61
|
+
return { datasets, patterns };
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Sample a single dataset.
|
|
65
|
+
* @param ds The dataset name.
|
|
66
|
+
* @param matcher A matcher for the query patterns.
|
|
67
|
+
* @param fullCounts The matches per pattern and dataset over the full data, which is updated.
|
|
68
|
+
* @param sampleCounts The matches per pattern and dataset over the sample, which is updated.
|
|
69
|
+
*/
|
|
70
|
+
async sample(ds, matcher, fullCounts, sampleCounts) {
|
|
71
|
+
var _a, _b;
|
|
72
|
+
const document = this.options.documents[ds];
|
|
73
|
+
const subjectRate = (_a = this.options.subjectRates[ds]) !== null && _a !== void 0 ? _a : 1;
|
|
74
|
+
const add = (counts, indexes) => {
|
|
75
|
+
var _a;
|
|
76
|
+
for (const index of indexes) {
|
|
77
|
+
counts[index][ds] = ((_a = counts[index][ds]) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const total = (await document.countTriples()).totalCount;
|
|
81
|
+
const lines = new Set();
|
|
82
|
+
const stats = {
|
|
83
|
+
subjectRate,
|
|
84
|
+
triples: total,
|
|
85
|
+
subjects: 0,
|
|
86
|
+
matchingInFull: 0,
|
|
87
|
+
sampledSubjects: 0,
|
|
88
|
+
matching: 0,
|
|
89
|
+
other: 0,
|
|
90
|
+
lineage: 0,
|
|
91
|
+
witnesses: 0,
|
|
92
|
+
};
|
|
93
|
+
// Sample subjects, and count the matches of each pattern over the full data.
|
|
94
|
+
let current;
|
|
95
|
+
let sampled = false;
|
|
96
|
+
const pageSize = (_b = this.options.pageSize) !== null && _b !== void 0 ? _b : DatasetSampler.PAGE_SIZE;
|
|
97
|
+
for (let offset = 0; offset < total; offset += pageSize) {
|
|
98
|
+
const { triples } = await document.searchTriples(undefined, undefined, undefined, { offset, limit: pageSize });
|
|
99
|
+
for (const { subject, predicate, object } of triples) {
|
|
100
|
+
const subjectKey = (0, rdf_string_ttl_1.termToString)(subject);
|
|
101
|
+
if (subjectKey !== current) {
|
|
102
|
+
if (subject.termType === 'BlankNode' && subjectRate < 1) {
|
|
103
|
+
throw new Error(`Dataset ${ds} has blank node subjects, which is only supported with a subject rate of 1`);
|
|
104
|
+
}
|
|
105
|
+
current = subjectKey;
|
|
106
|
+
stats.subjects++;
|
|
107
|
+
sampled = (0, QueryPatterns_1.keep)(this.options.seed, subjectRate, ds, subjectKey);
|
|
108
|
+
if (sampled) {
|
|
109
|
+
stats.sampledSubjects++;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const matches = matcher.match(subjectKey, (0, rdf_string_ttl_1.termToString)(predicate), object);
|
|
113
|
+
if (matches.length > 0) {
|
|
114
|
+
stats.matchingInFull++;
|
|
115
|
+
add(fullCounts, matches);
|
|
116
|
+
}
|
|
117
|
+
if (!sampled) {
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
const line = (0, QueryPatterns_1.tripleToLine)(subject, predicate, object);
|
|
121
|
+
if (matches.length > 0) {
|
|
122
|
+
lines.add(line);
|
|
123
|
+
stats.matching++;
|
|
124
|
+
add(sampleCounts, matches);
|
|
125
|
+
}
|
|
126
|
+
else if ((0, QueryPatterns_1.keep)(this.options.seed, this.options.otherTriplesRate, 'other', line)) {
|
|
127
|
+
lines.add(line);
|
|
128
|
+
stats.other++;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// Add the lineage triples that were not sampled.
|
|
133
|
+
const parser = new n3_1.Parser({ format: 'N-Triples' });
|
|
134
|
+
const lineageFiles = (await fs.readdir(this.options.lineageDirectory)).filter(file => file.endsWith(`.${ds}.nt`));
|
|
135
|
+
for (const file of lineageFiles.sort()) {
|
|
136
|
+
const contents = await fs.readFile(Path.join(this.options.lineageDirectory, file), 'utf8');
|
|
137
|
+
for (const line of contents.split('\n').filter(text => text.length > 0).map(text => `${text}\n`)) {
|
|
138
|
+
if (!lines.has(line)) {
|
|
139
|
+
lines.add(line);
|
|
140
|
+
stats.lineage++;
|
|
141
|
+
const [quad] = parser.parse(line);
|
|
142
|
+
add(sampleCounts, matcher.match((0, rdf_string_ttl_1.termToString)(quad.subject), (0, rdf_string_ttl_1.termToString)(quad.predicate), quad.object));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// Add a witness for each pattern that matches the full dataset but nothing in the sample.
|
|
147
|
+
for (const pattern of matcher.patterns) {
|
|
148
|
+
if (fullCounts[pattern.index][ds] > 0 && !(sampleCounts[pattern.index][ds] > 0)) {
|
|
149
|
+
const [subject, predicate, object] = pattern.terms;
|
|
150
|
+
const { triples: [quad] } = await document.searchTriples(subject, predicate, object, { limit: 1 });
|
|
151
|
+
lines.add((0, QueryPatterns_1.tripleToLine)(quad.subject, quad.predicate, quad.object));
|
|
152
|
+
stats.witnesses++;
|
|
153
|
+
add(sampleCounts, matcher.match((0, rdf_string_ttl_1.termToString)(quad.subject), (0, rdf_string_ttl_1.termToString)(quad.predicate), quad.object));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
const file = Path.join(this.options.outputDirectory, `${ds}.nt`);
|
|
157
|
+
const sorted = [...lines].sort();
|
|
158
|
+
await fs.writeFile(file, sorted.join(''), 'utf8');
|
|
159
|
+
return Object.assign(Object.assign({}, stats), { sampleTriples: sorted.length, sha256: (0, node_crypto_1.createHash)('sha256').update(await fs.readFile(file)).digest('hex') });
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
exports.DatasetSampler = DatasetSampler;
|
|
163
|
+
DatasetSampler.PAGE_SIZE = 500000;
|
|
164
|
+
//# sourceMappingURL=DatasetSampler.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IExperimentPaths } from 'jbr';
|
|
2
|
+
import { ExperimentHandler } from 'jbr';
|
|
3
|
+
import { ExperimentLargeRdfBench } from './ExperimentLargeRdfBench';
|
|
4
|
+
/**
|
|
5
|
+
* An experiment handler for LargeRDFBench.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ExperimentHandlerLargeRdfBench extends ExperimentHandler<ExperimentLargeRdfBench> {
|
|
8
|
+
constructor();
|
|
9
|
+
getDefaultParams(_experimentPaths: IExperimentPaths): Record<string, any>;
|
|
10
|
+
getHookNames(): string[];
|
|
11
|
+
init(_experimentPaths: IExperimentPaths, _experiment: ExperimentLargeRdfBench): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExperimentHandlerLargeRdfBench = void 0;
|
|
4
|
+
const jbr_1 = require("jbr");
|
|
5
|
+
const ExperimentLargeRdfBench_1 = require("./ExperimentLargeRdfBench");
|
|
6
|
+
/**
|
|
7
|
+
* An experiment handler for LargeRDFBench.
|
|
8
|
+
*/
|
|
9
|
+
class ExperimentHandlerLargeRdfBench extends jbr_1.ExperimentHandler {
|
|
10
|
+
constructor() {
|
|
11
|
+
super('largerdfbench', ExperimentLargeRdfBench_1.ExperimentLargeRdfBench.name);
|
|
12
|
+
}
|
|
13
|
+
getDefaultParams(_experimentPaths) {
|
|
14
|
+
return {
|
|
15
|
+
zenodoRecord: '22140177',
|
|
16
|
+
datasets: ExperimentLargeRdfBench_1.ExperimentLargeRdfBench.FEDBENCH_DATASETS,
|
|
17
|
+
queries: ExperimentLargeRdfBench_1.ExperimentLargeRdfBench.FEDBENCH_QUERIES,
|
|
18
|
+
sample: false,
|
|
19
|
+
sampleSubjectRates: {
|
|
20
|
+
'DBPedia-Subset': 0.02,
|
|
21
|
+
GeoNames: 0.02,
|
|
22
|
+
LMDB: 0.25,
|
|
23
|
+
},
|
|
24
|
+
sampleOtherTriplesRate: 0.2,
|
|
25
|
+
sampleSeed: 'largerdfbench-sample-v1',
|
|
26
|
+
sampleValidate: true,
|
|
27
|
+
generationQueryTimeout: 1800,
|
|
28
|
+
endpointUrl: 'http://localhost:3001/sparql',
|
|
29
|
+
endpointUrlExternal: 'http://localhost:3001/sparql',
|
|
30
|
+
sourceUrlsExternal: [],
|
|
31
|
+
queryRunnerReplication: 3,
|
|
32
|
+
queryRunnerWarmupRounds: 1,
|
|
33
|
+
queryRunnerRequestDelay: 0,
|
|
34
|
+
queryRunnerEndpointAvailabilityCheckTimeout: 1000,
|
|
35
|
+
queryRunnerUrlParams: {},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
getHookNames() {
|
|
39
|
+
return ['hookSparqlEndpoint', 'hookSparqlEndpointSources'];
|
|
40
|
+
}
|
|
41
|
+
async init(_experimentPaths, _experiment) {
|
|
42
|
+
// Do nothing
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.ExperimentHandlerLargeRdfBench = ExperimentHandlerLargeRdfBench;
|
|
46
|
+
//# sourceMappingURL=ExperimentHandlerLargeRdfBench.js.map
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { HttpAvailabilityLatch } from 'jbr';
|
|
2
|
+
import type { Experiment, Hook, ICleanTargets, ITaskContext, IRunTaskContext } from 'jbr';
|
|
3
|
+
import { RdfStore } from 'rdf-stores';
|
|
4
|
+
import type { IHdtDocumentLike, ILimitCandidates, IQueryEngineLike, ISparqlJsonResults } from './LineageComputer';
|
|
5
|
+
/**
|
|
6
|
+
* The paths of the generated files.
|
|
7
|
+
*/
|
|
8
|
+
export interface ILargeRdfBenchPaths {
|
|
9
|
+
generated: string;
|
|
10
|
+
zenodoHdt: string;
|
|
11
|
+
zenodoQueries: string;
|
|
12
|
+
zenodoResults: string;
|
|
13
|
+
lineage: string;
|
|
14
|
+
datasets: string;
|
|
15
|
+
queries: string;
|
|
16
|
+
results: string;
|
|
17
|
+
manifest: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* An experiment instance for LargeRDFBench, a benchmark for SPARQL endpoint federation,
|
|
21
|
+
* using either its full datasets, or a sample of them over which the queries produce the same results.
|
|
22
|
+
*/
|
|
23
|
+
export declare class ExperimentLargeRdfBench implements Experiment {
|
|
24
|
+
static readonly TEMPLATES_PATH: string;
|
|
25
|
+
/**
|
|
26
|
+
* The 9 datasets that originate from FedBench.
|
|
27
|
+
*/
|
|
28
|
+
static readonly FEDBENCH_DATASETS: string[];
|
|
29
|
+
/**
|
|
30
|
+
* The 23 queries that only use the FedBench datasets.
|
|
31
|
+
*/
|
|
32
|
+
static readonly FEDBENCH_QUERIES: string[];
|
|
33
|
+
/**
|
|
34
|
+
* Queries whose original form is too slow to generate a sample,
|
|
35
|
+
* mapped to an equivalent formulation in the templates directory.
|
|
36
|
+
*/
|
|
37
|
+
static readonly EQUIVALENT_QUERIES: Record<string, string>;
|
|
38
|
+
/**
|
|
39
|
+
* LIMIT queries whose full result is too expensive to compute, with candidate values for one of their variables.
|
|
40
|
+
*/
|
|
41
|
+
static readonly LIMIT_CANDIDATES: Record<string, ILimitCandidates>;
|
|
42
|
+
readonly httpAvailabilityLatch: HttpAvailabilityLatch;
|
|
43
|
+
readonly zenodoRecord: string;
|
|
44
|
+
readonly datasets: string[];
|
|
45
|
+
readonly queries: string[];
|
|
46
|
+
readonly sample: boolean;
|
|
47
|
+
readonly sampleSubjectRates: Record<string, number>;
|
|
48
|
+
readonly sampleOtherTriplesRate: number;
|
|
49
|
+
readonly sampleSeed: string;
|
|
50
|
+
readonly sampleValidate: boolean;
|
|
51
|
+
readonly generationQueryTimeout: number;
|
|
52
|
+
readonly hookSparqlEndpoint: Hook;
|
|
53
|
+
readonly hookSparqlEndpointSources: Hook[];
|
|
54
|
+
readonly endpointUrl: string;
|
|
55
|
+
readonly endpointUrlExternal: string;
|
|
56
|
+
readonly sourceUrlsExternal: string[];
|
|
57
|
+
readonly queryRunnerReplication: number;
|
|
58
|
+
readonly queryRunnerWarmupRounds: number;
|
|
59
|
+
readonly queryRunnerRequestDelay: number;
|
|
60
|
+
readonly queryRunnerEndpointAvailabilityCheckTimeout: number;
|
|
61
|
+
readonly queryRunnerUrlParams: Record<string, any>;
|
|
62
|
+
readonly queryTimeoutFallback: number | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* @param zenodoRecord - The Zenodo record of the LargeRDFBench Interoperable Edition to download from.
|
|
65
|
+
* @param datasets - The datasets to include, by their name in the Zenodo record.
|
|
66
|
+
* @param queries - The queries to include, by their name in the Zenodo record.
|
|
67
|
+
* @param sample - If the datasets must be sampled. Otherwise, the full datasets are used, as HDT files.
|
|
68
|
+
* @param sampleSubjectRates - The fraction of subjects to sample per dataset, which defaults to 1. @range {json}
|
|
69
|
+
* @param sampleOtherTriplesRate - The fraction of the triples of sampled subjects that match no query pattern to
|
|
70
|
+
* keep. @range {double}
|
|
71
|
+
* @param sampleSeed - The seed for sampling.
|
|
72
|
+
* @param sampleValidate - If the queries must be validated to produce the same results over the sample as over the
|
|
73
|
+
* full data.
|
|
74
|
+
* @param generationQueryTimeout - The timeout in seconds of the queries over the full data during sampling.
|
|
75
|
+
* @param hookSparqlEndpoint - The SPARQL endpoint of the federation engine that is benchmarked.
|
|
76
|
+
* @param hookSparqlEndpointSources - The SPARQL endpoints of the datasets, which are started one by one.
|
|
77
|
+
* @param endpointUrl - The URL of the SPARQL endpoint of the federation engine.
|
|
78
|
+
* @param endpointUrlExternal - The URL to check if the SPARQL endpoint of the federation engine is available.
|
|
79
|
+
* @param sourceUrlsExternal - The URLs to check if each source is available before starting the next one.
|
|
80
|
+
* @param queryRunnerReplication - The number of replication runs.
|
|
81
|
+
* @param queryRunnerWarmupRounds - The number of warmup runs.
|
|
82
|
+
* @param queryRunnerRequestDelay - The delay between requests in milliseconds.
|
|
83
|
+
* @param queryRunnerEndpointAvailabilityCheckTimeout - The timeout of the availability check in milliseconds.
|
|
84
|
+
* @param queryRunnerUrlParams - URL parameters to pass to the SPARQL endpoint. @range {json}
|
|
85
|
+
* @param queryTimeoutFallback - A timeout in milliseconds for a single query, as fallback for the endpoint's timeout.
|
|
86
|
+
*/
|
|
87
|
+
constructor(zenodoRecord: string, datasets: string[], queries: string[], sample: boolean, sampleSubjectRates: Record<string, number>, sampleOtherTriplesRate: number, sampleSeed: string, sampleValidate: boolean, generationQueryTimeout: number, hookSparqlEndpoint: Hook, hookSparqlEndpointSources: Hook[], endpointUrl: string, endpointUrlExternal: string | undefined, sourceUrlsExternal: string[] | undefined, queryRunnerReplication: number, queryRunnerWarmupRounds: number, queryRunnerRequestDelay: number, queryRunnerEndpointAvailabilityCheckTimeout: number, queryRunnerUrlParams: Record<string, any>, queryTimeoutFallback: number | undefined);
|
|
88
|
+
/**
|
|
89
|
+
* The paths of the generated files.
|
|
90
|
+
* @param generated The generated directory.
|
|
91
|
+
*/
|
|
92
|
+
static getPaths(generated: string): ILargeRdfBenchPaths;
|
|
93
|
+
/**
|
|
94
|
+
* The path of a dataset that the sources serve: an N-Triples file for a sample, or an HDT file for the full data.
|
|
95
|
+
* @param paths The paths of the generated files.
|
|
96
|
+
* @param dataset A dataset name.
|
|
97
|
+
*/
|
|
98
|
+
getDatasetPath(paths: ILargeRdfBenchPaths, dataset: string): string;
|
|
99
|
+
prepare(context: ITaskContext, forceOverwriteGenerated: boolean): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Check if all generated files that are needed to run the experiment exist.
|
|
102
|
+
* @param paths The paths of the generated files.
|
|
103
|
+
*/
|
|
104
|
+
isGenerated(paths: ILargeRdfBenchPaths): Promise<boolean>;
|
|
105
|
+
/**
|
|
106
|
+
* Read the downloaded queries.
|
|
107
|
+
* @param paths The paths of the generated files.
|
|
108
|
+
*/
|
|
109
|
+
readQueries(paths: ILargeRdfBenchPaths): Promise<Record<string, string>>;
|
|
110
|
+
/**
|
|
111
|
+
* Read the downloaded published results, preferring their corrected (complete) versions.
|
|
112
|
+
* @param paths The paths of the generated files.
|
|
113
|
+
*/
|
|
114
|
+
readPublishedResults(paths: ILargeRdfBenchPaths): Promise<Record<string, ISparqlJsonResults>>;
|
|
115
|
+
/**
|
|
116
|
+
* Write the published results as expected results.
|
|
117
|
+
* @param paths The paths of the generated files.
|
|
118
|
+
* @param publishedResults The published results.
|
|
119
|
+
*/
|
|
120
|
+
writePublishedResults(paths: ILargeRdfBenchPaths, publishedResults: Record<string, ISparqlJsonResults>): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Read the equivalent formulations of the queries that have one.
|
|
123
|
+
*/
|
|
124
|
+
readEquivalentQueries(): Promise<Record<string, string>>;
|
|
125
|
+
/**
|
|
126
|
+
* Generate the sampled datasets, the expected results, and the manifest.
|
|
127
|
+
* @param context The task context.
|
|
128
|
+
* @param paths The paths of the generated files.
|
|
129
|
+
* @param queries The queries.
|
|
130
|
+
* @param publishedResults The published results.
|
|
131
|
+
*/
|
|
132
|
+
generateSample(context: ITaskContext, paths: ILargeRdfBenchPaths, queries: Record<string, string>, publishedResults: Record<string, ISparqlJsonResults>): Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* Load the modules that are needed to generate a sample.
|
|
135
|
+
*/
|
|
136
|
+
static loadGenerationModules(): Promise<{
|
|
137
|
+
hdt: {
|
|
138
|
+
fromFile: (path: string) => Promise<IHdtDocumentLike & {
|
|
139
|
+
close: () => Promise<void>;
|
|
140
|
+
}>;
|
|
141
|
+
};
|
|
142
|
+
QueryEngineHdt: new () => IQueryEngineLike;
|
|
143
|
+
QueryEngineRdfJs: new () => IQueryEngineLike;
|
|
144
|
+
}>;
|
|
145
|
+
/**
|
|
146
|
+
* Load each sampled dataset into its own store, so that, as in a federation, matches in multiple datasets are not
|
|
147
|
+
* merged.
|
|
148
|
+
* @param paths The paths of the generated files.
|
|
149
|
+
*/
|
|
150
|
+
loadSampleStores(paths: ILargeRdfBenchPaths): Promise<RdfStore[]>;
|
|
151
|
+
/**
|
|
152
|
+
* Write the manifest, which describes how the generated files were obtained.
|
|
153
|
+
* @param paths The paths of the generated files.
|
|
154
|
+
* @param details Details on the sample.
|
|
155
|
+
*/
|
|
156
|
+
writeManifest(paths: ILargeRdfBenchPaths, details: Record<string, any>): Promise<void>;
|
|
157
|
+
run(context: IRunTaskContext): Promise<void>;
|
|
158
|
+
clean(context: ITaskContext, cleanTargets: ICleanTargets): Promise<void>;
|
|
159
|
+
}
|