@hdelva/termennetwerk_client
Advanced tools
Comparing version 1.0.4 to 1.0.6
@@ -77,6 +77,6 @@ "use strict"; | ||
this.subEmitter.on("end", (data) => this.emit("end", data)); | ||
this.subEmitter.on("reset", () => this.emit("reset")); | ||
} | ||
query(input) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this.emit("reset"); | ||
this.subEmitter.query(input); | ||
@@ -83,0 +83,0 @@ }); |
@@ -9,48 +9,2 @@ "use strict"; | ||
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(AutoComplete_1).default; } }); | ||
/* | ||
export default class AutoCompleteWorker extends IQueryEmitter { | ||
protected worker: Worker; | ||
constructor() { | ||
super(); | ||
this.worker = new Worker(); | ||
const self = this; | ||
this.worker.onmessage = (e) => { | ||
const r = []; | ||
for (const s of e.data) { | ||
r.push(RdfString.stringQuadToQuad(s)); | ||
} | ||
self.emit("data", r); | ||
} | ||
} | ||
public async query(input: string) { | ||
this.worker.postMessage(input); | ||
} | ||
} | ||
*/ | ||
const AutoComplete_2 = __importDefault(require("./AutoComplete")); | ||
const x = new AutoComplete_2.default([ | ||
"https://termen.opoi.org/nta", | ||
"https://termen.opoi.org/rkdartists", | ||
"https://termen.opoi.org/cht", | ||
"https://termen.opoi.org/vtmk" | ||
], 10); | ||
x.on("reset", () => { | ||
console.log(""); | ||
}); | ||
x.on("data", (d) => { | ||
for (const quad of x.resolveSubject(d.subject.value)) { | ||
console.log(quad.subject.value, quad.object.value); | ||
} | ||
}); | ||
x.on("end", (q) => { | ||
if (q === "ter men") { | ||
//x.query("ter menno"); | ||
} | ||
}); | ||
//x.query("ver"); | ||
//x.query("Métérié"); | ||
x.query("ter menn"); | ||
//# sourceMappingURL=index.js.map |
@@ -24,3 +24,2 @@ "use strict"; | ||
source.on("data", (q) => self.emit("data", q)); | ||
source.on("reset", () => self.emit("reset")); | ||
source.on("end", (q) => self.processEnd(q)); | ||
@@ -31,2 +30,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this.emit("reset"); | ||
for (const source of this.singleSourceAgents) { | ||
@@ -33,0 +33,0 @@ source.query(input); |
@@ -15,3 +15,2 @@ declare const SortedArray: any; | ||
query(input: string): Promise<void>; | ||
protected reset(): void; | ||
protected processQuad(quad: Quad): void; | ||
@@ -18,0 +17,0 @@ resolveSubject(uri: string): Quad[]; |
@@ -28,3 +28,2 @@ "use strict"; | ||
this.subEmitter.on("data", (q) => self.processQuad(q)); | ||
this.subEmitter.on("reset", () => self.reset()); | ||
this.subEmitter.on("end", (uri) => self.emit("end", uri)); | ||
@@ -34,2 +33,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this.emit("reset"); | ||
this.currentBest = new SortedArray(); | ||
@@ -41,6 +41,2 @@ input = this.normalizer.normalize(input); | ||
} | ||
reset() { | ||
this.currentBest = new SortedArray(); | ||
this.emit("reset"); | ||
} | ||
processQuad(quad) { | ||
@@ -47,0 +43,0 @@ let thresholdVector = undefined; |
@@ -10,4 +10,3 @@ import { Quad } from "rdf-js"; | ||
resolveSubject(uri: string): Quad[]; | ||
protected reset(): void; | ||
protected processQuad(quad: Quad): void; | ||
} |
@@ -24,3 +24,2 @@ "use strict"; | ||
this.subEmitter.on("data", (q) => self.processQuad(q)); | ||
this.subEmitter.on("reset", () => self.reset()); | ||
this.subEmitter.on("end", (uri) => self.emit("end", uri)); | ||
@@ -30,2 +29,4 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this.emit("reset"); | ||
this.store = new N3.Store(); | ||
this.subEmitter.query(input); | ||
@@ -37,5 +38,2 @@ }); | ||
} | ||
reset() { | ||
this.store = new N3.Store(); | ||
} | ||
processQuad(quad) { | ||
@@ -42,0 +40,0 @@ this.store.addQuad(quad); |
@@ -9,4 +9,3 @@ import { Quad } from "rdf-js"; | ||
resolveSubject(uri: string): Quad[]; | ||
protected reset(): void; | ||
protected processQuad(quad: Quad): void; | ||
} |
@@ -23,3 +23,2 @@ "use strict"; | ||
this.subEmitter.on("data", (q) => self.processQuad(q)); | ||
this.subEmitter.on("reset", () => self.reset()); | ||
this.subEmitter.on("end", (uri) => self.emit("end", uri)); | ||
@@ -29,2 +28,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this.emit("reset"); | ||
this.known = new Set(); | ||
@@ -37,5 +37,2 @@ this.subEmitter.query(input); | ||
} | ||
reset() { | ||
this.known = new Set(); | ||
} | ||
processQuad(quad) { | ||
@@ -42,0 +39,0 @@ const uri = quad.subject.value; |
{ | ||
"name": "@hdelva/termennetwerk_client", | ||
"version": "1.0.4", | ||
"version": "1.0.6", | ||
"description": "Autocomplete over TREEs", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
export { default } from "./AutoComplete"; | ||
/* | ||
export default class AutoCompleteWorker extends IQueryEmitter { | ||
protected worker: Worker; | ||
constructor() { | ||
super(); | ||
this.worker = new Worker(); | ||
const self = this; | ||
this.worker.onmessage = (e) => { | ||
const r = []; | ||
for (const s of e.data) { | ||
r.push(RdfString.stringQuadToQuad(s)); | ||
} | ||
self.emit("data", r); | ||
} | ||
} | ||
public async query(input: string) { | ||
this.worker.postMessage(input); | ||
} | ||
} | ||
*/ | ||
/* | ||
import AutoComplete from "./AutoComplete"; | ||
const x = new AutoComplete([ | ||
"https://termen.opoi.org/nta", | ||
"https://termen.opoi.org/rkdartists", | ||
"https://termen.opoi.org/cht", | ||
"https://termen.opoi.org/vtmk"], | ||
10); | ||
x.on("reset", () => { | ||
console.log(""); | ||
}) | ||
x.on("data", (d) => { | ||
for (const quad of x.resolveSubject(d.subject.value)) { | ||
console.log(quad.subject.value, quad.object.value); | ||
} | ||
}); | ||
x.on("end", (q) => { | ||
if (q === "ter men") { | ||
//x.query("ter menno"); | ||
} | ||
}) | ||
//x.query("ver"); | ||
//x.query("Métérié"); | ||
x.query("ter menn"); | ||
*/ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
8065155
7856