How to use the @comunica/bus-query-operation.Bindings function in @comunica/bus-query-operation

To help you get started, we’ve selected a few @comunica/bus-query-operation 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
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',
          variables: [],
        };
      } else {
        throw e;
      }
    }

    return output;
  }
github comunica / comunica / packages / actor-query-operation-group / lib / GroupsState.ts View on Github external
});

    // Case: No Input
    // Some aggregators still define an output on the empty input
    // Result is a single Bindings
    if (rows.length === 0) {
      const single: { [key: string]: Term } = {};
      for (const i in this.pattern.aggregates) {
        const aggregate = this.pattern.aggregates[i];
        const key = termToString(aggregate.variable);
        const value = AggregateEvaluator.emptyValue(aggregate);
        if (value !== undefined) {
          single[key] = value;
        }
      }
      rows = [Bindings(single)];
    }

    return rows;
  }
github comunica / comunica / packages / actor-query-operation-bgp-empty / lib / ActorQueryOperationBgpEmpty.ts View on Github external
public async runOperation(pattern: Algebra.Bgp, context: ActionContext)
  : Promise {
    return {
      bindingsStream: new SingletonIterator(Bindings({})),
      metadata: () => Promise.resolve({ totalItems: 1 }),
      type: 'bindings',
      variables: [],
    };
  }
github comunica / comunica / packages / actor-rdf-resolve-quad-pattern-sparql-json / lib / ActorRdfResolveQuadPatternSparqlJson.ts View on Github external
          rawBindingsStream.on('data', (rawBindings) => bindingsStream._push(Bindings(rawBindings)));
          rawBindingsStream.on('end', () => {
github comunica / comunica / packages / actor-query-operation-quadpattern / lib / ActorQueryOperationQuadpattern.ts View on Github external
const bindingsStream: BindingsStream = new PromiseProxyIterator(async () => result.data.map((quad) => {
      return Bindings(reduceTerms(quad, quadBindingsReducer, {}));
    }, { autoStart: true, maxBufferSize: 128 }));