2

有没有人有经验,可以解释如何在 HTML 页面中正确使用结构数据。简单的事情很容易,但困难的事情怎么做呢?是否可以使用不同的标准,例如schema.orgGoodRelations

我想有以下结构:

一个人,其职业是拥有医学职称的医生。专业是神经病学和儿科。

这个很简单(可能有一些错误):

<div xmlns:v="http://rdf.data-vocabulary.org/#" typeof="v:Person">
  <span property="v:title" content="dr. medicine"></span>
  <span property="v:name" content="Real Name"></span>
  <span property="v:role" content="neurology"></span>
  <span property="v:role" content="pediatric"></span>
</div>

下一节呢?此人在三个不同的地方工作:

  • 私人办公室
  • 医疗中心
  • 一所医院

在每个地方,人出现在不同的时间和日子。每个地方都有不同的电话号码和不同的地理位置。这个人在每个地方都有不同的角色:

  • 私人办公室的所有者
  • 医疗中心的正式员工
  • 医院神经科主任

在这里,我感到困惑。如何映射人和地点之间的所有关系?是否可以将结构数据放在不同的网页上?如果是这样,如何引用它们。

组织片段(可能还有很多错误):

<div xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns="http://www.w3.org/1999/xhtml" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:gr="http://purl.org/goodrelations/v1#" xmlns:vcard="http://www.w3.org/2006/vcard/ns#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
  <div about="#poffice" typeof="gr:LocationOfSalesOrServiceProvisioning">
    <div property="rdfs:label" content="Private office"></div>
    <div rel="vcard:adr">
      <div typeof="vcard:Address">
        <div property="vcard:country-name" content="US"></div>
        <div property="vcard:locality" content="New York"></div>
        <div property="vcard:postal-code" content="22 222"></div>
        <div property="vcard:street-address" content="W 4th, 80"></div>
      </div>
     </div>
     <div property="vcard:tel" content="22 222 222 222"></div>
     <div rel="foaf:depiction" resource="http://niceURL/logo.png"></div>
     <div rel="vcard:geo">
      <div>
        <div property="vcard:latitude" content="00.000000" datatype="xsd:float"></div>
        <div property="vcard:longitude" content="00.000000" datatype="xsd:float"></div>
      </div>
     </div>
     <div rel="gr:hasOpeningHoursSpecification">
       <div about="#mon_fri" typeof="gr:OpeningHoursSpecification">
         <div property="gr:opens" content="14:00:00" datatype="xsd:time"></div>
         <div property="gr:closes" content="20:00:00" datatype="xsd:time"></div>
         <div rel="gr:hasOpeningHoursDayOfWeek" resource="http://purl.org/goodrelations/v1#Friday"></div>
         <div rel="gr:hasOpeningHoursDayOfWeek" resource="http://purl.org/goodrelations/v1#Thursday"></div>
         <div rel="gr:hasOpeningHoursDayOfWeek" resource="http://purl.org/goodrelations/v1#Wednesday"></div>
         <div rel="gr:hasOpeningHoursDayOfWeek" resource="http://purl.org/goodrelations/v1#Tuesday"></div>
         <div rel="gr:hasOpeningHoursDayOfWeek" resource="http://purl.org/goodrelations/v1#Monday"></div>
       </div>
       <div rel="foaf:page" resource=""></div>
     </div>
  </div>
</div>
4

3 回答 3

1

Schema.org 为您提供了用于结构表示的不同类型的数据类型。访问他们的网站并检查可用的数据类型。网站上有简单的过程来添加架构。

于 2013-02-11T09:39:29.937 回答
1

您可以使用 RDFa 中的术语schema.org,您的 GoodRelations 示例也在 RDFa 中。所以两者都用。RDFa 的一个优点是它是可扩展的和开放式的。

于 2013-02-20T13:52:39.517 回答
0

请注意,截至 2012 年 11 月,您可以直接从 schema.org 命名空间使用完整的 GoodRelations 概念模型,请参阅

http://wiki.goodrelations-vocabulary.org/Cookbook/Schema.org

参见例如以下示例:

<div itemscope itemtype="http://schema.org/Offer" itemid="#offer">
  <div itemprop="name">Hepp Personal SCSI Controller Card</div>
  <div itemprop="description">The Hepp Personal SCSI is a 16-bit add-on card that allows
attaching up to seven SCSI devices to your computer.</div>
  <link itemprop="businessFunction"
        href="http://purl.org/goodrelations/v1#Sell" />
<!-- Unit price -->
  <div itemscope itemprop="priceSpecification"
       itemtype="http://schema.org/UnitPriceSpecification">Price:
    <meta itemprop="priceCurrency" content="EUR">Euro:
    <span itemprop="price">99.99</span>
    <time itemprop="validThrough"
          datetime="2012-11-30T23:59:59Z"></time>
  </div>
<!-- Shipment fees -->
  Delivery costs to
  <div itemscope itemprop="priceSpecification"
       itemtype="http://schema.org/DeliveryChargeSpecification">
    <meta itemprop="eligibleRegion" content="DE">Germany:
    <meta itemprop="priceCurrency" content="EUR">Euro:
    <span itemprop="price">10.00</span>
    <link itemprop="appliesToDeliveryMethod"
          href="http://purl.org/goodrelations/v1#UPS" />(via UPS)
  </div>
<!-- other offer properties follow here -->
...
</div>

请注意,GoodRelations 命名空间和 schema.org 命名空间之间的某些属性名称略有不同:

课程

schema:Offer = gr:Offering
schema:IndividualProduct = gr:Individual
schema:ParcelService = gr:DeliveryModeParcelService
schema:Place = gr:Location
schema:ProductModel = gr:ProductOrServiceModel
schema:CreditCard = gr:PaymentMethodCreditCard
schema:Product = gr:ProductOrService
schema:SomeProducts = gr:SomeItems

对象属性

schema:priceSpecification = gr:hasPriceSpecification
schema:businessFunction = gr:hasBusinessFunction
schema:eligibleCustomerType = gr:eligibleCustomerTypes
schema:manufacturer = gr:hasManufacturer
schema:warrantyScope = gr:hasWarrantyScope
schema:inventoryLevel = gr:hasInventoryLevel
schema:dayOfWeek = gr:hasOpeningHoursDayOfWeek
schema:brand = gr:hasBrand
schema:itemOffered = gr:includes
schema:makesOffer = gr:offers
schema:availableDeliveryMethod = gr:availableDeliveryMethods
schema:openingHoursSpecification = gr:hasOpeningHoursSpecification
schema:eligibleQuantity = gr:hasEligibleQuantity
schema:warranty = gr:hasWarrantyPromise
schema:image = http://xmlns.com/foaf/0.1/depiction
schema:acceptedPaymentMethod = gr:acceptedPaymentMethods

一个特例是 schema:durationOfWarranty

这曾经是 GoodRelations 中的 gr:durationOfWarrantyInMonths,但很快就会更新以匹配来自 schema.org 的新名称和范围。

数据类型属性

schema:minPrice = gr:hasMinCurrencyValue
schema:unitCode = gr:hasUnitOfMeasurement
schema:isicV4 = gr:hasISICv4
schema:gtin8 = gr:hasGTIN-8
schema:maxPrice = gr:hasMaxCurrencyValue
schema:gtin14 = gr:hasGTIN-14
schema:maxValue = gr:hasMaxValue
schema:mpn = gr:hasMPN
schema:value = gr:hasValue
schema:model = gr:hasMakeAndModel
schema:gtin13 = gr:hasEAN_UCC-13
schema:globalLocationNumber = gr:hasGlobalLocationNumber
schema:naics = gr:hasNAICS
schema:priceCurrency = gr:hasCurrency
schema:sku = gr:hasStockKeepingUnit
schema:duns = gr:hasDUNS
schema:minValue = gr:hasMinValue
schema:eligibleRegion = gr:eligibleRegions
于 2013-12-21T19:03:24.493 回答