ARTICLE DETAIL

资讯详情

深耕郑州网站建设与运营推广的一线实战洞察。

Schema.org 中的 GoodRelations 电商词汇:类与属性的渊源、落地与实战标记

Schema.org 中的 GoodRelations 电商词汇:类与属性的渊源、落地与实战标记 知识图谱数据【免费下载链接】schemaorgSchema.org - schemas and supporting software项目地址https://gitcode.com/gh_mirrors/sc/schemaorg点击查看免费下载本文围绕 Schema.org 仓库中 GoodRelations 协作文档data/collab/GoodRelationsClass.md 与 data/collab/GoodRelationsTerms.md展开梳理 GoodRelations 电商词汇体系如何被吸收进 Schema.org 的 Offer、Product、PriceSpecification、DeliveryMethod、PaymentMethod 等电商核心模型中说明这些贡献者contributor标记在 data/schema.ttl 中的真实落地方式并给出可复制的 RDFa / Microdata / JSON-LD 实战标记。读者读完可以理解 GoodRelations 与 Schema.org 的关系、定位相关类和属性并直接动手为电商页面编写结构化数据。一、GoodRelations 是什么协作文档给出的定位data/collab/GoodRelationsClass.md 明确写道本类Class派生自 Martin Hepp 创建的 GoodRelations 电商词汇GoodRelations Vocabulary for E-Commerce。GoodRelations 是一种用于在 Web 上共享电商数据的数据模型data model可以以多种语法表达包括RDFa和HTML5 Microdata。而 data/collab/GoodRelationsTerms.md 补充说明这些术语Term使用了 GoodRelations 电商词汇中的术语。两份协作文档均把 GoodRelations 的权威信息入口指向http://purl.org/goodrelations/该链接为文档内原始出处信息可按需访问查阅。需要特别说明的是GoodRelationsClass.md面向的是**类Classes层面的贡献关系而GoodRelationsTerms.md面向的是属性Properties**层面的贡献关系。在 Schema.org 的词表构建流程中这两个文档本身也被当作协作方实体来注册从 software/SchemaTerms/sdocollaborators.py 的源码结构看其中_parseDesc专门解析data/collab/*.md的 front matter 与各 section协作文档的--- DescriptionText.md ---与--- AcknowledgementText.md ---标记会被解析为协作方的描述文本与致谢文本并最终以https://schema.org/docs/collab/GoodRelationsClass、https://schema.org/docs/collab/GoodRelationsTerms这样的 URI 出现在词表的三元组中作为:contributor值。二、从 GoodRelations 到 Schema.org贡献者标记在 schema.ttl 中的落地在 data/schema.ttl当前仓库的主词表源文件中GoodRelations 的贡献关系被明确记录为:contributor https://schema.org/docs/collab/GoodRelationsTerms等三元组。下面是从词表源码中可以直接确认的几个典型事实Offer 类data/schema.ttl#L2716-L2722rdfs:subClassOf :Intangible并声明:contributor https://schema.org/docs/collab/GoodRelationsTerms同时通过owl:equivalentClass与 UN/CEFACT 的unece:Offer、FIBO 的fibo-fnd-pas-pas:Offer建立等价关系Product 类data/schema.ttl#L3123-L3129同样标注:contributor https://schema.org/docs/collab/GoodRelationsTerms并等价于unece:TradeProduct、fibo-fnd-pas-pas:ProductPriceSpecification 类data/schema.ttl#L3110-L3115其贡献者则指向https://blog.schema.org/2012/11/08/good-relations-and-schema-org/即 Schema.org 官方博客上宣布 GoodRelations 与 schema.org 合作的公告说明该类直接受该合作公告驱动。从源码结构看GoodRelations 对 Schema.org 的影响是结构性融入而非简单并列contributor标记出现在电商核心类上说明这些类及其关联属性最初源自 GoodRelations 的类与属性设计经协作后被纳入 Schema.org 的命名空间并继续演化。三、GoodRelations 术语的完整清单gr-property-acks.ttl 中的 70 个属性仓库专门保存了一个贡献致谢词表 data/gr-property-acks.ttl其中以 Turtle 格式逐条列出属性rdf:Property→ 贡献者的对应关系贡献者统一为https://schema.org/docs/collab/GoodRelationsTerms。这份清单完整覆盖了 GoodRelations 术语在 Schema.org 中继承的属性集合可归纳为以下几组报价与定价Offer / PriceacceptedPaymentMethod、addOn、advanceBookingRequirement、amountOfThisGood、appliesToDeliveryMethod、appliesToPaymentMethod、availabilityEnds、availabilityStarts、availableAtOrFrom、availableDeliveryMethod、billingIncrement、businessFunction、deliveryLeadTime、eligibleCustomerType、eligibleDuration、eligibleQuantity、eligibleRegion、eligibleTransactionVolume、includesObject、inventoryLevel、maxPrice、minPrice、priceSpecification、priceType、validFrom、validThrough、valueAddedTaxIncluded、warranty、warrantyScope。商品与标识Product / Identifiercolor、depth、duns、gtin13、gtin14、gtin8、globalLocationNumber、isAccessoryOrSparePartFor、isConsumableFor、isRelatedTo、isSimilarTo、isVariantOf、isicV4、legalName、logo、mpn、naics、serialNumber、sku、taxID、typeOfGood、unitCode、vatID、weight、releaseDate。数值与比较QuantitativeValueequal、greater、greaterOrEqual、lesser、lesserOrEqual、maxValue、minValue、nonEqual、value、valueReference。营业时间与关系OpeningHours / Relationshipcloses、dayOfWeek、opens、openingHoursSpecification、acquiredFrom、ownedFrom、ownedThrough、owns、predecessorOf、successorOf、hasPOS、makesOffer、seeks。配送与支付Delivery / PaymentavailableDeliveryMethod、appliesToDeliveryMethod、appliesToPaymentMethod。这些属性在词表中并非孤岛以businessFunction为例data/schema.ttl#L600 注释中列出了 GoodRelations 的常用取值http://purl.org/goodrelations/v1#Sell、#LeaseOut、#Maintain、#Repair、#Dispose、#ProvideService、#ConstructionInstallation等data/schema.ttl#L5778 还明确说明businessFunction的默认值是http://purl.org/goodrelations/v1#Sell。四、GoodRelations 遗留取值枚举类中的 v1 命名空间引用GoodRelations 的影响还体现在枚举类型的常用取值上。在 data/schema.ttl 的rdfs:comment中保留了大量指向http://purl.org/goodrelations/v1#...的常用值引用例如BusinessEntityTypedata/schema.ttl#L588v1#Business、v1#Enduser、v1#PublicInstitution、v1#ResellerbusinessFunctiondata/schema.ttl#L600v1#ConstructionInstallation、v1#Dispose、v1#LeaseOut、v1#Maintain、v1#ProvideService、v1#Repair、v1#Sell等PaymentMethoddata/schema.ttl#L2901v1#ByBankTransferInAdvance、v1#ByInvoice、v1#Cash、v1#CheckInAdvance、v1#COD、v1#DirectDebit、v1#GoogleCheckout、v1#PayPal、v1#PaySwarmDeliveryMethoddata/schema.ttl#L1165v1#DeliveryModeDirectDownload、v1#DeliveryModeFreight、v1#DeliveryModeMail、v1#DeliveryModeOwnFleet、v1#DeliveryModePickUp、v1#DHL、v1#FederalExpress、v1#UPSDayOfWeekdata/schema.ttl#L1095文档明确说明周一至周日及 PublicHolidays 的 URL最初来自 GoodRelations现已直接整合进 Schema.orgWarrantyScopedata/schema.ttl#L4380v1#Labor-BringIn、v1#PartsAndLabor-BringIn、v1#PartsAndLabor-PickUp等CreditCard / CardPaymentMethoddata/schema.ttl#L1001v1#AmericanExpress、v1#DinersClub、v1#Discover、v1#JCB、v1#MasterCard、v1#VISA。此外data/schema.ttl#L14398-L14583 区域中PaymentMethod的枚举成员ByBankTransferInAdvance、ByInvoice、COD、Cash、CheckInAdvance、DirectDebit等在注释中逐一标注了与http://purl.org/goodrelations/v1#...的等价关系。这意味着在标记电商页面时既可以直接使用 Schema.org 的枚举成员也可以沿用 GoodRelations v1 的遗留取值两者语义等价。五、从协作文档到词表发布collab 文档如何被加工协作文档本身不是孤立的文本它是 Schema.org 词表构建管线的一部分。从 software/SchemaTerms/sdocollaborators.py 的源码可以确认以下机制loadCollaborators()会遍历 data/collab/*.md 下的所有 Markdown 文件sdocollaborators.py#L154-L158逐个创建collaborator对象每个collaborator对象会生成https://schema.org/docs/collab/ref形式的 URIsdocollaborators.py#L39供词表中的:contributor三元组引用_parseDesc()sdocollaborators.py#L61专门解析这类文件的 front matter 与 section 标记其中DescriptionText段的内容会被解析为协作方的描述文本sdocollaborators.py#L100未知的 section 会被显式报错sdocollaborators.py#L107体现了严格的格式校验。同时构建词表页面时software/util/buildocspages.py 会汇总所有协作方collabs()与createCollab()见 buildocspages.py#L245-L256并生成协作方页面。因此GoodRelationsClass.md/GoodRelationsTerms.md中img:、title:、url:等 front matter 字段以及DescriptionText.md、AcknowledgementText.md段最终会呈现在 Schema.org 站点的协作方Collaborators页面上。六、实战用 GoodRelations 衍生类标记电商页面下面结合仓库中的 data/sdo-examples-goodrelations.txtGoodRelations 主题的真实示例集给出三种语法的可复制标记。该示例集标注的 TYPES 为CompoundPriceSpecification, BankAccount与CompoundPriceSpecification, Car演示了复合价格每月固定费用 按次计费 / 每日租金 按里程计费的经典电商场景。6.1 Microdata复合价格银行账户场景银行账户每月 5 美元 每笔交易 0.10 美元使用CompoundPriceSpecification组合两个UnitPriceSpecificationdiv itemscope itemtypehttps://schema.org/Offer h1 itempropdescriptionOur Private Bank Account Package: Low monthly fees and fair per-use charges./h1 b itempropnamePrivate Bank Account Package/b span itempropitemOffered itemscope itemtypehttps://schema.org/BankAccount span itempropnameACME Private Bank Account/span APR: meta itempropannualPercentageRate content0.03143.14% /span span itemproppriceSpecification itemscope itemtypehttps://schema.org/CompoundPriceSpecification span itemproppriceComponent itemscope itemtypehttps://schema.org/UnitPriceSpecification span itempropprice5/span meta itemproppriceCurrency contentUSD US$ meta itempropunitCode contentMON per month /span span itemproppriceComponent itemscope itemtypehttps://schema.org/UnitPriceSpecification span itempropprice0.10/span meta itemproppriceCurrency contentUSD US$ span itempropunitText per transaction/span /span /span /div要点说明priceComponent用于组合多个UnitPriceSpecification每个分量用unitCode如MON表示按月DAY表示按天SMI表示英里或unitText描述计价单位annualPercentageRate等银行账户专属属性属于 BankAccount 的扩展字段与 GoodRelations 的价格模型同框使用该示例在当前仓库中只有 Microdata 与 JSON-LD 两种语法版本data/sdo-examples-goodrelations.txt 中明确注明 This example is currently available in Microdata and JSON-LD syntaxes only.。6.2 JSON-LD复合价格租车场景租车每日 50 美元 每英里 0.10 美元script typeapplication/ldjson { context: https://schema.org, type: Offer, description: Our standard rental car is 50 USD per day and and $ 0.10 per mile., name : Rental Car Package, itemOffered : { type : Car, name : Volkswagen Golf Class Car }, priceSpecification : { type : CompoundPriceSpecification, priceComponent : [ { type : UnitPriceSpecification, price : 50, priceCurrency : USD, unitCode : DAY }, { type : UnitPriceSpecification, price : 0.10, priceCurrency : USD, unitCode : SMI } ] } } /script6.3 面向开发者的运行环境说明上述示例属于 Schema.org 的标准电商标记无需任何构建即可在任意支持 Microdata / JSON-LD 的页面中直接使用若要在本地复现示例校验流程可参考 software/scripts/validate_examples_shacl.py 与 software/tests/examples_validate.py 了解 Schema.org 如何对这类示例做 SHACL/ShEx 形状校验完整词表以多种序列化格式随发布版本提供可在 data/releases 目录如 data/releases/30.1中查看每个版本对应的schemaorg-current-https.ttl、schemaorg-all-http.jsonld、schemaorg-current-https-types.csv等产物供程序化读取与集成。七、如何在当前仓库中定位与验证如果你需要在代码中处理 GoodRelations 相关词汇以下路径值得重点关注目的路径查看 GoodRelations 类协作说明data/collab/GoodRelationsClass.md查看 GoodRelations 属性协作说明data/collab/GoodRelationsTerms.md查看 70 个属性的贡献者声明data/gr-property-acks.ttl查看词表主源类、属性、枚举取值data/schema.ttl查看 GoodRelations 主题示例集data/sdo-examples-goodrelations.txt查看协作文档解析与校验逻辑software/SchemaTerms/sdocollaborators.py查看协作方页面构建逻辑software/util/buildocspages.py八、小结GoodRelations 对 Schema.org 的贡献不是一次性的借鉴而是一条完整的协作链路从data/collab/GoodRelationsClass.md与data/collab/GoodRelationsTerms.md的协作声明到 data/gr-property-acks.ttl 中 70 个属性的逐条致谢再到 data/schema.ttl 中:contributor三元组、owl:equivalentClass等价声明以及枚举类中保留的http://purl.org/goodrelations/v1#...遗留取值最终体现在可供开发者直接使用的 Offer / Product / PriceSpecification / DeliveryMethod / PaymentMethod 等电商词汇与示例上。理解这条链路有助于电商站点开发者厘清词汇来源、正确选用属性与取值并写出与搜索引擎语义一致的 RDFa / Microdata / JSON-LD 标记。赞分享知识图谱数据【免费下载链接】schemaorgSchema.org - schemas and supporting software项目地址https://gitcode.com/gh_mirrors/sc/schemaorg点击查看免费下载相关推荐从 IPTC rNews 到 Schema.org新闻出版元数据词汇的衍化落地与 NewsArticle 标记实战从 IPTC rNews 到 Schema.org新闻出版元数据词汇的衍化落地与 NewsArticle 标记实战 导读 rNews 是 IPTC国际新闻电知识图谱数据Schema.org 中的 GoodRelations 词表电子商务数据模型与协作贡献机制解析Schema.org 中的 GoodRelations 词表电子商务数据模型与协作贡献机制解析 Schema.org 是一个由 Google、Microsof知识图谱数据Schema.org 书目扩展BibEx从 Bib 扩展词汇到 Periodical / PublicationIssue 的完整落地指南Schema.org 书目扩展BibEx从 Bib 扩展词汇到 Periodical / PublicationIssue 的完整落地指南 本文围绕 Sc知识图谱数据上一篇刷完镜像不跑码四步搞定 amlogic-s9xxx-armbian 历史版本镜像获取下一篇Metaflow OSS UX 测试套件实战指南基于 Runner/Deployer API 的端到端测试体系创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
返回列表