hdt 3.1.0 → 3.2.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/.eslintrc +1 -1
- package/.github/workflows/ci.yml +12 -2
- package/.idea/codeStyles/Project.xml +38 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/hdt.iml +12 -0
- package/.idea/inspectionProfiles/Project_Default.xml +7 -0
- package/.idea/jsLinters/jshint.xml +16 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +7 -0
- package/README.md +32 -1
- package/binding.gyp +1 -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 +6 -3
- package/perf/run.js +43 -0
- package/replace-in-file.json +5 -0
- package/deps/hdt-it/LICENSE +0 -280
- package/deps/hdt-it/README.md +0 -73
- package/deps/libcds/README +0 -12
package/.eslintrc
CHANGED
package/.github/workflows/ci.yml
CHANGED
|
@@ -10,11 +10,21 @@ jobs:
|
|
|
10
10
|
test:
|
|
11
11
|
runs-on: ${{ matrix.os }}
|
|
12
12
|
strategy:
|
|
13
|
+
fail-fast: false
|
|
13
14
|
matrix:
|
|
14
|
-
os:
|
|
15
|
+
os:
|
|
16
|
+
- ubuntu-20.04
|
|
17
|
+
- ubuntu-22.04
|
|
18
|
+
- ubuntu-24.04
|
|
19
|
+
- ubuntu-latest
|
|
20
|
+
- macos-13
|
|
21
|
+
- macos-14
|
|
22
|
+
- macos-15
|
|
23
|
+
- macos-latest
|
|
15
24
|
node-version:
|
|
16
25
|
- 18.x
|
|
17
26
|
- 20.x
|
|
27
|
+
- 22.x
|
|
18
28
|
steps:
|
|
19
29
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
20
30
|
uses: actions/setup-node@v3
|
|
@@ -33,7 +43,7 @@ jobs:
|
|
|
33
43
|
**/node_modules
|
|
34
44
|
.rdf-test-suite-cache
|
|
35
45
|
.rdf-test-suite-ldf-cache
|
|
36
|
-
key: ${{ runner.os }}-test-modules-${{ hashFiles('**/package-lock.json') }}
|
|
46
|
+
key: ${{ runner.os }}-${{ runner.node-version }}-test-modules-${{ hashFiles('**/package-lock.json') }}
|
|
37
47
|
- name: Install dependencies
|
|
38
48
|
run: npm install
|
|
39
49
|
- name: Run tests
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<component name="ProjectCodeStyleConfiguration">
|
|
2
|
+
<code_scheme name="Project" version="173">
|
|
3
|
+
<JSCodeStyleSettings version="0">
|
|
4
|
+
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
5
|
+
<option name="USE_DOUBLE_QUOTES" value="false" />
|
|
6
|
+
<option name="FORCE_QUOTE_STYlE" value="true" />
|
|
7
|
+
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
|
8
|
+
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
|
9
|
+
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
10
|
+
</JSCodeStyleSettings>
|
|
11
|
+
<TypeScriptCodeStyleSettings version="0">
|
|
12
|
+
<option name="USE_DOUBLE_QUOTES" value="false" />
|
|
13
|
+
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
14
|
+
</TypeScriptCodeStyleSettings>
|
|
15
|
+
<codeStyleSettings language="JavaScript">
|
|
16
|
+
<option name="BLOCK_COMMENT_ADD_SPACE" value="true" />
|
|
17
|
+
<option name="ELSE_ON_NEW_LINE" value="true" />
|
|
18
|
+
<option name="INDENT_CASE_FROM_SWITCH" value="false" />
|
|
19
|
+
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
|
|
20
|
+
<option name="ALIGN_MULTILINE_FOR" value="false" />
|
|
21
|
+
<option name="IF_BRACE_FORCE" value="1" />
|
|
22
|
+
<option name="DOWHILE_BRACE_FORCE" value="1" />
|
|
23
|
+
<option name="WHILE_BRACE_FORCE" value="1" />
|
|
24
|
+
<option name="FOR_BRACE_FORCE" value="1" />
|
|
25
|
+
<indentOptions>
|
|
26
|
+
<option name="INDENT_SIZE" value="2" />
|
|
27
|
+
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
28
|
+
</indentOptions>
|
|
29
|
+
</codeStyleSettings>
|
|
30
|
+
<codeStyleSettings language="TypeScript">
|
|
31
|
+
<indentOptions>
|
|
32
|
+
<option name="INDENT_SIZE" value="2" />
|
|
33
|
+
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
34
|
+
<option name="TAB_SIZE" value="2" />
|
|
35
|
+
</indentOptions>
|
|
36
|
+
</codeStyleSettings>
|
|
37
|
+
</code_scheme>
|
|
38
|
+
</component>
|
package/.idea/hdt.iml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="WEB_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$">
|
|
5
|
+
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
6
|
+
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
7
|
+
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
+
</content>
|
|
9
|
+
<orderEntry type="inheritedJdk" />
|
|
10
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
+
</component>
|
|
12
|
+
</module>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<component name="InspectionProjectProfileManager">
|
|
2
|
+
<profile version="1.0">
|
|
3
|
+
<option name="myName" value="Project Default" />
|
|
4
|
+
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
5
|
+
<inspection_tool class="JSHint" enabled="true" level="ERROR" enabled_by_default="true" />
|
|
6
|
+
</profile>
|
|
7
|
+
</component>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="JSHintConfiguration" version="2.13.6" use-config-file="true" use-custom-config-file="true" custom-config-file-path="$PROJECT_DIR$/.jshintrc">
|
|
4
|
+
<option bitwise="true" />
|
|
5
|
+
<option browser="true" />
|
|
6
|
+
<option curly="true" />
|
|
7
|
+
<option eqeqeq="true" />
|
|
8
|
+
<option forin="true" />
|
|
9
|
+
<option maxerr="50" />
|
|
10
|
+
<option noarg="true" />
|
|
11
|
+
<option noempty="true" />
|
|
12
|
+
<option nonew="true" />
|
|
13
|
+
<option strict="true" />
|
|
14
|
+
<option undef="true" />
|
|
15
|
+
</component>
|
|
16
|
+
</project>
|
package/.idea/vcs.xml
ADDED
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# HDT for Node.js
|
|
2
2
|
[](https://www.npmjs.com/package/hdt)
|
|
3
|
-
[](https://github.com/LinkedDataFragments/HDT-Node/actions?query=workflow%3ACI)
|
|
4
4
|
[](https://david-dm.org/RubenVerborgh/HDT-Node)
|
|
5
5
|
[](https://david-dm.org/RubenVerborgh/HDT-Node#info=devDependencies)
|
|
6
6
|
|
|
@@ -80,6 +80,37 @@ hdt.fromFile('./test/test.hdt')
|
|
|
80
80
|
});
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
+
### Searching for bindings matching a pattern
|
|
84
|
+
Search for [bindings](https://rdf.js.org/query-spec/#bindings-interface) with `searchBindings`,
|
|
85
|
+
which takes [bindingsFactory](https://rdf.js.org/query-spec/#bindingsfactory-interface), subject, predicate, object, and options arguments.
|
|
86
|
+
Subject, predicate, and object can be IRIs, literals, or variables,
|
|
87
|
+
[represented as RDF/JS terms](https://rdf.js.org/data-model-spec/#term-interface).
|
|
88
|
+
If any of these parameters is a variable, it is considered a wildcard.
|
|
89
|
+
Optionally, an offset and limit can be passed in an options object,
|
|
90
|
+
selecting only the specified subset.
|
|
91
|
+
|
|
92
|
+
The promise returns an object with an array of bindings, the total number of expected bindings for the pattern,
|
|
93
|
+
and whether the total count is an estimate or exact.
|
|
94
|
+
|
|
95
|
+
If variables are reused across terms, this library will make sure to only return bindings when matches for those variables are equal.
|
|
96
|
+
|
|
97
|
+
```JavaScript
|
|
98
|
+
const DF = new (require('rdf-data-factory').DataFactory)();
|
|
99
|
+
const BF = new (require('@comunica/utils-bindings-factory').BindingsFactory)(DF);
|
|
100
|
+
|
|
101
|
+
var doc;
|
|
102
|
+
hdt.fromFile('./test/test.hdt')
|
|
103
|
+
.then(function(hdtDocument) {
|
|
104
|
+
doc = hdtDocument;
|
|
105
|
+
return doc.searchBindings(DF.namedNode('http://example.org/s1'), DF.variable('p'), DF.variable('o'), { offset: 0, limit: 10 })
|
|
106
|
+
})
|
|
107
|
+
.then(function(result) {
|
|
108
|
+
console.log('Approximately ' + result.totalCount + ' bindings match the pattern.');
|
|
109
|
+
result.bindings.forEach(function (binding) { console.log(binding.toString()); });
|
|
110
|
+
return doc.close();
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
83
114
|
### Search terms starting with a prefix
|
|
84
115
|
Find terms (literals and IRIs) that start with a given prefix.
|
|
85
116
|
|
package/binding.gyp
CHANGED
|
@@ -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.0",
|
|
4
4
|
"description": "Native bindings to access HDT compressed triple files.",
|
|
5
5
|
"author": "Ruben Verborgh <ruben.verborgh@gmail.com>",
|
|
6
6
|
"keywords": [
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
"scripts": {
|
|
29
29
|
"test": "rm test/*.hdt.index.* 2> /dev/null; mocha",
|
|
30
30
|
"lint": "eslint --fix lib/*.js test/*.js bin/*",
|
|
31
|
-
"validate": "npm ls"
|
|
31
|
+
"validate": "npm ls",
|
|
32
|
+
"preinstall": "if [ -e replace-in-file.json ]; then replace-in-file --configFile=replace-in-file.json; fi && node-gyp rebuild"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
35
|
"minimist": "^1.1.0",
|
|
@@ -40,7 +41,9 @@
|
|
|
40
41
|
"eslint": "^5.3.0",
|
|
41
42
|
"mocha": "^6.2.2",
|
|
42
43
|
"precommit-hook": "^3.0.0",
|
|
43
|
-
"
|
|
44
|
+
"replace-in-file": "^8.3.0",
|
|
45
|
+
"should": "^13.1.0",
|
|
46
|
+
"@comunica/utils-bindings-factory": "^4.0.2"
|
|
44
47
|
},
|
|
45
48
|
"pre-commit": [
|
|
46
49
|
"lint",
|
package/perf/run.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const hdt = require('../lib/hdt');
|
|
2
|
+
const DF = require('n3').DataFactory;
|
|
3
|
+
const BF = new (require('@comunica/utils-bindings-factory').BindingsFactory)(DF);
|
|
4
|
+
|
|
5
|
+
const REPLICATION = 100000;
|
|
6
|
+
hdt.fromFile('../test/test.hdt').then(runForDocument);
|
|
7
|
+
|
|
8
|
+
async function runForDocument(document) {
|
|
9
|
+
console.time('warmup');
|
|
10
|
+
await iterate(document, 10000, searchTriples);
|
|
11
|
+
await iterate(document, 10000, searchBindings);
|
|
12
|
+
console.timeEnd('warmup');
|
|
13
|
+
|
|
14
|
+
console.time('searchTriples');
|
|
15
|
+
await iterate(document, REPLICATION, searchTriples);
|
|
16
|
+
console.timeEnd('searchTriples');
|
|
17
|
+
|
|
18
|
+
console.time('searchBindings');
|
|
19
|
+
await iterate(document, REPLICATION, searchBindings);
|
|
20
|
+
console.timeEnd('searchBindings');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async function iterate(document, replication, fun) {
|
|
24
|
+
for (let i = 0; i < replication; i++) {
|
|
25
|
+
await fun(document);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function searchTriples(document) {
|
|
30
|
+
const { triples } = await document.searchTriples(DF.namedNode('http://example.org/s2'), null, null);
|
|
31
|
+
assert(triples.length == 10);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async function searchBindings(document) {
|
|
35
|
+
const { bindings } = await document.searchBindings(BF, DF.namedNode('http://example.org/s2'), DF.variable('p'), DF.variable('o'));
|
|
36
|
+
assert(bindings.length == 10);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function assert(condition, message) {
|
|
40
|
+
if (!condition) {
|
|
41
|
+
throw message || "Assertion failed";
|
|
42
|
+
}
|
|
43
|
+
}
|
package/deps/hdt-it/LICENSE
DELETED
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
GNU GENERAL PUBLIC LICENSE
|
|
2
|
-
Version 2, June 1991
|
|
3
|
-
|
|
4
|
-
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
|
5
|
-
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
6
|
-
Everyone is permitted to copy and distribute verbatim copies
|
|
7
|
-
of this license document, but changing it is not allowed.
|
|
8
|
-
|
|
9
|
-
Preamble
|
|
10
|
-
|
|
11
|
-
The licenses for most software are designed to take away your
|
|
12
|
-
freedom to share and change it. By contrast, the GNU General Public
|
|
13
|
-
License is intended to guarantee your freedom to share and change free
|
|
14
|
-
software--to make sure the software is free for all its users. This
|
|
15
|
-
General Public License applies to most of the Free Software
|
|
16
|
-
Foundation's software and to any other program whose authors commit to
|
|
17
|
-
using it. (Some other Free Software Foundation software is covered by
|
|
18
|
-
the GNU Library General Public License instead.) You can apply it to
|
|
19
|
-
your programs, too.
|
|
20
|
-
|
|
21
|
-
When we speak of free software, we are referring to freedom, not
|
|
22
|
-
price. Our General Public Licenses are designed to make sure that you
|
|
23
|
-
have the freedom to distribute copies of free software (and charge for
|
|
24
|
-
this service if you wish), that you receive source code or can get it
|
|
25
|
-
if you want it, that you can change the software or use pieces of it
|
|
26
|
-
in new free programs; and that you know you can do these things.
|
|
27
|
-
|
|
28
|
-
To protect your rights, we need to make restrictions that forbid
|
|
29
|
-
anyone to deny you these rights or to ask you to surrender the rights.
|
|
30
|
-
These restrictions translate to certain responsibilities for you if you
|
|
31
|
-
distribute copies of the software, or if you modify it.
|
|
32
|
-
|
|
33
|
-
For example, if you distribute copies of such a program, whether
|
|
34
|
-
gratis or for a fee, you must give the recipients all the rights that
|
|
35
|
-
you have. You must make sure that they, too, receive or can get the
|
|
36
|
-
source code. And you must show them these terms so they know their
|
|
37
|
-
rights.
|
|
38
|
-
|
|
39
|
-
We protect your rights with two steps: (1) copyright the software, and
|
|
40
|
-
(2) offer you this license which gives you legal permission to copy,
|
|
41
|
-
distribute and/or modify the software.
|
|
42
|
-
|
|
43
|
-
Also, for each author's protection and ours, we want to make certain
|
|
44
|
-
that everyone understands that there is no warranty for this free
|
|
45
|
-
software. If the software is modified by someone else and passed on, we
|
|
46
|
-
want its recipients to know that what they have is not the original, so
|
|
47
|
-
that any problems introduced by others will not reflect on the original
|
|
48
|
-
authors' reputations.
|
|
49
|
-
|
|
50
|
-
Finally, any free program is threatened constantly by software
|
|
51
|
-
patents. We wish to avoid the danger that redistributors of a free
|
|
52
|
-
program will individually obtain patent licenses, in effect making the
|
|
53
|
-
program proprietary. To prevent this, we have made it clear that any
|
|
54
|
-
patent must be licensed for everyone's free use or not licensed at all.
|
|
55
|
-
|
|
56
|
-
The precise terms and conditions for copying, distribution and
|
|
57
|
-
modification follow.
|
|
58
|
-
|
|
59
|
-
GNU GENERAL PUBLIC LICENSE
|
|
60
|
-
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
61
|
-
|
|
62
|
-
0. This License applies to any program or other work which contains
|
|
63
|
-
a notice placed by the copyright holder saying it may be distributed
|
|
64
|
-
under the terms of this General Public License. The "Program", below,
|
|
65
|
-
refers to any such program or work, and a "work based on the Program"
|
|
66
|
-
means either the Program or any derivative work under copyright law:
|
|
67
|
-
that is to say, a work containing the Program or a portion of it,
|
|
68
|
-
either verbatim or with modifications and/or translated into another
|
|
69
|
-
language. (Hereinafter, translation is included without limitation in
|
|
70
|
-
the term "modification".) Each licensee is addressed as "you".
|
|
71
|
-
|
|
72
|
-
Activities other than copying, distribution and modification are not
|
|
73
|
-
covered by this License; they are outside its scope. The act of
|
|
74
|
-
running the Program is not restricted, and the output from the Program
|
|
75
|
-
is covered only if its contents constitute a work based on the
|
|
76
|
-
Program (independent of having been made by running the Program).
|
|
77
|
-
Whether that is true depends on what the Program does.
|
|
78
|
-
|
|
79
|
-
1. You may copy and distribute verbatim copies of the Program's
|
|
80
|
-
source code as you receive it, in any medium, provided that you
|
|
81
|
-
conspicuously and appropriately publish on each copy an appropriate
|
|
82
|
-
copyright notice and disclaimer of warranty; keep intact all the
|
|
83
|
-
notices that refer to this License and to the absence of any warranty;
|
|
84
|
-
and give any other recipients of the Program a copy of this License
|
|
85
|
-
along with the Program.
|
|
86
|
-
|
|
87
|
-
You may charge a fee for the physical act of transferring a copy, and
|
|
88
|
-
you may at your option offer warranty protection in exchange for a fee.
|
|
89
|
-
|
|
90
|
-
2. You may modify your copy or copies of the Program or any portion
|
|
91
|
-
of it, thus forming a work based on the Program, and copy and
|
|
92
|
-
distribute such modifications or work under the terms of Section 1
|
|
93
|
-
above, provided that you also meet all of these conditions:
|
|
94
|
-
|
|
95
|
-
a) You must cause the modified files to carry prominent notices
|
|
96
|
-
stating that you changed the files and the date of any change.
|
|
97
|
-
|
|
98
|
-
b) You must cause any work that you distribute or publish, that in
|
|
99
|
-
whole or in part contains or is derived from the Program or any
|
|
100
|
-
part thereof, to be licensed as a whole at no charge to all third
|
|
101
|
-
parties under the terms of this License.
|
|
102
|
-
|
|
103
|
-
c) If the modified program normally reads commands interactively
|
|
104
|
-
when run, you must cause it, when started running for such
|
|
105
|
-
interactive use in the most ordinary way, to print or display an
|
|
106
|
-
announcement including an appropriate copyright notice and a
|
|
107
|
-
notice that there is no warranty (or else, saying that you provide
|
|
108
|
-
a warranty) and that users may redistribute the program under
|
|
109
|
-
these conditions, and telling the user how to view a copy of this
|
|
110
|
-
License. (Exception: if the Program itself is interactive but
|
|
111
|
-
does not normally print such an announcement, your work based on
|
|
112
|
-
the Program is not required to print an announcement.)
|
|
113
|
-
|
|
114
|
-
These requirements apply to the modified work as a whole. If
|
|
115
|
-
identifiable sections of that work are not derived from the Program,
|
|
116
|
-
and can be reasonably considered independent and separate works in
|
|
117
|
-
themselves, then this License, and its terms, do not apply to those
|
|
118
|
-
sections when you distribute them as separate works. But when you
|
|
119
|
-
distribute the same sections as part of a whole which is a work based
|
|
120
|
-
on the Program, the distribution of the whole must be on the terms of
|
|
121
|
-
this License, whose permissions for other licensees extend to the
|
|
122
|
-
entire whole, and thus to each and every part regardless of who wrote it.
|
|
123
|
-
|
|
124
|
-
Thus, it is not the intent of this section to claim rights or contest
|
|
125
|
-
your rights to work written entirely by you; rather, the intent is to
|
|
126
|
-
exercise the right to control the distribution of derivative or
|
|
127
|
-
collective works based on the Program.
|
|
128
|
-
|
|
129
|
-
In addition, mere aggregation of another work not based on the Program
|
|
130
|
-
with the Program (or with a work based on the Program) on a volume of
|
|
131
|
-
a storage or distribution medium does not bring the other work under
|
|
132
|
-
the scope of this License.
|
|
133
|
-
|
|
134
|
-
3. You may copy and distribute the Program (or a work based on it,
|
|
135
|
-
under Section 2) in object code or executable form under the terms of
|
|
136
|
-
Sections 1 and 2 above provided that you also do one of the following:
|
|
137
|
-
|
|
138
|
-
a) Accompany it with the complete corresponding machine-readable
|
|
139
|
-
source code, which must be distributed under the terms of Sections
|
|
140
|
-
1 and 2 above on a medium customarily used for software interchange; or,
|
|
141
|
-
|
|
142
|
-
b) Accompany it with a written offer, valid for at least three
|
|
143
|
-
years, to give any third party, for a charge no more than your
|
|
144
|
-
cost of physically performing source distribution, a complete
|
|
145
|
-
machine-readable copy of the corresponding source code, to be
|
|
146
|
-
distributed under the terms of Sections 1 and 2 above on a medium
|
|
147
|
-
customarily used for software interchange; or,
|
|
148
|
-
|
|
149
|
-
c) Accompany it with the information you received as to the offer
|
|
150
|
-
to distribute corresponding source code. (This alternative is
|
|
151
|
-
allowed only for noncommercial distribution and only if you
|
|
152
|
-
received the program in object code or executable form with such
|
|
153
|
-
an offer, in accord with Subsection b above.)
|
|
154
|
-
|
|
155
|
-
The source code for a work means the preferred form of the work for
|
|
156
|
-
making modifications to it. For an executable work, complete source
|
|
157
|
-
code means all the source code for all modules it contains, plus any
|
|
158
|
-
associated interface definition files, plus the scripts used to
|
|
159
|
-
control compilation and installation of the executable. However, as a
|
|
160
|
-
special exception, the source code distributed need not include
|
|
161
|
-
anything that is normally distributed (in either source or binary
|
|
162
|
-
form) with the major components (compiler, kernel, and so on) of the
|
|
163
|
-
operating system on which the executable runs, unless that component
|
|
164
|
-
itself accompanies the executable.
|
|
165
|
-
|
|
166
|
-
If distribution of executable or object code is made by offering
|
|
167
|
-
access to copy from a designated place, then offering equivalent
|
|
168
|
-
access to copy the source code from the same place counts as
|
|
169
|
-
distribution of the source code, even though third parties are not
|
|
170
|
-
compelled to copy the source along with the object code.
|
|
171
|
-
|
|
172
|
-
4. You may not copy, modify, sublicense, or distribute the Program
|
|
173
|
-
except as expressly provided under this License. Any attempt
|
|
174
|
-
otherwise to copy, modify, sublicense or distribute the Program is
|
|
175
|
-
void, and will automatically terminate your rights under this License.
|
|
176
|
-
However, parties who have received copies, or rights, from you under
|
|
177
|
-
this License will not have their licenses terminated so long as such
|
|
178
|
-
parties remain in full compliance.
|
|
179
|
-
|
|
180
|
-
5. You are not required to accept this License, since you have not
|
|
181
|
-
signed it. However, nothing else grants you permission to modify or
|
|
182
|
-
distribute the Program or its derivative works. These actions are
|
|
183
|
-
prohibited by law if you do not accept this License. Therefore, by
|
|
184
|
-
modifying or distributing the Program (or any work based on the
|
|
185
|
-
Program), you indicate your acceptance of this License to do so, and
|
|
186
|
-
all its terms and conditions for copying, distributing or modifying
|
|
187
|
-
the Program or works based on it.
|
|
188
|
-
|
|
189
|
-
6. Each time you redistribute the Program (or any work based on the
|
|
190
|
-
Program), the recipient automatically receives a license from the
|
|
191
|
-
original licensor to copy, distribute or modify the Program subject to
|
|
192
|
-
these terms and conditions. You may not impose any further
|
|
193
|
-
restrictions on the recipients' exercise of the rights granted herein.
|
|
194
|
-
You are not responsible for enforcing compliance by third parties to
|
|
195
|
-
this License.
|
|
196
|
-
|
|
197
|
-
7. If, as a consequence of a court judgment or allegation of patent
|
|
198
|
-
infringement or for any other reason (not limited to patent issues),
|
|
199
|
-
conditions are imposed on you (whether by court order, agreement or
|
|
200
|
-
otherwise) that contradict the conditions of this License, they do not
|
|
201
|
-
excuse you from the conditions of this License. If you cannot
|
|
202
|
-
distribute so as to satisfy simultaneously your obligations under this
|
|
203
|
-
License and any other pertinent obligations, then as a consequence you
|
|
204
|
-
may not distribute the Program at all. For example, if a patent
|
|
205
|
-
license would not permit royalty-free redistribution of the Program by
|
|
206
|
-
all those who receive copies directly or indirectly through you, then
|
|
207
|
-
the only way you could satisfy both it and this License would be to
|
|
208
|
-
refrain entirely from distribution of the Program.
|
|
209
|
-
|
|
210
|
-
If any portion of this section is held invalid or unenforceable under
|
|
211
|
-
any particular circumstance, the balance of the section is intended to
|
|
212
|
-
apply and the section as a whole is intended to apply in other
|
|
213
|
-
circumstances.
|
|
214
|
-
|
|
215
|
-
It is not the purpose of this section to induce you to infringe any
|
|
216
|
-
patents or other property right claims or to contest validity of any
|
|
217
|
-
such claims; this section has the sole purpose of protecting the
|
|
218
|
-
integrity of the free software distribution system, which is
|
|
219
|
-
implemented by public license practices. Many people have made
|
|
220
|
-
generous contributions to the wide range of software distributed
|
|
221
|
-
through that system in reliance on consistent application of that
|
|
222
|
-
system; it is up to the author/donor to decide if he or she is willing
|
|
223
|
-
to distribute software through any other system and a licensee cannot
|
|
224
|
-
impose that choice.
|
|
225
|
-
|
|
226
|
-
This section is intended to make thoroughly clear what is believed to
|
|
227
|
-
be a consequence of the rest of this License.
|
|
228
|
-
|
|
229
|
-
8. If the distribution and/or use of the Program is restricted in
|
|
230
|
-
certain countries either by patents or by copyrighted interfaces, the
|
|
231
|
-
original copyright holder who places the Program under this License
|
|
232
|
-
may add an explicit geographical distribution limitation excluding
|
|
233
|
-
those countries, so that distribution is permitted only in or among
|
|
234
|
-
countries not thus excluded. In such case, this License incorporates
|
|
235
|
-
the limitation as if written in the body of this License.
|
|
236
|
-
|
|
237
|
-
9. The Free Software Foundation may publish revised and/or new versions
|
|
238
|
-
of the General Public License from time to time. Such new versions will
|
|
239
|
-
be similar in spirit to the present version, but may differ in detail to
|
|
240
|
-
address new problems or concerns.
|
|
241
|
-
|
|
242
|
-
Each version is given a distinguishing version number. If the Program
|
|
243
|
-
specifies a version number of this License which applies to it and "any
|
|
244
|
-
later version", you have the option of following the terms and conditions
|
|
245
|
-
either of that version or of any later version published by the Free
|
|
246
|
-
Software Foundation. If the Program does not specify a version number of
|
|
247
|
-
this License, you may choose any version ever published by the Free Software
|
|
248
|
-
Foundation.
|
|
249
|
-
|
|
250
|
-
10. If you wish to incorporate parts of the Program into other free
|
|
251
|
-
programs whose distribution conditions are different, write to the author
|
|
252
|
-
to ask for permission. For software which is copyrighted by the Free
|
|
253
|
-
Software Foundation, write to the Free Software Foundation; we sometimes
|
|
254
|
-
make exceptions for this. Our decision will be guided by the two goals
|
|
255
|
-
of preserving the free status of all derivatives of our free software and
|
|
256
|
-
of promoting the sharing and reuse of software generally.
|
|
257
|
-
|
|
258
|
-
NO WARRANTY
|
|
259
|
-
|
|
260
|
-
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
|
261
|
-
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
|
262
|
-
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
|
263
|
-
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
|
264
|
-
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
265
|
-
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
|
266
|
-
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
|
267
|
-
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
|
268
|
-
REPAIR OR CORRECTION.
|
|
269
|
-
|
|
270
|
-
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
271
|
-
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
|
272
|
-
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
|
273
|
-
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
|
274
|
-
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
|
275
|
-
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
|
276
|
-
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
|
277
|
-
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
|
278
|
-
POSSIBILITY OF SUCH DAMAGES.
|
|
279
|
-
|
|
280
|
-
END OF TERMS AND CONDITIONS
|
package/deps/hdt-it/README.md
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
# HDT-it! GUI tool for the HDT triple format
|
|
2
|
-
|
|
3
|
-
Overview
|
|
4
|
-
=================
|
|
5
|
-
|
|
6
|
-
HDT-it is a tool that can generate
|
|
7
|
-
and consume RDF files in HDT format. It demonstrates the capabilities
|
|
8
|
-
of HDT by allowing to search basic triple patterns against HDT files, and
|
|
9
|
-
also visualizes the 3D adjacency matrix of the underlying RDF graph to
|
|
10
|
-
provide an overview of the dataset distribution.
|
|
11
|
-
|
|
12
|
-
Download executable
|
|
13
|
-
=================
|
|
14
|
-
|
|
15
|
-
An executable version of the tool is available for multiple platforms in http://www.rdfhdt.org/downloads/
|
|
16
|
-
|
|
17
|
-
Compiling
|
|
18
|
-
=================
|
|
19
|
-
|
|
20
|
-
Dependencies:
|
|
21
|
-
|
|
22
|
-
- HDT-Lib
|
|
23
|
-
- QT4 (http://doc.qt.io/qt-4.8/)
|
|
24
|
-
|
|
25
|
-
Compilation:
|
|
26
|
-
|
|
27
|
-
1.Compile the main hdt-lib library. To compile the library run `make` under the directory `hdt-lib`, this will generate the library and tools.
|
|
28
|
-
2. Execute Qmake in libcds-v1.0.12:
|
|
29
|
-
|
|
30
|
-
$ cd libcds-v1.0.12/qmake
|
|
31
|
-
$ qmake
|
|
32
|
-
$ make
|
|
33
|
-
|
|
34
|
-
3.Execute Qmake in hdt-lib
|
|
35
|
-
|
|
36
|
-
$ cd hdt-lib/qmake
|
|
37
|
-
$ qmake
|
|
38
|
-
$ make
|
|
39
|
-
|
|
40
|
-
4.Execute Qmake in hdt-it
|
|
41
|
-
|
|
42
|
-
$ cd hdt-it
|
|
43
|
-
$ qmake
|
|
44
|
-
$ make
|
|
45
|
-
|
|
46
|
-
The application should be available in a new hdt-it subfolder (e.g. hdt-it/unix or hdt-it/win32)
|
|
47
|
-
|
|
48
|
-
Licensing
|
|
49
|
-
=================
|
|
50
|
-
Copyright (C) 2012, Mario Arias, Javier D. Fernandez, Miguel A. Martinez-Prieto
|
|
51
|
-
All rights reserved.
|
|
52
|
-
|
|
53
|
-
This library is free software; you can redistribute it and/or
|
|
54
|
-
modify it under the terms of the GNU Lesser General Public
|
|
55
|
-
License as published by the Free Software Foundation; either
|
|
56
|
-
version 2.1 of the License, or (at your option) any later version.
|
|
57
|
-
|
|
58
|
-
This library is distributed in the hope that it will be useful,
|
|
59
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
60
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
61
|
-
Lesser General Public License for more details.
|
|
62
|
-
|
|
63
|
-
You should have received a copy of the GNU Lesser General Public
|
|
64
|
-
License along with this library; if not, write to the Free Software
|
|
65
|
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
66
|
-
|
|
67
|
-
Visit our Web Page: www.rdfhdt.org
|
|
68
|
-
|
|
69
|
-
Contacting the authors:
|
|
70
|
-
- Mario Arias: mario.arias@deri.org
|
|
71
|
-
- Javier D. Fernandez: jfergar@infor.uva.es
|
|
72
|
-
- Miguel A. Martinez-Prieto: migumar2@infor.uva.es
|
|
73
|
-
|
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.
|