Is this proper Schema.org/Microdata markup for a building?

青春壹個敷衍的年華 提交于 2019-12-12 03:53:59

问题


I am trying to add Microdata notation (using Schema.org) to my website which basically talks about buildings. I’ve been reading a lot about it but I’m still having trouble figuring out where to use itemscope, itemtype and itemprop.

Can anybody tell me if this is good Microdata/Schema.org markup or if I’m missing something?

<div class="infobox infobox_building" itemscope itemtype="http://schema.org/LandmarksOrHistoricalBuildings">

    <!-- Building Name -->
    <h1 class="page_title">Puente Golden Horn Metro</h1>

    <!-- Architect -->
    <div class="data_row architect" itemscope itemtype="http://schema.org/creator">
        <div class="tag cell">Arquitecto</div>
        <div class="value cell">
            <a href="https://stage.wikiarquitectura.com/arquitecto/virlogeux-michel/" itemprop="Person">Michel Virlogeux</a>
            <a href="https://stage.wikiarquitectura.com/arquitecto/kiran-hakan/" itemprop="Person">Hakan Kıran</a>                                                  
        </div>
    </div>

    <!-- Height -->
    <div class="data_row" itemscope itemtype="http://schema.org/height">
        <div class="tag cell">Altura</div>
        <div class="value cell" itemprop="QuantitativeValue">65m</div>
    </div>

    <!-- Width -->
    <div class="data_row" itemscope itemtype="http://schema.org/width">
        <div class="tag cell">Ancho</div>
        <div class="value cell" itemprop="QuantitativeValue">12,6m</div>
    </div>

    <!-- Location -->
    <div class="data_row" itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
        <div class="tag cell">Ubicación</div>
        <div class="value cell" itemprop="streetAddress">Arap Cami Mahallesi, Beyoğlu/İstanbul, Turquía</div>
    </div>

</div> <!-- infobox -->

回答1:


You seem to confuse properties and types.

In Microdata, properties get specified in the itemprop attribute, while types get specified in the itemtype attribute.

If you only use the vocabulary Schema.org, you’ll use the full URI for types (itemtype="http://schema.org/PostalAddress"), while you use just the slug for properties (itemprop="address").

In Schema.org, it’s easy to see what is what, because they follow the convention that the first letter of properties is lowercase (address), and the first letter of types is uppercase (PostalAddress).


Syntactically, you are doing it correctly with address+PostalAddress, but wrong with creator+Person and height/width+QuantitativeValue.

That said, you are also making some vocabulary errors. The LandmarksOrHistoricalBuildings type can’t have a creator nor a height nor a width property in the first place.

You can see which properties a type can have by visiting the type’s page (LandmarksOrHistoricalBuildings) and checking the first table.




回答2:


I also had the same problem or question like you. Because my buildings are not even historical (when is a building historical?), I created my own schema:

{
   "@context":
   {
      "Place": "http://schema.org/Place",
      "name": "http://purl.org/dc/terms/title",
      "alternateName":"http://purl.org/dc/terms/title",
      "description": "http://purl.org/dc/terms/description",
      "geo": "http://schema.org/geo",
      "image":
      {
        "@id": "http://schema.org/image",
        "@type": "@id"
      },
      "latitude":
      {
        "@id": "http://www.w3.org/2003/01/geo/wgs84_pos#lat",
        "@type": "xsd:decimal"
      },
      "longitude":
      {
        "@id": "http://www.w3.org/2003/01/geo/wgs84_pos#long",
        "@type": "xsd:decimal"
      },


      "containedInPlace":"http://schema.org/Place",
      "containsPlace":"http://schema.org/Place",
      "architect":"http://schema.org/Creator",
      "Address": "http://www.w3.org/2006/vcard/ns#Address",
      "address": "http://www.w3.org/2006/vcard/ns#address",
      "street": "http://www.w3.org/2006/vcard/ns#street-address",      
      "locality": "http://www.w3.org/2006/vcard/ns#locality",
      "region": "http://www.w3.org/2006/vcard/ns#region",
      "country": "http://www.w3.org/2006/vcard/ns#country",
      "postalCode": "http://www.w3.org/2006/vcard/ns#postal-code",

      "meter": "http://purl.org/measurement#meter",
      "kilometer": "http://purl.org/measurement#kilometer",
      "feet": "http://purl.org/measurement#feet",
      "miles": "http://purl.org/measurement#miles",

      "xsd": "http://www.w3.org/2001/XMLSchema#"
   }
}

But I am not sure whether google or some other search services will get the idea. If you have any improvements or ideas to the schema let me know!



来源:https://stackoverflow.com/questions/45362345/is-this-proper-schema-org-microdata-markup-for-a-building

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!