revert to sparql CONSTRUCT in resource.read()

main
Niko PLP 4 months ago committed by GitHub
parent 61816a0abc
commit dd6007274b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 28
      packages/connected-nextgraph/src/resources/NextGraphResource.ts

@ -122,25 +122,15 @@ export class NextGraphResource
this.loading = true; this.loading = true;
this.emit("update"); this.emit("update");
// Fetch the data once using subscribe // Fetch the data once using construct
await new Promise<void>(async (resolve, reject) => { const sparqlResult = await this.context.nextgraph.ng.sparql_query(
let unsub: () => void; this.context.nextgraph.sessionId,
try { `CONSTRUCT { ?s ?p ?o } WHERE { GRAPH <${this.uri}> { ?s ?p ?o } }`,
unsub = await this.context.nextgraph.ng.doc_subscribe( undefined,
this.uri, this.uri,
this.context.nextgraph.sessionId, );
async (response: NextGraphNotificationMessage) => { // Update the dataset
if (response.V0.State) { this.overwriteQuads(sparqlResult);
unsub();
await this.onNotification(response);
resolve();
}
},
);
} catch (err) {
reject(err);
}
});
// Update statuses // Update statuses
const result = new NextGraphReadSuccess(this, false); const result = new NextGraphReadSuccess(this, false);

Loading…
Cancel
Save