Skip to content
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

Any way to optionally provide a more-specific type? #274

Open
jyasskin opened this issue Dec 21, 2023 · 0 comments
Open

Any way to optionally provide a more-specific type? #274

jyasskin opened this issue Dec 21, 2023 · 0 comments

Comments

@jyasskin
Copy link

The https://schema.org/recipeIngredient property refines supply to require the content to be Text. But ingredients have structure, which I'd like to expose to consumers that can understand it, so they can scale amounts if they want to. Is there a way in schema.org markup to indicate that one value is a refined version of another value?

For example:

{
  "@context": "http://schema.org",
  "type": "Recipe",
  "recipeIngredient": {
    "type": "HowToSupply",
    "requiredQuantity": {
      "type": "QuantitativeValue",
      "value": "1/4",
      "unitText": "tsp"
    },
    "name": "sugar"
  }
}

fails to validate.

{
  "@context": "http://schema.org",
  "type": "Recipe",
  "recipeIngredient": [{
    "type": "HowToSupply",
    "requiredQuantity": {
      "type": "QuantitativeValue",
      "value": "1/4",
      "unitText": "tsp"
    },
    "name": "sugar"
  }, "1/4 tsp sugar"]
}

will give the right content to processors that don't understand the HowToSupply type, but the ingredient will be duplicated for any that do understand it.

rdf:Alt seems like the standard way to encode this, but

{
  "@context": "https://schema.org",
  "type": "Recipe",
  "recipeIngredient": {
    "type": "rdf:Alt",
    "rdf:_1": {
      "type": "HowToSupply",
      "requiredQuantity": {
        "type": "QuantitativeValue",
        "value": " 1/4 ",
        "unitText": "tsp"
      },
      "name": " egg whites "
    },
    "rdf:_2": "1/4 tsp egg whites"
  }
}

also fails to validate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant