-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use JSON-LD schemas from schema.org #113
Comments
NotesChecking unique keys in the
returns
There are only a small number of keys to worry about - and most will map to schema.org types. I think I'll go ahead and start introducing JSON-LD to the API. |
NotesPer discussions on Schema.org, repeated values are fine. This is valid Product data: {
"@context": "https://schema.org",
"@type": "Product",
"additionalProperty": [
{
"@type": "PropertyValue",
"name": "myCustomProperty",
"value": "my custom value"
},
{
"@type": "PropertyValue",
"name": "myOtherCustomProperty",
"value": "my other custom value"
}
],
... so we can use an array NB Can use https://validator.schema.org/ to validate data |
DEV NOTEMight be also worth getting my head around SHACL Also, JSON-LD Best Practices |
The lack of any formal structure in the data has always bothered me, as we basically store everything in one blob of JSON data. In the general case this is fine, but when products/items have very definite properties (e.g. a
Book
has anauthor
, food items havecalories
, etc) it gets harder to ensure that the data makes sense - or is consumable in a repeatable way.Proposal
Brocade.io to start using JSON-LD as the base model for all data presented via the API, using schemas published by third-parties like https://schema.org.
For instance, if we adopt the "Product" type from schema.org, we can structure product information that is both human-readable and easily processed by applications:
JSON-LD also enables us to add a graph for extended attributes, e.g. if nutritional information is available for a product we can use the NutritionInformation type to present these attributes in a structured manner:
Other types from schema.org can be used as applicable (e.g. Book, Movie), etc. We can also make use of schemas published by other third parties - or our own custom types - as required and potentially "future proof" the underlying data model.
We can also use the type information in the frontend, using schema types to determine the best way to present data like nutritional information in a table-like format (see #11). We can also use to insert Microdata into the HTML to nest metadata suitable for search engines, web scrapers and the like to consume.
Benefits
Risks / Possible Problems
We can mitigate the second problem by processing individual products on demand and progressively update data. The problem of parsing data requires a bit more thought and investigation, but it looks like a solvable problem.
The text was updated successfully, but these errors were encountered: