hdt 3.1.1 → 3.2.1
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/README.md +31 -0
- package/deps/hdt-it/.cproject +42 -0
- package/deps/hdt-it/.project +27 -0
- package/deps/hdt-it/Camera.cpp +249 -0
- package/deps/hdt-it/Camera.h +77 -0
- package/deps/hdt-it/Color.cpp +157 -0
- package/deps/hdt-it/Color.h +49 -0
- package/deps/hdt-it/Info.plist +58 -0
- package/deps/hdt-it/StopWatch.cpp +170 -0
- package/deps/hdt-it/StopWatch.hpp +61 -0
- package/deps/hdt-it/abouthdt.cpp +14 -0
- package/deps/hdt-it/abouthdt.hpp +22 -0
- package/deps/hdt-it/abouthdt.ui +173 -0
- package/deps/hdt-it/colors.hpp +29 -0
- package/deps/hdt-it/constants.h +39 -0
- package/deps/hdt-it/createdmg.sh +72 -0
- package/deps/hdt-it/dictionarysuggestions.cpp +186 -0
- package/deps/hdt-it/dictionarysuggestions.hpp +39 -0
- package/deps/hdt-it/doc/hdtit.png +0 -0
- package/deps/hdt-it/doc/manual.html +88 -0
- package/deps/hdt-it/doc/matrix.png +0 -0
- package/deps/hdt-it/editreset.png +0 -0
- package/deps/hdt-it/hdt-it.pro +135 -0
- package/deps/hdt-it/hdt-it_es.qm +0 -0
- package/deps/hdt-it/hdt-it_es.ts +906 -0
- package/deps/hdt-it/hdtcachedinfo.cpp +155 -0
- package/deps/hdt-it/hdtcachedinfo.hpp +38 -0
- package/deps/hdt-it/hdtcontroller.cpp +369 -0
- package/deps/hdt-it/hdtcontroller.hpp +103 -0
- package/deps/hdt-it/hdtico.icns +0 -0
- package/deps/hdt-it/hdtico.rc +1 -0
- package/deps/hdt-it/hdtit.cpp +400 -0
- package/deps/hdt-it/hdtit.hpp +78 -0
- package/deps/hdt-it/hdtit.ui +875 -0
- package/deps/hdt-it/hdtoperation.cpp +284 -0
- package/deps/hdt-it/hdtoperation.hpp +71 -0
- package/deps/hdt-it/hdtresources.qrc +7 -0
- package/deps/hdt-it/hdtspecform.cpp +180 -0
- package/deps/hdt-it/hdtspecform.hpp +38 -0
- package/deps/hdt-it/hdtspecform.ui +361 -0
- package/deps/hdt-it/hdtsummarygenerator.cpp +109 -0
- package/deps/hdt-it/hdtsummarygenerator.hpp +15 -0
- package/deps/hdt-it/hdtwinico.ico +0 -0
- package/deps/hdt-it/hdtwinico2.ico +0 -0
- package/deps/hdt-it/headermodel.cpp +174 -0
- package/deps/hdt-it/headermodel.hpp +38 -0
- package/deps/hdt-it/loading.gif +0 -0
- package/deps/hdt-it/logo-hdt.png +0 -0
- package/deps/hdt-it/logo-hdt2.png +0 -0
- package/deps/hdt-it/main.cpp +39 -0
- package/deps/hdt-it/matrixviewwidget.cpp +501 -0
- package/deps/hdt-it/matrixviewwidget.hpp +81 -0
- package/deps/hdt-it/myapplication.cpp +45 -0
- package/deps/hdt-it/myapplication.hpp +24 -0
- package/deps/hdt-it/predicatestatus.cpp +97 -0
- package/deps/hdt-it/predicatestatus.hpp +39 -0
- package/deps/hdt-it/qclearlineedit.cpp +48 -0
- package/deps/hdt-it/qclearlineedit.hpp +30 -0
- package/deps/hdt-it/regexmodel.cpp +132 -0
- package/deps/hdt-it/regexmodel.hpp +37 -0
- package/deps/hdt-it/resultcounter.cpp +47 -0
- package/deps/hdt-it/resultcounter.hpp +30 -0
- package/deps/hdt-it/searchresultsmodel.cpp +179 -0
- package/deps/hdt-it/searchresultsmodel.hpp +39 -0
- package/deps/hdt-it/sparqlform.cpp +27 -0
- package/deps/hdt-it/sparqlform.hpp +28 -0
- package/deps/hdt-it/sparqlform.ui +112 -0
- package/deps/hdt-it/sparqlmodel.cpp +155 -0
- package/deps/hdt-it/sparqlmodel.hpp +32 -0
- package/deps/hdt-it/stringutils.cpp +48 -0
- package/deps/hdt-it/stringutils.hpp +18 -0
- package/deps/hdt-it/triplecomponentmodel.cpp +146 -0
- package/deps/hdt-it/triplecomponentmodel.hpp +33 -0
- package/deps/libcds/Doxyfile +307 -0
- package/deps/libcds/tutorial/tutorial.pdf +0 -0
- package/deps/libhdt/.cproject +304 -0
- package/deps/libhdt/Doxyfile +1630 -0
- package/deps/libhdt/src/util/StopWatch.cpp +1 -1
- package/lib/HdtDocument.cc +140 -0
- package/lib/HdtDocument.h +4 -0
- package/lib/hdt.js +79 -0
- package/package.json +12 -3
- package/.eslintrc +0 -178
- package/.github/workflows/ci.yml +0 -72
- package/.gitmodules +0 -4
- package/.jshintignore +0 -1
- package/.jshintrc +0 -10
- package/deps/libcds/README +0 -12
|
@@ -163,7 +163,7 @@ std::ostream &operator<<(std::ostream &stream, StopWatch &sw) {
|
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
std::string StopWatch::toHuman(unsigned long long time) {
|
|
166
|
-
|
|
166
|
+
unsigned long long tot_secs = time/1000000;
|
|
167
167
|
|
|
168
168
|
unsigned int hours = tot_secs/3600;
|
|
169
169
|
unsigned int mins = (tot_secs/60) % 60;
|
package/lib/HdtDocument.cc
CHANGED
|
@@ -55,6 +55,7 @@ const Nan::Persistent<Function>& HdtDocument::GetConstructor() {
|
|
|
55
55
|
constructorTemplate->InstanceTemplate()->SetInternalFieldCount(1);
|
|
56
56
|
// Create prototype
|
|
57
57
|
Nan::SetPrototypeMethod(constructorTemplate, "_searchTriples", SearchTriples);
|
|
58
|
+
Nan::SetPrototypeMethod(constructorTemplate, "_searchBindings", SearchBindings);
|
|
58
59
|
Nan::SetPrototypeMethod(constructorTemplate, "_searchLiterals", SearchLiterals);
|
|
59
60
|
Nan::SetPrototypeMethod(constructorTemplate, "_searchTerms", SearchTerms);
|
|
60
61
|
Nan::SetPrototypeMethod(constructorTemplate, "_fetchDistinctTerms", FetchDistinctTerms);
|
|
@@ -234,6 +235,141 @@ NAN_METHOD(HdtDocument::SearchTriples) {
|
|
|
234
235
|
new Nan::Callback(info[5].As<Function>()), info.This()));
|
|
235
236
|
}
|
|
236
237
|
|
|
238
|
+
/******** HdtDocument#_searchBindings ********/
|
|
239
|
+
|
|
240
|
+
class SearchBindingsWorker : public Nan::AsyncWorker {
|
|
241
|
+
HdtDocument* document;
|
|
242
|
+
// JavaScript function arguments
|
|
243
|
+
string subject, predicate, object;
|
|
244
|
+
uint32_t offset, limit;
|
|
245
|
+
// Callback return values
|
|
246
|
+
vector<TripleID> triples;
|
|
247
|
+
map<unsigned int, string> subjects, predicates, objects;
|
|
248
|
+
uint32_t totalCount;
|
|
249
|
+
bool hasExactCount;
|
|
250
|
+
bool varS, varP, varO;
|
|
251
|
+
|
|
252
|
+
public:
|
|
253
|
+
SearchBindingsWorker(HdtDocument* document, char* subject, char* predicate, char* object,
|
|
254
|
+
uint32_t offset, uint32_t limit, Nan::Callback* callback, Local<Object> self)
|
|
255
|
+
: Nan::AsyncWorker(callback),
|
|
256
|
+
document(document), subject(subject), predicate(predicate), object(object),
|
|
257
|
+
offset(offset), limit(limit), totalCount(0) {
|
|
258
|
+
SaveToPersistent(SELF, self);
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
void Execute() {
|
|
262
|
+
IteratorTripleID* it = NULL;
|
|
263
|
+
try {
|
|
264
|
+
// Determine which terms are variables
|
|
265
|
+
varS = isVariable(subject);
|
|
266
|
+
varP = isVariable(predicate);
|
|
267
|
+
varO = isVariable(object);
|
|
268
|
+
|
|
269
|
+
// Prepare the triple pattern
|
|
270
|
+
Dictionary* dict = document->GetHDT()->getDictionary();
|
|
271
|
+
TripleString triple(varS ? "" : subject, varP ? "" : predicate, varO ? "" : toHdtLiteral(object));
|
|
272
|
+
TripleID tripleId;
|
|
273
|
+
dict->tripleStringtoTripleID(triple, tripleId);
|
|
274
|
+
// If any of the components does not exist, there are no matches
|
|
275
|
+
if ((!varS && subject[0] && !tripleId.getSubject()) ||
|
|
276
|
+
(!varP && predicate[0] && !tripleId.getPredicate()) ||
|
|
277
|
+
(!varO && object[0] && !tripleId.getObject())) {
|
|
278
|
+
hasExactCount = true;
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// Estimate the total number of triples
|
|
283
|
+
it = document->GetHDT()->getTriples()->search(tripleId);
|
|
284
|
+
totalCount = it->estimatedNumResults();
|
|
285
|
+
hasExactCount = it->numResultEstimation() == EXACT;
|
|
286
|
+
|
|
287
|
+
// Go to the right offset
|
|
288
|
+
if (it->canGoTo())
|
|
289
|
+
try { it->skip(offset), offset = 0; }
|
|
290
|
+
catch (const runtime_error error) { /* invalid offset */ }
|
|
291
|
+
else
|
|
292
|
+
while (offset && it->hasNext()) it->next(), offset--;
|
|
293
|
+
|
|
294
|
+
// Add matching triples to the result vector
|
|
295
|
+
if (!offset) {
|
|
296
|
+
while (it->hasNext() && triples.size() < limit) {
|
|
297
|
+
TripleID& triple = *it->next();
|
|
298
|
+
triples.push_back(triple);
|
|
299
|
+
if (varS && !subjects.count(triple.getSubject())) {
|
|
300
|
+
subjects[triple.getSubject()] = dict->idToString(triple.getSubject(), SUBJECT);
|
|
301
|
+
}
|
|
302
|
+
if (varP && !predicates.count(triple.getPredicate())) {
|
|
303
|
+
predicates[triple.getPredicate()] = dict->idToString(triple.getPredicate(), PREDICATE);
|
|
304
|
+
}
|
|
305
|
+
if (varO && !objects.count(triple.getObject())) {
|
|
306
|
+
string object(dict->idToString(triple.getObject(), OBJECT));
|
|
307
|
+
objects[triple.getObject()] = fromHdtLiteral(object);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
catch (const runtime_error error) { SetErrorMessage(error.what()); }
|
|
313
|
+
if (it)
|
|
314
|
+
delete it;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
void HandleOKCallback() {
|
|
318
|
+
Nan::HandleScope scope;
|
|
319
|
+
// Convert the triple components into strings
|
|
320
|
+
map<unsigned int, string>::const_iterator it;
|
|
321
|
+
map<unsigned int, Local<String> > subjectStrings, predicateStrings, objectStrings;
|
|
322
|
+
for (it = subjects.begin(); it != subjects.end(); it++)
|
|
323
|
+
subjectStrings[it->first] = Nan::New(it->second.c_str()).ToLocalChecked();
|
|
324
|
+
for (it = predicates.begin(); it != predicates.end(); it++)
|
|
325
|
+
predicateStrings[it->first] = Nan::New(it->second.c_str()).ToLocalChecked();
|
|
326
|
+
for (it = objects.begin(); it != objects.end(); it++)
|
|
327
|
+
objectStrings[it->first] = Nan::New(it->second.c_str()).ToLocalChecked();
|
|
328
|
+
|
|
329
|
+
// Convert the triples into a double JavaScript array
|
|
330
|
+
uint32_t count = 0;
|
|
331
|
+
Local<Array> bindingsArray = Nan::New<Array>(triples.size());
|
|
332
|
+
uint32_t variables = (varS ? 1 : 0) + (varP ? 1 : 0) + (varO ? 1 : 0);
|
|
333
|
+
for (vector<TripleID>::const_iterator it = triples.begin(); it != triples.end(); it++) {
|
|
334
|
+
uint32_t countInner = 0;
|
|
335
|
+
Local<Object> bindingsArrayInner = Nan::New<Array>(variables);
|
|
336
|
+
if (varS) {
|
|
337
|
+
Nan::Set(bindingsArrayInner, countInner++, subjectStrings[it->getSubject()]);
|
|
338
|
+
}
|
|
339
|
+
if (varP) {
|
|
340
|
+
Nan::Set(bindingsArrayInner, countInner++, predicateStrings[it->getPredicate()]);
|
|
341
|
+
}
|
|
342
|
+
if (varO) {
|
|
343
|
+
Nan::Set(bindingsArrayInner, countInner++, objectStrings[it->getObject()]);
|
|
344
|
+
}
|
|
345
|
+
Nan::Set(bindingsArray, count++, bindingsArrayInner);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// Send the JavaScript array through the callback
|
|
349
|
+
const unsigned argc = 4;
|
|
350
|
+
Local<Value> argv[argc] = { Nan::Null(), bindingsArray,
|
|
351
|
+
Nan::New<Integer>((uint32_t)totalCount),
|
|
352
|
+
Nan::New<Boolean>((bool)hasExactCount) };
|
|
353
|
+
callback->Call(Nan::To<v8::Object>(GetFromPersistent(SELF)).ToLocalChecked(), argc, argv, async_resource);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
void HandleErrorCallback() {
|
|
357
|
+
Nan::HandleScope scope;
|
|
358
|
+
Local<Value> argv[] = { Exception::Error(Nan::New(ErrorMessage()).ToLocalChecked()) };
|
|
359
|
+
callback->Call(Nan::To<v8::Object>(GetFromPersistent(SELF)).ToLocalChecked(), 1, argv, async_resource);
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
// Searches for a triple pattern in the document and return bindings.
|
|
364
|
+
// JavaScript signature: HdtDocument#_searchBindings(subject, predicate, object, offset, limit, callback)
|
|
365
|
+
NAN_METHOD(HdtDocument::SearchBindings) {
|
|
366
|
+
assert(info.Length() == 6);
|
|
367
|
+
Nan::AsyncQueueWorker(new SearchBindingsWorker(Unwrap<HdtDocument>(info.This()),
|
|
368
|
+
*Nan::Utf8String(info[0]), *Nan::Utf8String(info[1]), *Nan::Utf8String(info[2]),
|
|
369
|
+
Nan::To<uint32_t>(info[3]).FromJust(), Nan::To<uint32_t>(info[4]).FromJust(),
|
|
370
|
+
new Nan::Callback(info[5].As<Function>()), info.This()));
|
|
371
|
+
}
|
|
372
|
+
|
|
237
373
|
|
|
238
374
|
|
|
239
375
|
/******** HdtDocument#_searchLiterals ********/
|
|
@@ -612,6 +748,10 @@ NAN_PROPERTY_GETTER(HdtDocument::Closed) {
|
|
|
612
748
|
// "literal"^^<http://example.org/datatype>
|
|
613
749
|
// The functions below convert when needed.
|
|
614
750
|
|
|
751
|
+
// Check if a term is a variable
|
|
752
|
+
bool isVariable(string& term) {
|
|
753
|
+
return term[0] == '?';
|
|
754
|
+
}
|
|
615
755
|
|
|
616
756
|
// Converts a JavaScript literal to an HDT literal
|
|
617
757
|
string& toHdtLiteral(string& literal) {
|
package/lib/HdtDocument.h
CHANGED
|
@@ -32,6 +32,8 @@ class HdtDocument : public node::ObjectWrap {
|
|
|
32
32
|
|
|
33
33
|
// HdtDocument#_searchTriples(subject, predicate, object, offset, limit, callback, self)
|
|
34
34
|
static NAN_METHOD(SearchTriples);
|
|
35
|
+
// HdtDocument#_searchBindings(subject, predicate, object, offset, limit, callback, self)
|
|
36
|
+
static NAN_METHOD(SearchBindings);
|
|
35
37
|
// HdtDocument#_searchLiterals(substring, offset, limit, callback, self)
|
|
36
38
|
static NAN_METHOD(SearchLiterals);
|
|
37
39
|
// HdtDocument#_searchTerms(prefix, limit, position, callback)
|
|
@@ -50,6 +52,8 @@ class HdtDocument : public node::ObjectWrap {
|
|
|
50
52
|
static NAN_PROPERTY_GETTER(Closed);
|
|
51
53
|
};
|
|
52
54
|
|
|
55
|
+
// Check if a term is a variable
|
|
56
|
+
bool isVariable(string& term);
|
|
53
57
|
// Converts a JavaScript literal to an HDT literal
|
|
54
58
|
std::string& toHdtLiteral(std::string& literal);
|
|
55
59
|
// Converts an HDT literal to a JavaScript literal
|
package/lib/hdt.js
CHANGED
|
@@ -13,6 +13,10 @@ function isValidHdtTerm(term) {
|
|
|
13
13
|
return term && term.termType && (term.termType === 'Literal' || term.termType === 'BlankNode' || term.termType === 'NamedNode');
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
function isValidHdtTermForSearchBindings(term) {
|
|
17
|
+
return isValidHdtTerm(term) || (term && term.termType === 'Variable');
|
|
18
|
+
}
|
|
19
|
+
|
|
16
20
|
// Searches the document for triples with the given subject, predicate, and object.
|
|
17
21
|
HdtDocumentPrototype.searchTriples = function (subject, predicate, object, options) {
|
|
18
22
|
if (this.closed) return closedError;
|
|
@@ -29,6 +33,80 @@ HdtDocumentPrototype.searchTriples = function (subject, predicate, object, optio
|
|
|
29
33
|
});
|
|
30
34
|
};
|
|
31
35
|
|
|
36
|
+
// Searches the document for triples with the given subject, predicate, and object, and return them as bindings
|
|
37
|
+
HdtDocumentPrototype.searchBindings = function (bindingsFactory, subject, predicate, object, options) {
|
|
38
|
+
if (this.closed) return closedError;
|
|
39
|
+
if (!isValidHdtTermForSearchBindings(subject) || !isValidHdtTermForSearchBindings(predicate) || !isValidHdtTermForSearchBindings(object)) throw new Error('Passed invalid subject term');
|
|
40
|
+
options = options || {};
|
|
41
|
+
return new Promise((resolve, reject) => {
|
|
42
|
+
// Collect variable terms
|
|
43
|
+
const variables = [];
|
|
44
|
+
if (subject.termType === 'Variable') variables.push(subject);
|
|
45
|
+
if (predicate.termType === 'Variable') variables.push(predicate);
|
|
46
|
+
if (object.termType === 'Variable') variables.push(object);
|
|
47
|
+
|
|
48
|
+
// Check if we need to do post-filtering for overlapping variables
|
|
49
|
+
let shouldFilterIndexes = false;
|
|
50
|
+
const filterIndexes = variables.map((variable, i) => {
|
|
51
|
+
const equalVariables = [];
|
|
52
|
+
for (let j = i + 1; j < variables.length; j++) {
|
|
53
|
+
if (variable.equals(variables[j])) {
|
|
54
|
+
equalVariables.push(j);
|
|
55
|
+
shouldFilterIndexes = true;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return equalVariables;
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// If we have offset and limit with overlapping variables, they must be handled in JS-land.
|
|
62
|
+
const offset = parseOffset(options);
|
|
63
|
+
const limit = parseLimit(options);
|
|
64
|
+
|
|
65
|
+
this._searchBindings(termToString(subject), termToString(predicate), termToString(object),
|
|
66
|
+
shouldFilterIndexes ? 0 : offset, shouldFilterIndexes ? MAX : limit,
|
|
67
|
+
(err, bindingsRaw, totalCount, hasExactCount) => {
|
|
68
|
+
if (err)
|
|
69
|
+
return reject(err);
|
|
70
|
+
|
|
71
|
+
// If we had overlapping variables, potentially filter bindings
|
|
72
|
+
if (shouldFilterIndexes) {
|
|
73
|
+
// Filter bindings
|
|
74
|
+
bindingsRaw = bindingsRaw.filter(binding => {
|
|
75
|
+
for (let i = 0; i < binding.length; i++) {
|
|
76
|
+
const bindingEntry = binding[i];
|
|
77
|
+
const filterI = filterIndexes[i];
|
|
78
|
+
if (filterI) {
|
|
79
|
+
for (const j of filterI) {
|
|
80
|
+
if (j !== undefined && bindingEntry !== binding[j]) {
|
|
81
|
+
totalCount--;
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return true;
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// Apply offsets and limits in JS-land
|
|
91
|
+
if (offset > 0 || limit < MAX) {
|
|
92
|
+
hasExactCount = true;
|
|
93
|
+
totalCount = bindingsRaw.length;
|
|
94
|
+
bindingsRaw = bindingsRaw.slice(offset, offset + limit);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Create bindings objects
|
|
99
|
+
const bindings = bindingsRaw.map(b => bindingsFactory.bindings(b.map((value, i) => [variables[i], stringToTerm(value)])));
|
|
100
|
+
|
|
101
|
+
return resolve({
|
|
102
|
+
bindings,
|
|
103
|
+
totalCount,
|
|
104
|
+
hasExactCount,
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
|
|
32
110
|
// Gives an approximate number of matches of triples with the given subject, predicate, and object.
|
|
33
111
|
HdtDocumentPrototype.countTriples = function (subject, predicate, object) {
|
|
34
112
|
return this.search(subject, predicate, object, { offset: 0, limit: 0 });
|
|
@@ -152,6 +230,7 @@ module.exports = {
|
|
|
152
230
|
// Document the features of the HDT file
|
|
153
231
|
document.features = Object.freeze({
|
|
154
232
|
searchTriples: true, // supported by default
|
|
233
|
+
searchBindings: true, // supported by default
|
|
155
234
|
countTriples: true, // supported by default
|
|
156
235
|
searchLiterals: !!(document._features & 1),
|
|
157
236
|
readHeader: true, // supported by default
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hdt",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "Native bindings to access HDT compressed triple files.",
|
|
5
5
|
"author": "Ruben Verborgh <ruben.verborgh@gmail.com>",
|
|
6
6
|
"keywords": [
|
|
@@ -15,6 +15,12 @@
|
|
|
15
15
|
"main": "./lib/hdt",
|
|
16
16
|
"bin": "./bin/hdt",
|
|
17
17
|
"types": "./lib/hdt.d.ts",
|
|
18
|
+
"files": [
|
|
19
|
+
"bin",
|
|
20
|
+
"binding.gyp",
|
|
21
|
+
"deps",
|
|
22
|
+
"lib"
|
|
23
|
+
],
|
|
18
24
|
"repository": {
|
|
19
25
|
"type": "git",
|
|
20
26
|
"url": "https://github.com/RubenVerborgh/HDT-Node.git"
|
|
@@ -28,7 +34,8 @@
|
|
|
28
34
|
"scripts": {
|
|
29
35
|
"test": "rm test/*.hdt.index.* 2> /dev/null; mocha",
|
|
30
36
|
"lint": "eslint --fix lib/*.js test/*.js bin/*",
|
|
31
|
-
"validate": "npm ls"
|
|
37
|
+
"validate": "npm ls",
|
|
38
|
+
"preinstall": "if [ -e replace-in-file.json ]; then replace-in-file --configFile=replace-in-file.json; fi && node-gyp rebuild"
|
|
32
39
|
},
|
|
33
40
|
"dependencies": {
|
|
34
41
|
"minimist": "^1.1.0",
|
|
@@ -40,7 +47,9 @@
|
|
|
40
47
|
"eslint": "^5.3.0",
|
|
41
48
|
"mocha": "^6.2.2",
|
|
42
49
|
"precommit-hook": "^3.0.0",
|
|
43
|
-
"
|
|
50
|
+
"replace-in-file": "^8.3.0",
|
|
51
|
+
"should": "^13.1.0",
|
|
52
|
+
"@comunica/utils-bindings-factory": "^4.0.2"
|
|
44
53
|
},
|
|
45
54
|
"pre-commit": [
|
|
46
55
|
"lint",
|
package/.eslintrc
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
env: {
|
|
3
|
-
node: true,
|
|
4
|
-
},
|
|
5
|
-
parserOptions: {
|
|
6
|
-
ecmaVersion: 6
|
|
7
|
-
},
|
|
8
|
-
globals: {
|
|
9
|
-
Promise: true
|
|
10
|
-
},
|
|
11
|
-
rules: {
|
|
12
|
-
// Possible Errors
|
|
13
|
-
comma-dangle: [2, "always-multiline"],
|
|
14
|
-
no-cond-assign: 0,
|
|
15
|
-
no-console: 2,
|
|
16
|
-
no-constant-condition: 0,
|
|
17
|
-
no-debugger: 2,
|
|
18
|
-
no-dupe-args: 2,
|
|
19
|
-
no-dupe-keys: 2,
|
|
20
|
-
no-duplicate-case: 2,
|
|
21
|
-
no-empty: 2,
|
|
22
|
-
no-empty-character-class: 2,
|
|
23
|
-
no-ex-assign: 0,
|
|
24
|
-
no-extra-boolean-cast: 2,
|
|
25
|
-
no-extra-parens: 0,
|
|
26
|
-
no-extra-semi: 2,
|
|
27
|
-
no-func-assign: 2,
|
|
28
|
-
no-inner-declarations: 0,
|
|
29
|
-
no-invalid-regexp: 2,
|
|
30
|
-
no-irregular-whitespace: 2,
|
|
31
|
-
no-negated-in-lhs: 2,
|
|
32
|
-
no-obj-calls: 2,
|
|
33
|
-
no-regex-spaces: 2,
|
|
34
|
-
no-sparse-arrays: 2,
|
|
35
|
-
no-unreachable: 2,
|
|
36
|
-
use-isnan: 2,
|
|
37
|
-
valid-jsdoc: 0,
|
|
38
|
-
valid-typeof: 2,
|
|
39
|
-
no-unexpected-multiline: 2,
|
|
40
|
-
|
|
41
|
-
// Best Practices
|
|
42
|
-
accessor-pairs: 2,
|
|
43
|
-
block-scoped-var: 2,
|
|
44
|
-
complexity: 0,
|
|
45
|
-
consistent-return: 0,
|
|
46
|
-
curly: [2, "multi-or-nest"],
|
|
47
|
-
default-case: 0,
|
|
48
|
-
dot-notation: 2,
|
|
49
|
-
dot-location: [2, "property"],
|
|
50
|
-
eqeqeq: 2,
|
|
51
|
-
guard-for-in: 0,
|
|
52
|
-
no-alert: 2,
|
|
53
|
-
no-caller: 2,
|
|
54
|
-
no-div-regex: 2,
|
|
55
|
-
no-else-return: 0,
|
|
56
|
-
no-labels: 2,
|
|
57
|
-
no-eq-null: 2,
|
|
58
|
-
no-eval: 2,
|
|
59
|
-
no-extend-native: 2,
|
|
60
|
-
no-extra-bind: 2,
|
|
61
|
-
no-fallthrough: 2,
|
|
62
|
-
no-floating-decimal: 2,
|
|
63
|
-
no-implicit-coercion: 0,
|
|
64
|
-
no-implied-eval: 2,
|
|
65
|
-
no-invalid-this: 2,
|
|
66
|
-
no-iterator: 2,
|
|
67
|
-
no-lone-blocks: 2,
|
|
68
|
-
no-loop-func: 0,
|
|
69
|
-
no-multi-spaces: 0,
|
|
70
|
-
no-multi-str: 2,
|
|
71
|
-
no-native-reassign: 2,
|
|
72
|
-
no-new-func: 2,
|
|
73
|
-
no-new-wrappers: 2,
|
|
74
|
-
no-new: 2,
|
|
75
|
-
no-octal-escape: 2,
|
|
76
|
-
no-octal: 2,
|
|
77
|
-
no-param-reassign: 0,
|
|
78
|
-
no-process-env: 2,
|
|
79
|
-
no-proto: 2,
|
|
80
|
-
no-redeclare: 2,
|
|
81
|
-
no-return-assign: 0,
|
|
82
|
-
no-script-url: 2,
|
|
83
|
-
no-self-compare: 2,
|
|
84
|
-
no-sequences: 0, // allow the comma operator
|
|
85
|
-
no-throw-literal: 2,
|
|
86
|
-
no-unused-expressions: 0,
|
|
87
|
-
no-useless-call: 2,
|
|
88
|
-
no-void: 2,
|
|
89
|
-
no-warning-comments: 0,
|
|
90
|
-
no-with: 2,
|
|
91
|
-
radix: 2,
|
|
92
|
-
vars-on-top: 0,
|
|
93
|
-
wrap-iife: [2, "inside"],
|
|
94
|
-
yoda: 2,
|
|
95
|
-
|
|
96
|
-
// Strict Mode
|
|
97
|
-
strict: [2, "never"],
|
|
98
|
-
|
|
99
|
-
// Variables
|
|
100
|
-
init-declarations: 0,
|
|
101
|
-
no-catch-shadow: 0,
|
|
102
|
-
no-delete-var: 2,
|
|
103
|
-
no-label-var: 2,
|
|
104
|
-
no-shadow-restricted-names: 2,
|
|
105
|
-
no-shadow: 0,
|
|
106
|
-
no-undef-init: 2,
|
|
107
|
-
no-undef: 2,
|
|
108
|
-
no-undefined: 0,
|
|
109
|
-
no-unused-vars: [ 2, { args: "none" }],
|
|
110
|
-
no-use-before-define: [2, "nofunc"],
|
|
111
|
-
|
|
112
|
-
// Node.js
|
|
113
|
-
callback-return: 0,
|
|
114
|
-
handle-callback-err: 2,
|
|
115
|
-
no-mixed-requires: 0,
|
|
116
|
-
no-new-require: 2,
|
|
117
|
-
no-path-concat: 2,
|
|
118
|
-
no-process-exit: 0,
|
|
119
|
-
no-restricted-modules: 2,
|
|
120
|
-
no-sync: 0,
|
|
121
|
-
|
|
122
|
-
// Stylistic Issues
|
|
123
|
-
array-bracket-spacing: 2,
|
|
124
|
-
block-spacing: 2,
|
|
125
|
-
brace-style: [2, "stroustrup", { allowSingleLine: true }],
|
|
126
|
-
camelcase: 2,
|
|
127
|
-
comma-spacing: 2,
|
|
128
|
-
comma-style: 2,
|
|
129
|
-
computed-property-spacing: 2,
|
|
130
|
-
consistent-this: 0,
|
|
131
|
-
eol-last: 2,
|
|
132
|
-
func-names: 0,
|
|
133
|
-
func-style: [2, "declaration"],
|
|
134
|
-
id-length: 0,
|
|
135
|
-
id-match: 2,
|
|
136
|
-
indent-legacy: [2, 2, { VariableDeclarator: 2 }],
|
|
137
|
-
key-spacing: 0,
|
|
138
|
-
lines-around-comment: 2,
|
|
139
|
-
linebreak-style: 2,
|
|
140
|
-
max-nested-callbacks: [2, 2],
|
|
141
|
-
new-cap: 2,
|
|
142
|
-
new-parens: 2,
|
|
143
|
-
newline-after-var: 0,
|
|
144
|
-
no-array-constructor: 2,
|
|
145
|
-
no-continue: 2,
|
|
146
|
-
no-inline-comments: 0,
|
|
147
|
-
no-lonely-if: 2,
|
|
148
|
-
no-mixed-spaces-and-tabs: 2,
|
|
149
|
-
no-multiple-empty-lines: 0,
|
|
150
|
-
no-nested-ternary: 0,
|
|
151
|
-
no-new-object: 2,
|
|
152
|
-
no-spaced-func: 2,
|
|
153
|
-
no-ternary: 0,
|
|
154
|
-
no-trailing-spaces: 2,
|
|
155
|
-
no-underscore-dangle: 0,
|
|
156
|
-
no-unneeded-ternary: 2,
|
|
157
|
-
object-curly-spacing: [2, "always"],
|
|
158
|
-
object-curly-newline: 0,
|
|
159
|
-
object-property-newline: 0,
|
|
160
|
-
one-var: 0,
|
|
161
|
-
operator-assignment: 2,
|
|
162
|
-
operator-linebreak: [2, "after", { overrides: { ":": "ignore" } }],
|
|
163
|
-
padded-blocks: [2, "never"],
|
|
164
|
-
quote-props: [2, "consistent-as-needed"],
|
|
165
|
-
quotes: [2, "single", "avoid-escape"],
|
|
166
|
-
semi-spacing: 2,
|
|
167
|
-
semi: 2,
|
|
168
|
-
sort-vars: 0,
|
|
169
|
-
keyword-spacing: 2,
|
|
170
|
-
space-before-blocks: 2,
|
|
171
|
-
space-before-function-paren: [2, {"anonymous": "always", "named": "never"}],
|
|
172
|
-
space-in-parens: 2,
|
|
173
|
-
space-infix-ops: 2,
|
|
174
|
-
space-unary-ops: 2,
|
|
175
|
-
spaced-comment: [2, "always", { block: { markers: ["!"] } }],
|
|
176
|
-
wrap-regex: 0,
|
|
177
|
-
},
|
|
178
|
-
}
|
package/.github/workflows/ci.yml
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
on: [push, pull_request]
|
|
3
|
-
|
|
4
|
-
concurrency:
|
|
5
|
-
group: ${{ github.workflow }}-${{ github.ref }}
|
|
6
|
-
cancel-in-progress: true
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
|
|
10
|
-
test:
|
|
11
|
-
runs-on: ${{ matrix.os }}
|
|
12
|
-
strategy:
|
|
13
|
-
fail-fast: false
|
|
14
|
-
matrix:
|
|
15
|
-
os:
|
|
16
|
-
- ubuntu-20.04
|
|
17
|
-
- ubuntu-22.04
|
|
18
|
-
- ubuntu-latest
|
|
19
|
-
- macos-12
|
|
20
|
-
- macos-13
|
|
21
|
-
- macos-14
|
|
22
|
-
- macos-latest
|
|
23
|
-
node-version:
|
|
24
|
-
- 18.x
|
|
25
|
-
- 20.x
|
|
26
|
-
- 22.x
|
|
27
|
-
steps:
|
|
28
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
29
|
-
uses: actions/setup-node@v3
|
|
30
|
-
with:
|
|
31
|
-
node-version: ${{ matrix.node-version }}
|
|
32
|
-
- name: Ensure line endings are consistent
|
|
33
|
-
run: git config --global core.autocrlf input
|
|
34
|
-
- name: Check out repository
|
|
35
|
-
uses: actions/checkout@v3
|
|
36
|
-
with:
|
|
37
|
-
submodules: 'recursive'
|
|
38
|
-
- name: Load cache
|
|
39
|
-
uses: actions/cache@v3
|
|
40
|
-
with:
|
|
41
|
-
path: |
|
|
42
|
-
**/node_modules
|
|
43
|
-
.rdf-test-suite-cache
|
|
44
|
-
.rdf-test-suite-ldf-cache
|
|
45
|
-
key: ${{ runner.os }}-${{ runner.node-version }}-test-modules-${{ hashFiles('**/package-lock.json') }}
|
|
46
|
-
- name: Install dependencies
|
|
47
|
-
run: npm install
|
|
48
|
-
- name: Run tests
|
|
49
|
-
run: npm run test
|
|
50
|
-
- name: Run bin
|
|
51
|
-
run: bin/hdt test/test.hdt --format turtle --query 'http://example.org/s1 ?p ?o' | grep 'http://example.org/p1'
|
|
52
|
-
|
|
53
|
-
lint:
|
|
54
|
-
runs-on: ubuntu-latest
|
|
55
|
-
steps:
|
|
56
|
-
- name: Use Node.js
|
|
57
|
-
uses: actions/setup-node@v3
|
|
58
|
-
with:
|
|
59
|
-
node-version: 18.x
|
|
60
|
-
- name: Check out repository
|
|
61
|
-
uses: actions/checkout@v3
|
|
62
|
-
with:
|
|
63
|
-
submodules: 'recursive'
|
|
64
|
-
- name: Load cache
|
|
65
|
-
uses: actions/cache@v3
|
|
66
|
-
with:
|
|
67
|
-
path: '**/node_modules'
|
|
68
|
-
key: ${{ runner.os }}-lint-modules-${{ hashFiles('**/package-lock.json') }}
|
|
69
|
-
- name: Install dependencies
|
|
70
|
-
run: npm install
|
|
71
|
-
- name: Run linter
|
|
72
|
-
run: npm run lint
|
package/.gitmodules
DELETED
package/.jshintignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
node_modules
|
package/.jshintrc
DELETED
package/deps/libcds/README
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
libcds implements low-level succinct data structures such as bitmaps,
|
|
2
|
-
sequences, permutations, etc. The main goal is to provide a set of
|
|
3
|
-
structures that form the building block of most compressed/succinct
|
|
4
|
-
solutions. In the near future we are planning to add compression
|
|
5
|
-
algorithms and support for succinct trees.
|
|
6
|
-
|
|
7
|
-
You can find more information at http://libcds.recoded.cl/
|
|
8
|
-
|
|
9
|
-
Right now we are just fixing bugs and testing some new things in here,
|
|
10
|
-
but most of the effort is being put into libcds2, this rewrite aims at
|
|
11
|
-
solving many problems with 64bits systems. This is necessary in order
|
|
12
|
-
to index bigger inputs.
|