Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
}
public async runOperation(pattern: Algebra.Bgp, context: ActionContext)
: Promise {
return {
bindingsStream: new SingletonIterator(Bindings({})),
metadata: () => Promise.resolve({ totalItems: 1 }),
type: 'bindings',
variables: [],
};
}
undefined,
enterConnection.id,
exitConnection.id,
);
path.addStep(step);
currentStopId = enterConnection.departureStop;
}
if (!path.steps.length) {
return new EmptyIterator();
}
path.reverse();
return new SingletonIterator(path);
}