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

@rdfjs/environment

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rdfjs/environment

A flexible RDF/JS factory

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16K
decreased by-16.76%
Maintainers
2
Weekly downloads
 
Created
Source

@rdfjs/environment

Build Status

npm version

This package provides a flexible RDF/JS factory. The Environment class takes one or more RDF/JS factory classes and creates a new, merged instance. All factory methods will use the Environment instance as factory to create new object instances. Clones can be created to manipulate an instance isolated from other instances.

Usage

The main export of the package is the Environment class. It can be imported like this:

import Environment from '@rdfjs/environment'

The package contains multiple factories. The factories can be imported with the pattern @rdfjs/environment/{factoryName}.js. For the FormatsFactory, it would look like this:

import FormatsFactory from '@rdfjs/environment/FormatsFactory.js'

Environment(factories)

Creates a new Environment instance. factories must be an iterable (e.g. Array) of RDF/JS factory classes.

clone()

This method creates a new, isolated Environment instance with the same set of factories and clones of the instance data.

DataFactory

An implementation of the RDF/JS Data Model that wraps the @rdfjs/data-model package.

DatasetFactory

An implementation of the RDF/JS Dataset that wraps the @rdfjs/dataset package.

FetchFactory

A factory for @rdfjs/fetch-lite calls. This factory must be used together with FormatsFactory to provide parsers and serializers. The environment is injected for calls to res.dataset().

FormatsFactory

A factory that takes care of parsers and serializers. An additional .formats object will be attached to the environment. That object is compatible with the data structure of @rdfjs/formats-common. The .formats object has an additional .import() function to import other format bundles. The following code shows how to import the @rdfjs/formats-common bundle:

import DataFactory from '@rdfjs/environment/DataFactory.js'
import DatasetFactory from '@rdfjs/environment/DatasetFactory.js'
import Environment from '@rdfjs/environment'
import FormatsFactory from '@rdfjs/environment/FormatsFactory.js'
import formats from '@rdfjs/formats-common'

const env = new Environment([DataFactory, DatasetFactory, FormatsFactory])
env.formats.import(formats)

NamespaceFactory

A factory to create namespace builders based on the @rdfjs/namespace package. Instances of the builder can be created with the .namespace() method.

TermMapSetFactory

A factory to create @rdfjs/term-map and @rdfjs/term-set objects. The instances can be created with .termMap() and .termSet().

Keywords

FAQs

Package last updated on 27 Nov 2021

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