@_linked/rdfs

中文文档
1.6.0发布于 2026/11/02MIT AND W3C-20150513TypeScriptES Module构建来源已验证近 30 天下载 2404

RDF and RDFS vocabularies as ontologies plus the core @linkedShape classes Resource, Class and Property. Renamed from lincd-rdfs.

原始使用文档
文档目录9 节
  1. Shapes
  2. Ontologies
  3. The data
  4. Components
  5. Usage
  6. Development
  7. A nested node_modules/@_linked/core is the thing to watch f…
  8. History
  9. Data license

@_linked/rdfs

The RDF and RDF Schema vocabularies as ontologies, plus the core @linkedShape classes every other vocabulary builds on.

Shapes

  • Resource — rdfs:Resource (label, comment, type)
  • Class — rdfs:Class (isDefinedBy, subClassOf (any number), ontology)
  • Property — rdf:Property (domain, range, subPropertyOf (each any number), isDefinedBy)

The package mirrors the RDF and RDFS namespaces: it holds only their terms, and its shapes only classes they define. Custom shapes live in a package of their own namespace.

Ontologies

  • rdf — http://www.w3.org/1999/02/22-rdf-syntax-ns#
  • rdfs — http://www.w3.org/2000/01/rdf-schema#

The data

Each ontology's data is the latest official release of its standard, as the W3C publishes it at the namespace, unchanged apart from a leading comment that names the source:

FileSourceVersion
src/data/rdf.ttlhttps://www.w3.org/1999/02/22-rdf-syntax-ns (Turtle)dc:date "2019-12-16" (RDF 1.1 Concepts, with JSON-LD 1.1's rdf:JSON, rdf:CompoundLiteral, rdf:language, rdf:direction)
src/data/rdfs.ttlhttps://www.w3.org/2000/01/rdf-schema (Turtle)Last-Modified 2024-12-18

To refresh, download each with curl -sSL -H 'Accept: text/turtle' <source>, put the comment back with the new Last-Modified (curl -sI) and, for rdf, dc:date, and run npx linked generate-ontology.

The official files are the only source of the package's terms: the package never adds a class or property to a standard's namespace. What the published standard lacks, mainly metadata, goes in one extra file per prefix, src/data/<prefix>-added.ttl, listed in "linkedOntologies"' data:

  • the ontology entity itself: owl:Ontology, title, description, vann:preferredNamespacePrefix, vann:preferredNamespaceUri, the source URL and version;
  • annotations on terms the standard already defines, such as a missing rdfs:label.

New classes or properties never go there; a term a standard lacks belongs in the consumer's own ontology package.

Both files here carry their own ontology header, so this package has no -added file.

The build copies the data into lib/esm/data/. linked generate-ontology writes the accessor modules from it (package.json "linkedOntologies"): ontologies/<prefix>.ts holds one named export per term, and ontologies/<prefix>.data.ts holds ns, dataFiles, _ontologyResource and loadData(), which reads the data on the server.

Components

  • LabelView — renders a resource's rdfs:label, falling back to the last segment of its IRI.

Usage

import { Resource, Property } from '@_linked/rdfs/shapes';
import * as rdfs from '@_linked/rdfs/ontologies/rdfs';

rdfs.label; // {id: 'http://www.w3.org/2000/01/rdf-schema#label'}

Development

Build with npx linked build from this directory. (yarn linked build is refused by the wrapper and exits 0, so it looks like a successful no-op.)

A nested node_modules/@_linked/core is the thing to watch for

This section used to say "do not run npm install in this directory", on the grounds that npm here writes a nested node_modules/@_linked/core and two copies of core mean two distinct Shape classes. The prohibition was wrong, and the diagnosis of where the nested copy came from was wrong. It has been measured since: the nested install dated from when this package was built in a staging/ directory outside the workspace globs, where it genuinely was a standalone package and npm was the right tool. Moving it into packages/ carried that private node_modules along with it. The directory has been deleted, and packages/rdfs now has no node_modules of its own — it resolves to the single workspace @_linked/core through the hoisted symlink.

package-lock.json being tracked here is correct and should stay: CI runs npm ci.

What remains true is the symptom, which is worth recognising because it names neither npm nor this package. Two copies of @_linked/core mean two distinct Shape classes; nothing crashes, and the error surfaces in a consumer. This is what @_linked/owl hit while it was migrating off lincd-rdfs:

Type 'typeof Property' is not assignable to type 'typeof Shape'.
  Type 'Map<string, Set<typeof import(".../packages/rdfs/node_modules/@_linked/core/lib/esm/shapes/Shape").Shape>>'
    is not assignable to
    'Map<string, Set<typeof import(".../packages/core/lib/esm/shapes/Shape").Shape>>'.

If you ever see that, check ls packages/rdfs/node_modules — the path inside the message says which copy is the stray one — and delete the nested tree. The split is silent until something downstream fails to compile, or two Shape registries diverge at runtime.

History

Renamed from lincd-rdfs and migrated out of the lincd.org umbrella into its own repo. The source is unchanged apart from the registry name passed to linkedPackage(), which also changes the shape IRI slug from lincd-rdfs to rdfs (https://linked.cm/shape/rdfs/Resource), matching every other @_linked/* vocabulary package.

Data license

The package code is MIT licensed (see LICENSE). The bundled ontology data is derived from the W3C RDF and RDF Schema specifications and is not covered by the MIT license: it remains under the W3C Software and Document License, https://www.w3.org/copyright/software-license-2023/. See NOTICE.

版本与发布记录

@_linked/rdfs 共发布 17 个版本,首次发布于 2026/09/25;过去 12 个月发布了 17 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.6.0latest2026/11/025 天前
1.5.32026/10/2810 天前
1.5.22026/10/2513 天前
1.5.12026/10/2513 天前
1.5.02026/10/2414 天前
1.4.02026/10/2414 天前

关于 @_linked/rdfs 的常见问题

@_linked/rdfs 是什么?

RDF and RDFS vocabularies as ontologies plus the core @linkedShape classes Resource, Class and Property. Renamed from lincd-rdfs.

如何安装 @_linked/rdfs?

在项目目录运行 npm install @_linked/rdfs,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^18 || ^19)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@_linked/rdfs 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@_linked/rdfs 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@_linked/rdfs 可以商用吗?

@_linked/rdfs 使用 MIT AND W3C-20150513 许可。声明的许可为 MIT AND W3C-20150513,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@_linked/rdfs 的下载量有多少?

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

@_linked/rdfs 还在维护吗?

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