Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

query-sparql-link-traversal-solid-no-default-predicates

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

query-sparql-link-traversal-solid-no-default-predicates

A @comunica/query-sparql-link-traversal-solid, configured to not follow any default predicates.

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

A @comunica/query-sparql-link-traversal-solid engine, configured to not follow any default predicates (such as http://www.w3.org/2000/01/rdf-schema#seeAlso).

It allows you

  • to use an engine with this behavior, without the need to provide your own configuration file
  • and even to apply it in a browser environment.

To use it, see below an example code snippet.

Installation

In your application's project root folder, execute:

npm install query-sparql-link-traversal-solid-no-default-predicates

Usage within application

This is an example demonstrating how to use this engine to retrieve datasources from an index file containing triples ?s <http://example.com/hasDataSource> ?source.

// This works in node AND in a browser (when packaged by vite for example).
import { QueryEngine } from 'query-sparql-link-traversal-solid-no-default-predicates';
const engine = new QueryEngine;

async function getSourceList() {
  const bindingsStream = await engine.queryBindings(
    'SELECT DISTINCT ?source WHERE {?s <http://example.com/hasDataSource> ?source.}',
    {
      sources: ['http://example.com/index-file-with-triples-listing-sources'],
      lenient: true
    });
  let sources = [];
  const bindings = await bindingsStream.toArray();
  for (let binding of bindings) {
    sources.push(binding.get('source').value)
  }
  return sources;
}

const datasources = await getSourceList();
console.log(datasources);

Note

Replacing the top 3 lines in above example with:

// This only works in node (suppose ./config.json has the same contents as query-sparql-link-traversal-solid-no-default-predicates's engine-default.js).
import { QueryEngineFactory } from '@comunica/query-sparql-link-traversal-solid';
const engine = await new QueryEngineFactory().create({ configPath: './config.json', });

would not work in a browser environment, because QueryEngineFactory is not available there.

Keywords

FAQs

Package last updated on 27 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc