How to use @comunica/bus-rdf-join - 7 common examples

To help you get started, we’ve selected a few @comunica/bus-rdf-join 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-leftjoin-nestedloop / lib / ActorQueryOperationLeftJoinNestedLoop.ts View on Github external
// TODO: This will not work for larger streams.
      // The full inner stream is kept in memory.
      joinedStream.on('end', () => nextLeft());
      joinedStream.on('data', async ({ joinedBindings, result }) => {
        if (result) {
          bindingsStream._push(joinedBindings);
        }
      });
    };

    const transform = leftJoinOuter;
    const bindingsStream = left.bindingsStream
      .transform({ optional: true, transform });

    const variables = ActorRdfJoin.joinVariables({ entries: [left, right] });
    const metadata = () => Promise.all([left, right].map((entry) => entry.metadata()))
      .then((metadatas) => metadatas.reduce((acc, val) => acc * val.totalItems, 1))
      .catch(() => Infinity)
      .then((totalItems) => ({ totalItems }));

    return { type: 'bindings', bindingsStream, metadata, variables };
  }
}
github comunica / comunica / packages / actor-query-operation-leftjoin-nestedloop / lib / ActorQueryOperationLeftJoinNestedLoop.ts View on Github external
transform: async (innerItem: Bindings, nextInner: any) => {
            const joinedBindings = ActorRdfJoin.join(outerItem, innerItem);
            if (!joinedBindings) { nextInner(); return; }
            if (!pattern.expression) {
              joinedStream._push({ joinedBindings, result: true });
              nextInner();
              return;
            }
            try {
              const result = await evaluator.evaluateAsEBV(joinedBindings);
              joinedStream._push({ joinedBindings, result });
            } catch (err) {
              if (!isExpressionError(err)) {
                bindingsStream.emit('error', err);
              }
            }
            nextInner();
          },
github comunica / comunica / packages / actor-rdf-join-hash / lib / ActorRdfJoinHash.ts View on Github external
public async getOutput(action: IActionRdfJoin): Promise {
    const variables = ActorRdfJoin.overlappingVariables(action);
    const join = new HashJoin(
      action.entries[0].bindingsStream, action.entries[1].bindingsStream,
      (entry) => ActorRdfJoinHash.hash(entry, variables), ActorRdfJoin.join);
    return { type: 'bindings', bindingsStream: join, variables: ActorRdfJoin.joinVariables(action) };
  }
github comunica / comunica / packages / actor-rdf-join-symmetrichash / lib / ActorRdfJoinSymmetricHash.ts View on Github external
public async getOutput(action: IActionRdfJoin): Promise {
    const variables = ActorRdfJoin.overlappingVariables(action);
    const join = new SymmetricHashJoin(
      action.entries[0].bindingsStream, action.entries[1].bindingsStream,
      (entry) => ActorRdfJoinSymmetricHash.hash(entry, variables), ActorRdfJoin.join);
    return { type: 'bindings', bindingsStream: join, variables: ActorRdfJoin.joinVariables(action) };
  }
github comunica / comunica / packages / actor-rdf-join-nestedloop / lib / ActorRdfJoinNestedLoop.ts View on Github external
protected async getOutput(action: IActionRdfJoin): Promise {
    const join = new NestedLoopJoin(
      action.entries[0].bindingsStream, action.entries[1].bindingsStream, ActorRdfJoin.join);
    return { type: 'bindings', bindingsStream: join, variables: ActorRdfJoin.joinVariables(action) };
  }
github comunica / comunica / packages / actor-rdf-join-hash / lib / ActorRdfJoinHash.ts View on Github external
public async getOutput(action: IActionRdfJoin): Promise {
    const variables = ActorRdfJoin.overlappingVariables(action);
    const join = new HashJoin(
      action.entries[0].bindingsStream, action.entries[1].bindingsStream,
      (entry) => ActorRdfJoinHash.hash(entry, variables), ActorRdfJoin.join);
    return { type: 'bindings', bindingsStream: join, variables: ActorRdfJoin.joinVariables(action) };
  }
github comunica / comunica / packages / actor-rdf-join-symmetrichash / lib / ActorRdfJoinSymmetricHash.ts View on Github external
public async getOutput(action: IActionRdfJoin): Promise {
    const variables = ActorRdfJoin.overlappingVariables(action);
    const join = new SymmetricHashJoin(
      action.entries[0].bindingsStream, action.entries[1].bindingsStream,
      (entry) => ActorRdfJoinSymmetricHash.hash(entry, variables), ActorRdfJoin.join);
    return { type: 'bindings', bindingsStream: join, variables: ActorRdfJoin.joinVariables(action) };
  }

@comunica/bus-rdf-join

A comunica bus for rdf-join events.

MIT
Latest version published 2 months ago

Package Health Score

84 / 100
Full package analysis