@digitalcredentials/rdf-canonize

中文文档
1.0.0发布于 2021/05/20BSD-3-ClauseCommonJS近 30 天下载 2.1万

An implementation of the RDF Dataset Normalization Algorithm in JavaScript

原始使用文档
文档目录11 节
  1. Introduction
  2. Installation
  3. Node.js + npm
  4. Node.js + npm + native bindings
  5. Browser + npm
  6. Examples
  7. Related Modules
  8. Tests
  9. Benchmark
  10. Source
  11. Commercial Support

rdf-canonize

Build status Coverage status Dependency Status

An implementation of the RDF Dataset Normalization Algorithm in JavaScript.

Introduction

...

Installation

Node.js + npm

npm install rdf-canonize
const canonize = require('rdf-canonize');

Node.js + npm + native bindings

This package has support for rdf-canonize-native. This package can be useful if your application requires doing many canonizing operations asyncronously in parallel or in the background. It is highly recommended that you understand your requirements and benchmark using JavaScript vs native bindings. The native bindings add overhead and the JavaScript implementation may be faster with modern runtimes.

The native bindings are not installed by default and must be explicitly installed.

npm install rdf-canonize
npm install rdf-canonize-native

Note that the native code is not automatically used. To use the native bindings you must have them installed and set the useNative option to true.

const canonize = require('rdf-canonize');

Browser + npm

Install in your project with npm and use your favorite browser bundler tool.

Examples

const dataset = {
  // ...
};

// canonize a data set with a particular algorithm with async/await
const canonical = await canonize.canonize(dataset, {algorithm: 'URDNA2015'});

// canonize a data set with a particular algorithm and force use of the
// native implementation
const canonical = await canonize.canonize(dataset, {
  algorithm: 'URDNA2015',
  useNative: true
});

Tests

This library includes a sample testing utility which may be used to verify that changes to the processor maintain the correct output.

The test suite is included in an external repository:

https://github.com/json-ld/normalization

This should be a sibling directory of the rdf-canonize directory or in a test-suites dir. To clone shallow copies into the test-suites dir you can use the following:

npm run fetch-test-suite

Node.js tests can be run with a simple command:

npm test

If you installed the test suites elsewhere, or wish to run other tests, use the TEST_DIR environment var:

TEST_DIR="/tmp/tests" npm test

To generate earl reports:

# generate the earl report for node.js
EARL=earl-node.jsonld npm test

Browser testing with karma is done indirectly through jsonld.js.

Benchmark

See docs in the benchmark README.

Source

The source code for this library is available at:

https://github.com/digitalbazaar/rdf-canonize

Commercial Support

Commercial support for this library is available upon request from Digital Bazaar: [email protected]

版本与发布记录

@digitalcredentials/rdf-canonize 共发布 1 个版本,首次发布于 2021/05/20;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.0latest2021/05/205 年前

关于 @digitalcredentials/rdf-canonize 的常见问题

@digitalcredentials/rdf-canonize 是什么?

An implementation of the RDF Dataset Normalization Algorithm in JavaScript

如何安装 @digitalcredentials/rdf-canonize?

在项目目录运行 npm install @digitalcredentials/rdf-canonize,或使用 pnpm add / yarn add / bun add。

@digitalcredentials/rdf-canonize 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/digitalcredentials__rdf-canonize 是否存在。

@digitalcredentials/rdf-canonize 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@digitalcredentials/rdf-canonize 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=12。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@digitalcredentials/rdf-canonize 可以商用吗?

@digitalcredentials/rdf-canonize 使用 BSD-3-Clause 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。另外不得用原作者名义为衍生产品背书。以上为概括,不构成法律意见,请以许可原文为准。

@digitalcredentials/rdf-canonize 的下载量有多少?

根据 npm 官方下载统计,@digitalcredentials/rdf-canonize 在 2026/10/12 – 2026/11/10 这 30 天内被下载 20,922 次,日均约 697 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@digitalcredentials/rdf-canonize 还在维护吗?

最新版本 1.0.0 发布于 2021/05/20(5 年前);至今共发布 1 个版本,其中过去 12 个月发布了 0 个;首次发布于 2021/05/20。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。