如何为'House'添加'Offer'(不是'Product'子类型)?

时间:2018-04-17 09:26:57

标签: schema.org json-ld

我的想法是House定义,然后是Product Offer。但我不卖其他产品,我卖房子。

Product方案内部有Offer架构,但House方案没有。Offer方案。如何在我的House架构定义中放置架构<script type='application/ld+json'> { "@context": "http://schema.org/", "@type": "House", "numberOfRooms": "4", "floorSize": { "@type": "QuantitativeValue", "unitCode": "metros cuadrados", "value": "120", "description": "En Venta piso amplio, exterior, salón, cocina, 4 dormitorios, 1 cuarto de despensa/lavadora, 2 baños (con ventanas), 1 terraza, 5 armarios empotrados, plaza de garaje y 2 rochos (1 bajo cubierta y otro al lado plaza garaje). 120 m2 en planta. 4ª planta " }, "address": { "@type": "PostalAddress", "addressCountry": "España", "addressLocality": "Burela", "addressRegion": "A Mariña", "postalCode": "27880", "streetAddress": "Lamestra 9", "description": "A 130 metros de la playa " }, "geo": [ "-7.360289", "43.662696" ], "hasMap": "http://www.softgalia.com/mapapisoburela", "photos": "http://dechado11.softgalia.com/galerias/index", "telephone": "677524729" } } </script>

现在我有了这段代码:

n = 0     # starting index of pile 1
for i in range(3):
    print("Pile ",[i+1])
    for j in range(n,n+7):
        print(deck[j])
    n = n+7     # update the index to next pile

2 个答案:

答案 0 :(得分:1)

itemOffered属性需要ProductService值,但House不是。House。另一方面:无法在Product上指定offers属性,而是ServiceCreativeWorkHouse等。

如果你出售房子,这房子就成了产品。因此,您应该提供一个包含两种类型的实体:Product { "@context": "http://schema.org", "@type": "Offer", "itemOffered": { "@type": ["House", "Product"] } }

{
  "@context": "http://schema.org",
  "@type": ["House", "Product"],
  "offers": 
  { 
    "@type": "Offer"
  }
}
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("arguments[0].click();", driver.findElement(By.id('listing-step1')));

答案 1 :(得分:0)

感谢Jay Gray的帮助。这是我的代码。

<script type="application/ld+json">
{
    "@context": "http://schema.org",
    "@type": "Offer",
    "price": "155.000 €",
    "priceCurrency": "EUR",
    "availableAtOrFrom": 
    {
        "@type": "Place",
            "address": {
              "@type": "PostalAddress",
                "addressCountry": "España",
                "addressLocality": "Lugo",
                "addressRegion": "Lugo",
                "postalCode": "27002",
                "streetAddress": "Primavera 40"
          },
          "telephone": "+34 677524729",
          "geo": 
          {
            "@type": "GeoCoordinates",
                "latitude": "-7.360232",
                "longitude": "43.662330",
                "postalCode": "27002"
           }
     },
    "itemOffered": 
    { 
      "@type": "House",
      "numberOfRooms": "4",
      "floorSize": {
          "@type": "QuantitativeValue",
          "unitCode": "metros cuadrados",
          "value": "120",
          "description": "En Venta piso amplio, exterior, salón, cocina, 4 dormitorios, 1 cuarto de despensa/lavadora, 2 baños (con ventanas), 1 terraza, 5 armarios empotrados, plaza de garaje y 2 rochos (1 bajo cubierta y otro al lado plaza garaje). 120 m2 en planta. 4ª planta "
      },
      "amenityFeature": "Al 130 metros de la playa O Cantiño, y en pleno centro de Burela. Supermercado a 150 metros y a 70 metros del parque Rosalía de castro y al mismo tiempo es una zona tranquila. Su situación es inmejorable.",
      "address": {
          "@type": "PostalAddress",
          "addressCountry": "España",
          "addressLocality": "Burela",
          "addressRegion": "A Mariña",
          "postalCode": "27880",
          "streetAddress": "Lamestra 9",
          "description": "A 130 metros de la playa "
      },
      "geo": [
          "-7.360232",
          "43.662330"
      ],
      "hasMap": "https://www.google.es/maps/place/43%C2%B039'44.4%22N+7%C2%B021'36.8%22W/@43.6623443,-7.3690083,3324m/data=!3m2!1e3!4b1!4m8!1m2!2m1!1sR%C3%BAa+da+Lamestra,+Burela!3m4!1s0x0:0x0!8m2!3d43.6623297!4d-7.3602321",
      "photos": [ "http://dechado11.softgalia.com/galerias_imagenes/foto-de-la-entrada-vista-hacia-el-despacho", 
                  "http://dechado11.softgalia.com/galerias_imagenes/bano-piso-venta-burela"      
                ],
      "telephone": "677524729"
      }
    }   
}