Schema.org for complex or multi-part recipes - schema.org

I am trying to determine how to mark up a Recipe in Schema.org where the recipe has multiple sub-recipes.
For example: A Victoria Sponge might have:
Set #1: Ingredients, preparation steps, and prep/cook times for the Sponge
Set #2: Ingredients, preparation steps, and prep times for the Filling
Set #3: Ingredients, preparation steps, and prep times for the Icing/Topping
I have seen recipe examples where all the ingredients are together in a list and the instructions/steps then attempt to determine which is use at which point, but this is not really satisfactory.
Obvious approaches are: separate recipe components, or perhaps an "array" of ingredients and steps. And, I can see it ought to be possible using a HowTo structure of steps of sub-recipes, but cannot see how.
I'd really like to see an example that has actually been tried. I am using JSON-LD, but anything that demonstrates a principle would be much appreciated!

If you need to group the ingredients per "sub-recipe", you have to provide multiple Recipe items, because the recipeIngredient property is only defined for the Recipe type.
I don’t know if such a model was intended, but it seems to be possible with the specified expected values. It works if you think that a Recipe instruction step can be a Recipe itself.
JSON-LD example
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Recipe",
"recipeInstructions": {
"#type": "ItemList",
"itemListElement": [
{
"#type": "ListItem",
"position": 1,
"item": {
"#type": "HowToStep"
}
},
{
"#type": "ListItem",
"position": 2,
"item": {
"#type": "HowToSection",
"steps": {
"#type": "Recipe"
}
}
},
{
"#type": "ListItem",
"position": 3,
"item": {
"#type": "HowToStep"
}
}
]
}
}
</script>
Example explanation
The main Recipe has three instruction steps.
ListItem is used to give each step a position (so that the ItemList is ordered).
The first and the last steps are HowToStep items. A HowToStep is a list that can take HowToDirection and HowToTip items as list entries.
The second step is a HowToSection item. HowToSection is a "sub-grouping of steps". Its definition gives this example, which seems to fit your case:
steps for making a pie crust within a pie recipe
Now, instead of representing this HowToSection’s steps again as a list of HowToStep items, the sub-recipe is given as Recipe item. This is possible because steps has CreativeWork as expected value, of which Recipe is a sub-type.
(Note that Google’s SDTT doesn’t recognize the HowTo types yet. They were introduced with the current Schema.org version 3.3, which was released last month.)

Related

Enable users of github program to configure their own DCMake prefix path

Consider a situation where people work together on the same code base; c++ with cmake. Code base depends on a library, that must be installed separately.
Each user may have the library in a different location. A user may invoke cmake like this:
cmake -DCMAKE_PREFIX_PATH=/path/for/that/user .
However, this is not very easy in all circumstances (e.g. windows and visual studio), and requires retyping. So instead, we have
list(APPEND CMAKE_PREFIX_PATH "/path/for/user")
In the CMakeLists.txt. This works, but requires people to constantly change that path after pulling a branch, which is annoying and easily forgotten. Is it possible to configure in a way that pulling new branches does not override this path, once set on a specific machine?
You can have each of your users create their own CMakeUserPresets.json file, and set it in the cacheVariables field of a configurePresets entry.
// CmakeUserPresets.json
{
"version": , // pick one
"cmakeMinimumRequired": {
"major": , // pick one
"minor": , // pick one
"patch": // pick one
},
"configurePresets": [
{
"name": "starball",
"displayName": "Starball's config",
"description": "Starball's private configuration preset",
"generator": "...",
"binaryDir": "...",
"cacheVariables": {
"CMAKE_PREFIX_PATH": "..."
},
"environment": {}
}
],
// ...
}
Make sure to put CMakeUserPresets.json in your .gitignore file (or whatever else you have to do for your specific VCS so that the user preset file isn't tracked in the VCS).

How to get all-contributers github app to render table of contributors and badge?

I'm using https://github.com/all-contributors/all-contributors, and I've gone through every detail I can on their documentation https://allcontributors.org/ as well. And been trying different things for the past 2 hours but I can't get this app to render the table of contributors. Their documentation is incredibly poor.
I have:
{
"files": [
"readme.md",
"docs/authors.md",
"docs/contributors.md"
],
"imageSize": 100,
"contributorsPerLine": 7,
"contributorsSortAlphabetically": false,
"badgeTemplate": "[![All Contributors](https://img.shields.io/badge/all_contributors-<%= contributors.length %>-pink.svg)](#contributors)",
"contributorTemplate": "<img src=\"<%= contributor.avatar_url %>\" width=\"<%= options.imageSize %>px;\" alt=\"\"/><br /><sub><b><%= contributor.name %></b></sub>",
"types": {
"contributor": {
"symbol": "❤️",
"description": "Contributor ❤️",
"link": "[<%= symbol %>](<%= url %> \"<%= description %>\"),"
}
},
"skipCi": true,
"contributors": [],
"projectName": ".github",
"projectOwner": "owner",
"repoType": "github",
"repoHost": "https://github.com"
}
I then use #all-contributors add #somename to code and it does correctly add it to the .all-contributersrc file, however it doesn't render the table in the readme.md.
I've also tried to hardcode the list in readme using:
<!-- ALL-CONTRIBUTORS-LIST:START -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
But no luck, nothing happens.
I also can not get the badge working. I can hardcode the badge and display "a" badge, but it never uses the above template badge with dynamic contributor length. So it's also not injecting the badge or using that template badge at all.
How can I get this bot to correctly show the badge and show the contributor list and generate the table in readme.md?
Note: I'm not interested in using node or running some generate command manually locally, then it defeats the point of using that app at all, then I can just as well do it myself. According to their documentation it should be generating the table automatically on first contributor, but it does not.
Also when I go to https://raw.githubusercontent.com/all-contributors/all-contributors/master/README.md in raw view, I can see:
Which tells me it has to be generating that table somehow, but it doesn't seem to work.
You can try and emulate other repositories using the same bot, like:
AtlasFoundation/AvatarCreator with this commit.
mrz1836/go-nownodes and its own .all-contributorsrc file
As an alternative, the estruyf/vscode-front-matter does include its own contributor list, using this commit which calls contrib.rocks.

Refer separately deployed components for reuse in an ui5 app

i'm developing some apps, for which everyone needs to show a document in the same way. For this i created a new component which handles my documents in a separate component. I then just want to reuse this component from my different apps.
To embed my reuse component i used something like this in my view.xml:
<core:ComponentContainer
name="de.mycomp.base.DocViewer"
component="de.mycomp.base.DocViewer"
settings='\{"param1":"value1"\}'/>
To access it during runtime i have to declare the namespace of the reuse component and associate it with an resource-url. To achive this, i used the following coding in the init-method of my Component.js which uses my reuse-component DocViewer.
jQuery.sap.registerModulePath("de.mycomp.base.DocViewer", "/sap/bc/ui5_ui5/sap/zdocviewer");
zdocviewer in this case is the name of the bsp-application to which the reuse-component was deployed on premise. To have this also work in webide and on SAP-Cloud-Plattform i needed to add an entry to neo-app.json
like this:
{
"path": "/sap/bc/ui5_ui5/sap/zdocviewer",
"target": {
"type": "application",
"name": "docviewer"
},
"description": "my base document viewer"
},
where docviewer is the name of the deployed app with the reuse component on SCP.
The type application implies that this destination is an app.
This works so far on premise and on sap cloud.
but my problem is that i dont want to have the registerModulePath in my Component.js. Nearly every configuration of components takes place in the manifest.json file. So i tried to move this coding line to configuration in manifest.json, but i failed so far.
Here's what i did:
i added a dependency in section sap.ui5 and there in the dependency-entry like this:
"components": {
"de.dvelop.base.DvelopBaseDocViewer": {
"lazy": true
}
}
i added the following entry to sap.ui5 part
"resourceRoots": {
"de.dvelop.base.DvelopBaseDocViewer": "/sap/bc/ui5_ui5/sap/zdocviewer"
},
The problem here is, that its not allowed to use absolute paths in the value-part of the resource-root entries. So this is invalid:
- /sap/bc/ui5_ui5/sap/zdocviewer
- ../sap/bc/ui5_ui5/sap/zdocviewer
Only this is valid:
- sap/bc/ui5_ui5/sap/zdocviewer
- ./sap/bc/ui5_ui5/sap/zdocviewer
So this annotation is only usable for embedded components, where the reuse-component is in the same deployed project. But this is not my understanding of a reuseable component. So changing something in that component would make it neccessary to copy the files to all the app-projects using the component. And they all have to be deployed again.
So for now i made a fallback to the jquery.sap.registerModulePath because this works with deployed components to refer them from other independent components.
Or does anybody have an idea how to handle this better or more proper within manifest.json?
kind regards
Matthias
see here: ui5 reuse components: https://github.com/Yelcho/UI5-Comp-Routing
you mixed up here old and new approches, wrinting all steps in this answer would be very long. Here brief step to step approche:
define your componentUsages
"componentUsages": {
"myDoc": {
"name": "com.company.myDoc",
"settings": {},
"componentData": {},
"lazy": true
}}
define path mapping, in resourceRoots
"resourceRoots": {
"com.company.myDoc": "/sap/bc/ui5_ui5/sap/zdocviewer"
},
define a targed type component
"targets": {
"myDocTarget": {
"type": "Component",
"usage": "myDoc"
}
use nested routing
.getRouter()
.navTo("myDocRoute", {
id: oBindingContext.getProperty("CategoryID")
}, {
products: {
route: "list",
parameters: {
}
}
});

What are the rules for class names in IBM Watson Visual Recognition service?

I'm exploring IBM Watson Visual Recognition service and when I create a classifier using classnames like 'black-dog' (i.e. black-dog_positive_example), this classname is later returned as 'black_dog' (with underscore replacing dash) when I classify an image using the /v3/classify endpoint.
But when I retrieve the classifier details with the /v3/classifiers/{classifier_id} the class is correctly listed as 'black-dog'.
So, my result for GET /v3/classifiers/{classifier_id} is like:
{
"classifier_id": "dog_561932172",
"name": "dog",
"owner": "xxxxxxxx-xxx-xxx-xxx-xxxxxxxxxxxx",
"status": "ready",
"created": "2016-07-30T22:06:39.327Z",
"classes": [
{"class": "black-dog"}
]
}
While my result for GET /v3/classify is
{
"custom_classes": 1,
"images": [
{
"classifiers": [
{
"classes": [
{
"class": "black_dog",
"score": 0.546941
}
],
"classifier_id": "dog_561932172",
"name": "dog"
}
],
"image": "20160620_142113.jpg"
}
],
"images_processed": 1
}
So is this expected or a defect? Should I avoid using "-" in class names? Are there any other rules for the value of a classname?
Update:
Updated via Matt's answer.
Talked with the support team, and it is indeed a bug. Here was their response:
Thanks for pointing this out. I reproduced and confirmed with dev team, and we do consider this inconsistency between the listed class name and the class name in results is a bug.
And this is because the class name been altered in result from what is submitted.
I have raised a ticket for tracking on this. According to developer, currently the output can be either a document to list the substitutions or find a way to remove them.
...so they are currently working on it.
Are there any other rules for the value of a classname?
We made an update, and the service should no longer modify any class names like replacing a dash with an underscore. Instead, it will not accept class names with any of these characters for custom learning: \,|,*,{,},$,-,/,',`,"
(You'll see the dash is included in there.) Spaces are acceptable. The update is not retroactive, so existing class names that were modified during training are not affected.

Uploading files to Plunker

Is there any way to upload multiple files to http://plnkr.co, instead of copy-pasting the code all the time? Would be great if a plunker could be connected to a github repository, or if a set of files could be dragged in.
There is no built-in way to upload multiple files to Plunker.
Users have built tools to facilitate this. Please see: https://www.npmjs.org/package/plunk which is a command-line utility that will let you create plunks from the contents of a directory.
You can also bootstrap plunks by making POST requests to http://plnkr.co/edit/ where the payload has the following format:
{
"description": "Plunk description", // Optional
"tags": ["tag1", "tag2", ..., "tagN"], // Optional
"files": {
"filename1.ext": "contents of filename1.ext",
"filename2.ext": "and so on.."
}
}
Code for this handler: https://github.com/filearts/plunker_www/blob/0c608ae80ef30d59bfdfeaf3c2a28563f7b730e4/app.coffee#L105-L121