How to use ldflex - 2 common examples

To help you get started, we’ve selected a few ldflex 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 solid / query-ldflex / src / util.js View on Github external
import { SparqlHandler } from 'ldflex';

export const { termToString } = SparqlHandler.prototype;

export function replaceVariables(template, terms) {
  for (const name in terms)
    template = template.replace(new RegExp(`_:${name}`, 'g'), termToString(terms[name]));
  return template;
}

// Imitate Comunica's response for bindings as a Immutable.js object.
export function createBindings(...items) {
  return {
    size: items.length,
    values: () => ({
      next: () => ({ value: items.shift() }),
    }),
  };
}
github solid / query-ldflex / src / SourcePathHandler.js View on Github external
    return source => new PathFactory({
      handlers: { ...defaultHandlers },
      resolvers: [new SubjectPathResolver(this._paths, source)],
    }).create();
  }

ldflex

A JavaScript DSL for querying Linked Data on the Web

MIT
Latest version published 2 years ago

Package Health Score

59 / 100
Full package analysis