@_linked/xsd

中文文档
1.4.4发布于 2026/10/28MIT AND W3C-20150513TypeScriptES Module构建来源已验证近 30 天下载 4218

The XML Schema 1.1 datatypes for Linked: the datatypes as Turtle, an accessor for every one of them, a shape for xsd:boolean (Boolean) and a date helper (XSDDate). The package mirrors `http://www.w3.org/2001/X

原始使用文档
文档目录4 节
  1. Terms
  2. The data
  3. Development
  4. Data license

@_linked/xsd

The XML Schema 1.1 datatypes for Linked: the datatypes as Turtle, an accessor for every one of them, a shape for xsd:boolean (Boolean) and a date helper (XSDDate). The package mirrors http://www.w3.org/2001/XMLSchema# and holds only its terms.

Terms

import * as schema from '@_linked/schema/ontologies/schema';
import * as xsd from '@_linked/xsd/ontologies/xsd';

@literalProperty({path: schema.birthDate, datatype: xsd.date, maxCount: 1})

ontologies/xsd has one named export per datatype (39); ontologies/xsd.data holds ns, dataFiles, _ontologyResource and loadData(). linked generate-ontology writes the modules from the data (package.json "linkedOntologies"), and linked build fails when they are stale; never edit them by hand.

The data

The W3C publishes no RDF for XML Schema: the namespace document is not RDF, and the datatypes are defined in prose, in XSD 1.1 Part 2: Datatypes. So src/data/xsd.ttl is written by hand from that specification. It declares exactly the 39 datatypes that RDF 1.1 Concepts §5.1 allows in RDF (the "RDF-compatible XSD types"), each a rdfs:Datatype with its rdfs:label, rdfs:isDefinedBy xsd: and rdfs:subClassOf rdfs:Literal:

Group (RDF 1.1 §5.1)Datatypes
Core typesstring, boolean, decimal, integer
IEEE floating-point numbersdouble, float
Time and datedate, time, dateTime, dateTimeStamp
Recurring and partial datesgYear, gMonth, gDay, gYearMonth, gMonthDay, duration, yearMonthDuration, dayTimeDuration
Limited-range integer numbersbyte, short, int, long, unsignedByte, unsignedShort, unsignedInt, unsignedLong, positiveInteger, nonNegativeInteger, negativeInteger, nonPositiveInteger
Encoded binary datahexBinary, base64Binary
Miscellaneous XSD typesanyURI, language, normalizedString, token, NMTOKEN, Name, NCName

The built-in datatypes RDF 1.1 says SHOULD NOT be used (QName, ENTITY, ID, IDREF, NOTATION, IDREFS, ENTITIES, NMTOKENS) and the special anyType, anySimpleType and anyAtomicType are not in the data. The file also declares the ontology itself (xsd: a owl:Ontology).

To change the data, edit src/data/xsd.ttl against those two specifications and run npx linked generate-ontology. The package never adds a term to the namespace that XSD 1.1 does not define.

Development

npx linked build    # checks the ontology modules, compiles, writes lib/esm/data/shapes.ttl
npm test            # runs against lib/

Data license

The package code is MIT licensed (see LICENSE). The bundled ontology data is derived from the W3C XML Schema datatypes (XSD) specification 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/xsd 共发布 23 个版本,首次发布于 2026/04/23;过去 12 个月发布了 23 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.4.4latest2026/10/2810 天前
1.4.32026/10/2513 天前
1.4.22026/10/2513 天前
1.4.12026/10/2514 天前
1.4.02026/10/2414 天前
1.3.22026/10/2414 天前

关于 @_linked/xsd 的常见问题

@_linked/xsd 是什么?

The XML Schema 1.1 datatypes for Linked: the datatypes as Turtle, an accessor for every one of them, a shape for xsd:boolean (Boolean) and a date helper (XSDDate). The package mirrors `http://www.w3.org/2001/X

如何安装 @_linked/xsd?

在项目目录运行 npm install @_linked/xsd,或使用 pnpm add / yarn add / bun add。

@_linked/xsd 支持 TypeScript 吗?

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

@_linked/xsd 支持 ESM 还是 CommonJS?

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

@_linked/xsd 可以商用吗?

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

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

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

@_linked/xsd 还在维护吗?

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