How to use the rdflib.fetcher function in rdflib

To help you get started, we’ve selected a few rdflib 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 / solid-ui / src / store.js View on Github external
// This module of solid-ui has a main quadstore for the app to use
//

var rdf = require('rdflib')
var store = (module.exports = rdf.graph()) // Make a Quad store
rdf.fetcher(store) // Attach a web I/O module, store.fetcher
store.updater = new rdf.UpdateManager(store) // Add real-time live updates store.updater

console.log('Unique quadstore initialized.')

// ends
github solid / solid-panes / scratchpad / view.ts View on Github external
async function showLatestAuthor (authorContainer: HTMLElement) {
    const latestAuthor = getLatestAuthor(store, subject)
    if (latestAuthor) {
      const fetcher = $rdf.fetcher(store, {})
      await fetcher.load(latestAuthor.uri)
      const [nameStatement] = store.statementsMatching(latestAuthor, ns.vcard('fn'), null, null, true)

      authorContainer.appendChild(document.createTextNode('Latest author: '))
      const authorLink = document.createElement('a')
      authorLink.href = latestAuthor.uri
      const name = (nameStatement) ? nameStatement.object.value : latestAuthor.uri
      authorLink.textContent = name
      authorLink.title = `View the profile of ${name}`
      authorLink.addEventListener('click', (event) => {
        event.preventDefault()
        visitNode(latestAuthor)
      })
      authorContainer.appendChild(authorLink)
    }
  }
github solid / solid-panes / scratchpad / view.js View on Github external
return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        latestAuthor = data_1.getLatestAuthor(store, subject);
                        if (!latestAuthor) return [3 /*break*/, 2];
                        fetcher = $rdf.fetcher(store, {});
                        return [4 /*yield*/, fetcher.load(latestAuthor.uri)];
                    case 1:
                        _a.sent();
                        nameStatement = store.statementsMatching(latestAuthor, ns.vcard('fn'), null, null, true)[0];
                        authorContainer.appendChild(document.createTextNode('Latest author: '));
                        authorLink = document.createElement('a');
                        authorLink.href = latestAuthor.uri;
                        name_1 = (nameStatement) ? nameStatement.object.value : latestAuthor.uri;
                        authorLink.textContent = name_1;
                        authorLink.title = "View the profile of " + name_1;
                        authorLink.addEventListener('click', function (event) {
                            event.preventDefault();
                            visitNode(latestAuthor);
                        });
                        authorContainer.appendChild(authorLink);
                        _a.label = 2;
github solid / oidc-auth-manager / src / preferred-provider.js View on Github external
function discoverFromProfile (webId) {
  const store = rdf.graph()

  const fetcher = rdf.fetcher(store)

  return fetcher.load(webId, { force: true })
    .then(response => {
      let providerTerm = rdf.namedNode('http://www.w3.org/ns/solid/terms#oidcIssuer')
      let providerUri = store.anyValue(rdf.namedNode(webId), providerTerm)
      return providerUri
    }, err => {
      let error = new Error(`Could not reach Web ID ${webId} to discover provider`)
      error.cause = err
      error.statusCode = 400
      throw error
    })
}
github jeff-zucker / sparql-fiddle / sparql-fiddle.js View on Github external
return new Promise((resolve, reject)=>{
        let fetcher = new $rdf.fetcher( $rdf.graph() );
        try {
            fetcher.load(url).then( response => {
                resolve( response.responseText )
            })
        } catch(err) { reject(err) }
      })
    }