【发布时间】:2023-12-26 12:55:01
【问题描述】:
我有一个schema:ProductGroup 和schema:ProductModel 节点的图表,我编写了一个框架以嵌套结构输出它,在概念上类似于图书馆书籍章节示例。一切正常,除了框架输出在*ProductGroup 上包含一个isVariantOf: null,我宁愿没有。
{
"@context": {
"@vocab": "http://schema.org/",
"ex": "http://example.com/"
},
"@id": "ex:100",
"@type": "ProductGroup",
"hasVariant": [...],
"isVariantOf": null,
"name": "All The Things"
}
Full example in JSON-LD Playground(在 Flattened 和 Framed 之间切换以使其正确输出)。
*ProductGroup 没有isVariantOf 属性。在我的框架文件中,我匹配这个是空的。但是,我不知道如何在输出中省略空的 isVariantOf 属性。我想我必须设置 @omitDefault 标志,但我无法确定在哪里或如何设置。
{
"@context": {
"@vocab": "http://schema.org/",
"ex": "http://example.com/"
},
"@graph": {
"@type": "ProductGroup",
"@requireAll": true,
"isVariantOf": []
}
}
【问题讨论】:
标签: schema.org json-ld linked-data