有没有经验,可以解释如何在HTML页面中正确使用结构数据。简单的事情很容易,但如何执行困难的事情?是否可以使用schema.org和GoodRelations等不同的标准。
我想有以下结构:
一个人,他的职业是一名医学博士。专业是神经病学和儿科。
这个很容易(可能有一些错误):
<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>
答案 0 :(得分:1)
Schema.org为您提供了结构表示的不同类型的数据类型。访问他们的网站并检查可用的数据类型。网站上有简单的程序来添加架构。
答案 1 :(得分:1)
您可以在RDFa中使用schema.org
中的术语,而您的GoodRelations示例也在RDFa中。所以两者兼用。 RDFa的一个优点是它是可扩展的和开放式的。
答案 2 :(得分: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
一个特例是 架构: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