diff --git a/package.json b/package.json index 808f62c..1da5352 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nagu-owl", - "version": "1.11.6", + "version": "1.11.7", "description": "[![Node.js CI](https://github.com/nagucc/owl/actions/workflows/node.js.yml/badge.svg)](https://github.com/nagucc/owl/actions/workflows/node.js.yml)", "type": "module", "main": "dist/index.js", diff --git a/src/index.ts b/src/index.ts index d09d29a..9c3cac8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -144,12 +144,13 @@ export class RdfsResource extends Notion implements IRdfsResource { await Promise.all(operations); // 设置新值 - const ts = await Promise.all([ - this.setPropertyValue(rdfs.label, label), - this.setPropertyValue(rdfs.comment, comment), - this.setPropertyValue(rdfs.isDefinedBy, isDefinedBy as INotion), - this.setPropertyValue(rdfs.seeAlso, seeAlso), - ]); + const setOperations = []; + if (label) setOperations.push(this.setPropertyValue(rdfs.label, label)); + if (comment) setOperations.push(this.setPropertyValue(rdfs.comment, comment)); + if (isDefinedBy) setOperations.push(this.setPropertyValue(rdfs.isDefinedBy, isDefinedBy.toString())); + if (seeAlso) setOperations.push(this.setPropertyValue(rdfs.seeAlso, seeAlso)); + + const ts = await Promise.all(setOperations); // 修改自身变量 this.label = ts[0]?.object;