Schema.org Accommodation with price? - schema.org

I'm attempting to add a schema for an Accommodation, but I can't seem to find a way to reference the 'offer' or 'price' to this schema. Im using JSON-LD to format this schema.
I have also tried room/hotelRoom as an alternative. I also tried using the additionalType value to allow me to use product based options such as offers, but this didn't work.
JSON-LD:
{
"#context": "http://schema.org",
"#type": "Accommodation",
"additionalType": "Product",
"name": "example",
"offers": {
"#type": "Offer",
"name": "1 Night",
"priceSpecification": {
"#type": "PriceSpecification",
"price": 1,
"minPrice": 1,
"maxPrice": 2,
"priceCurrency": "GBP"
}
}
}
Google Structured Data Testing Tool:
The property offers is not recognized by Google for an object of type Accommodation.
How am I meant to add a price to a specific accommodation/room in my schema?

Schema.org intends¹ that authors use MTEs² in this case. That, however, does of course not necessarily mean that all consumers fully support this (yet).
So instead of:
"#type": "Accommodation",
you would use:
"#type": ["Accommodation", "Product"],
(additionalType": "Product", is not needed anymore, so could be removed)
While Google’s Structured Data Testing Tool only displays one type (seems to be always the first value in the array), it reports no errors when using this.
¹ The accommodation documentation does not yet reflect this (the changes are currently part of the draft for the next version), and the topic gets discussed here:
Remove Accommodation from all of the Offer-related schema and use MTEs instead
Hotel examples and documentation must be updated for MTE pattern
² MTE: Multi-Typed Entity.

Related

Can JSON-LD "#id" be used to link to an item described on another web page?

I'm attempting to make correct and efficient use of schema.org json-ld recommandations for adding semantic to a web page.
I have a web page for unique organizations (http://example/organization1):
{
"#context": "http://schema.org/",
"#type": "Organization",
"#id" : "#ID_Organization1",
"name": "Organization1",
"url": "https://myorganization1.com
}
Can I reuse the information on that organization on another page without having to redeclare it ? (http://example/offers)
{
"#context": "https://schema.org/",
"#type": "Review",
"itemReviewed" : {
"#type" : "Organization",
"#id" : "http://example/organization1#ID_Organization1"
},
}
Check the following JSON-LD 1.1 documentation information:
3.3 Node Identifiers
To be able to externally reference nodes
in an RDF graph, it is important that nodes
have an identifier. IRIs are a fundamental concept of Linked Data, for
nodes to be truly linked, dereferencing the identifier should result
in a representation of that node. This may allow an application to
retrieve further information about a node. In JSON-LD, a node is identified using the #id keyword.
This probably means that there is no limit to using this element.

"Unspecified Type" in Structured Data Testing Tool

I have recently written json schema for my client's local business with multiple locations. I have run it through Google's Structured Data Testing Tool, but I have noticed that it is defined as "unspecified type" rather than LocalBusiness.
I am also trying to implement this schema onto my client's WordPress site via Google Tag Manager and it has not seemed to work (I am guessing that this is because it is unspecified type rather than LocalBusiness?).
You didn’t post your JSON-LD, but from the output of Google’s SDTT, I would guess that this is the reason:
You’re using graph instead of #graph. Without the #, it gets interpreted as a Schema.org property (which doesn’t exist), not as a way defined in JSON-LD to provide multiple top-level items.
So instead of something like
{
"#context": "http://schema.org",
"graph":
[
{
"#type": "Organization"
},
{
"#type": "LocalBusiness"
}
]
}
you need to have something like
{
"#context": "http://schema.org",
"#graph":
[
{
"#type": "Organization"
},
{
"#type": "LocalBusiness"
}
]
}

Using Schema.org for extension plugin info

I've browsed the web for quite some time now, and have a good grasp on how Schema.org works. Now, it comes to mind that one could use Schema.org to let search engines know that this or that website is using particular software on the website, given that some functionality is provided to it. On the other hand, I can't find any references of major players doing so (WordPress, WooCommerce, Magento), so I was wondering:
How would I mark my piece of software, using Schema.org, on customer's website?
What exactly can I add as info to it (name, author, URLs, desc)?
Which types/properties should be used?
To add to point question 3, SoftwareApplication seems pretty much like something that would cover it. In Schema.org’s own examples, like following:
{
"#context": "http://schema.org",
"#type": "Restaurant",
"name": "Tartine Bakery",
"potentialAction": {
"#type": "ViewAction",
"target": [
"http://www.urbanspoon.com/r/6/92204",
{
"#type": "EntryPoint",
"urlTemplate": "http://api.urbanspoon.com/r/6/92204",
"contentType": "application/json+ld"
},
"android-app://com.urbanspoon/http/www.urbanspoon.com/r/6/92204",
{
"#type": "EntryPoint",
"urlTemplate": "urbanspoon://r/6/92204",
"actionApplication": {
"#type": "SoftwareApplication",
"#id": "284708449",
"name": "Urbanspoon iPhone & iPad App",
"operatingSystem": "iOS"
}
},
{
"#type": "EntryPoint",
"urlTemplate": "urbanspoon://r/6/92204",
"actionApplication": {
"#type": "SoftwareApplication",
"#id": "5b23b738-bb64-4829-9296-5bcb59bb0d2d",
"name": "Windows Phone App",
"operatingSystem": "Windows Phone 8"
}
}
]
}
}
Schema.org is used to provide info about an restaurant (why not software?). So, if anyone has an idea of how can this be done, it would be much appreciated.
Schema.org doesn’t offer a property to specify the SoftwareApplication that was used for generating a WebSite/WebPage.
The isBasedOn property might be used, given its broad definition ("A resource that was used in the creation of this resource."), but I guess it was not intended for this purpose.
Instead of specifying the software that is used for generating the pages (which is typically not interesting for consumers, especially since it doesn’t necessarily follow that certain features are available), it might make more sense to specify the potential actions offered by the site/pages:
RegisterAction
CommentAction
SearchAction
BuyAction
etc.
And from such an Action, you could use (where applicable) the target property to specify an EntryPoint which can specify with actionApplication which software is used to "complete the request".
(By the way, you can specify the software that was used to generate the HTML document as meta tag, no need for structured data: generator)

What is the length of the 'description'/'name' properties for the 'Product' type in Schema.org?

I am playing with Schema.org, creating extensions for Google Rich Snippets based on JSON-LD, using https://schema.org/Product.
{
"#context": "http://schema.org/",
"#type": "Product",
"name": "Executive Anvil",
"image": "http://www.example.com/anvil_executive.jpg",
"description": "Sleeker than ACME's Classic Anvil, the Executive Anvil is perfect for the business traveler looking for something to drop from a height.",
"mpn": "925872",
"brand": {
"#type": "Thing",
"name": "ACME"
}
}
But I do not understand which how long the value for description and name can be. Seems to me that this is a very important value.
The vocabulary Schema.org doesn’t restrict the length that Text values can have. Not for Product nor for any other type.
Consumers (like Google Search) might have their own rules/restrictions. These should, hopefully, be described in their documentation. For Google’s Products rich result, no restrictions are specified for name/description.
Google indicates between >50 and <5000

Using the HAL vocab with JSON-LD

I was wondering, is there a way to use the HAL concepts with JSON-LD?
I have the current jsonld document:
{
"#context": {
"hal": "http://stateless.co/hal#",
"schema": "http://schema.org",
"_links": {
"#id": "hal:link",
"#container": "#index"
}
},
"#type": ["schema:Person", "hal:Resource"],
"name": "Jon Snow",
"_links": {
"self": {
"href": "/users/123"
}
}
}
but I am not sure how to define that the href has a #type of #id, and so on...
Is there a way to define a HAL vocab based on RDF(S) and import it somehow in the #context of my jsonld documents, or should I do something else?
(I am trying to describe hyperlinks with various properties, like link relation, HTTP method, accepted media type, language, IRI template, input fields, etc... so the #id type is not enough for me to describe links.)
As Tomasz already suggested, you should really consider using Hydra as it does more or less what you want. The example you've included in your questions, would look somewhat like this using Hydra and JSON-LD:
{
"#context": {
"schema": "http://schema.org",
"ex": "http://example.com/myvocab#"
},
"#id": "/users/123",
"#type": [ "schema:Person", "hydra:Resource" ],
"name": "Jon Snow",
"ex:link": { "#id": "/another-resource" }
}
As there's no need for a "self" link (#id already specifies that explicitly), I've added another link, ex:link. Its link relation is consequently http://example.com/myvocab#link and its "href" is /another-resource. If you need to describe that link/property in more details, you can do so by creating a document which defines it in exactly the same manner as other things are described (as Tomasz also already explained):
{
"#context": {
"ex": "http://example.com/myvocab#",
"hydra": "http://www.w3.org/ns/hydra#"
},
"#id": "ex:link",
"#type": "hydra:Link",
"hydra:title": "My new link relation",
"hydra:supportedOperation": [
{
"#type": "hydra:Operation",
"hydra:method": "POST",
"hydra:expects": ....
}
]
}
Regarding your comment
Btw. I am more or less familiar with the Hydra vocab, but I don't like
the idea to map the resources to real classes and objects on a server
side language and automatically transform the operation parameters
into those objects. Maybe it is possible to use the Hydra vocab in
another way, but I don't have the time to experiment with that.
Hydra is really just a vocabulary. It is up to you to decide how to use it. I think you are talking about the HydraBundle above. That's just one way to use it. It is just a proof of concept to show that it is easily possible. So please don't get confused by that.
I would like to invite you to join the Hydra W3C Community Group. We can then discuss this in more detail on our mailing list.
Disclaimer: I'm the creator of Hydra and the chair of the Hydra W3C Community Group.
I think you could be interested in Hydra. Have you tried that?
It's a vocabulary for describing Hypermedia links and operations. Here's how it could work for a simple parent link
{
"#context": {
"schema": "http://schema.org",
"parent": {
"#id": "/vocab#parent"
"#type": "#id"
}
},
"#id": "/users/123",
"#type": "schema:Person",
"name": "Jon Snow",
"parent": "/users/Ned_Stark"
}
Note that you don't need to include any data outside your domain in the representation. Instead you describe what the parent predicate means
{
"#context": "http://www.w3.org/ns/hydra/context.jsonld",
"#id": "/vocab#parent",
"#type": "hydra:Link"
}
You can also describe operations (HTTP methods, ranges, domains, etc.) and properties for classes. Also the operations can be included directly in the representation or attached to the classes and proeprties.