Comunica
    Preparing search index...

    Module @comunica/actor-bindings-aggregator-factory-extensions - v5.5.1

    Comunica Extensions Bindings Aggregator Factory Actor

    npm version

    A bindings aggregator factory actor that constructs a bindings aggregator for any extension aggregate passed by the extensionAggregatorCreator or extensionAggregators context keys.

    An extension aggregate creates the aggregator of a single group. Like for extension functions, the arguments of the aggregate call are evaluated beforehand, and the aggregator receives the evaluated arguments of each solution in the group:

    const result = await engine.queryBindings(`
    PREFIX ex: <http://example.org/>
    SELECT (ex:median(?o) AS ?median) WHERE { ?s ?p ?o } GROUP BY ?s`, {
    sources: [ 'https://www.rubensworks.net/' ],
    extensionAggregators: {
    'http://example.org/median': () => {
    const values: number[] = [];
    return {
    put([ term ]) {
    values.push(Number.parseFloat(term.value));
    },
    result() {
    // Calculate and return the median of values as an RDF term
    },
    };
    },
    },
    });

    Like for the built-in aggregates:

    • With DISTINCT, each distinct list of arguments is only put once.
    • Solutions for which an argument uses an unbound variable are skipped.
    • Errors evaluating the arguments, or thrown by the aggregator, leave the result unbound.

    This module is part of the Comunica framework, and should only be used by developers that want to build their own query engine.

    Click here if you just want to query with Comunica.

    $ yarn add @comunica/actor-bindings-aggregator-factory-extensions
    

    After installing, this package can be added to your engine's configuration as follows:

    {
      "@context": [
        ...
        "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-bindings-aggregator-factory-extensions/^5.0.0/components/context.jsonld"
      ],
      "actors": [
        ...
        {
          "@id": "urn:comunica:default:bindings-aggregator-factory/actors#extensions",
          "@type": "ActorBindingsAggregatorFactoryExtensions",
          "mediatorExpressionEvaluatorFactory": { "@id": "urn:comunica:default:expression-evaluator-factory/mediators#main" }
        }
      ]
    }
    

    Classes

    ActorBindingsAggregatorFactoryExtensions