How to use the @comunica/core.ActionContext function in @comunica/core

To help you get started, we’ve selected a few @comunica/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github comunica / comunica / packages / actor-query-operation-service / lib / ActorQueryOperationService.ts View on Github external
public async runOperation(pattern: Algebra.Service, context: ActionContext)
    : Promise {
    const endpoint: string = pattern.name.value;

    // Adjust our context to only have the endpoint as source
    context = context || ActionContext({});
    let subContext: ActionContext = context.delete(KEY_CONTEXT_SOURCE).delete(KEY_CONTEXT_SOURCES);
    const sourceType = this.forceSparqlEndpoint ? 'sparql' : 'auto';
    subContext = subContext.set(KEY_CONTEXT_SOURCES,
      AsyncReiterableArray.fromFixedData([{ type: sourceType, value: endpoint }]));

    // Query the source
    let output: IActorQueryOperationOutputBindings;
    try {
      output = ActorQueryOperation.getSafeBindings(
        await this.mediatorQueryOperation.mediate({ operation: pattern.input, context: subContext }));
    } catch (e) {
      if (pattern.silent) {
        // Emit a single empty binding
        output = {
          bindingsStream: new SingletonIterator(Bindings({})),
          type: 'bindings',

@comunica/core

Lightweight, semantic and modular actor framework

MIT
Latest version published 24 days ago

Package Health Score

87 / 100
Full package analysis