Closed ntwi closed 2 years ago
The additionalType
property is not recognised as a type declaration; it is included in schema.org to support formats that microdata where you can only have one property declaration.
In JSON-LD, you can have multiple type declarations. The following code raises no warnings
{
"@context": "https://schema.org/",
"@type": ["MolecularEntity","Product"],
"@id": "\/\/example.org\/products\/name\/#MolecularEntity",
"name": "name",
"url": "\/\/example.org\/products\/name\/",
"description": "",
"image": "",
"sku": "TESTSKU",
"offers": [
{
"@type": "Offer",
"price": "$999.99",
"priceSpecification": {
"priceCurrency": "USD",
"valueAddedTaxIncluded": "false"
},
"priceCurrency": "USD",
"availability": "http://schema.org/InStock",
"url": "\/\/example.org\/products\/name\/"
}
],
"monoisotopicMolecularWeight": "112.11404563"
}
The additionalType page on schema.org is misleading. Thank you for this.
This is not coherent with the fact additionalProperty
is declared as a subproperty of rdf:type
.
I've been discussing this here, the discussion mixed this and I'm still left with two problems:
What should we use to link a schema.org instance to an additional type which the individual is an instance of, but only informally, example (in addition to the ones mentioned in that other issue), ex:imagineByBeatles dc:type ex:Music
. Here, rdf:type
would be wrong in most 'proper' ontologies, but cases like this happen all the time, either because the user annotate with not-so-formal taxonomies, or because annotations are created automatically (text mining, NLP, named entity recognition and the like, usually they return a score as well for the association, but that's another story).
how exactly we should manage name/value pairs, which can be associated with ontology terms, usually to mark that the value of the named property is an instance (kind of...) of those terms, but again, this might be an informal link, due to the same reasons above.
In my projects, I'm using dc:type
for the former case, plus a few conventions over PropertyValue
for the second.
While these tricks have worked fairly well for me so far (example), the general problem is that they're no way common practice (letting a part, a standard). The whole schema.org
community (or bioschema people only) might decide a different approach, but the bottom line is we probably have a need to agree common practice for these cases.
I'm unable to get additionalType to correctly handle the additional properties of a MolecularEntity or Product when paired together. I know it has been advised to avoid using additionalType, but if anyone has a solution to this I'd really appreciate it.
Two minimal examples:
The above will throw (The property sku is not recognized by the schema (e.g. schema.org) for an object of type MolecularEntity.) and The property offers is not recognized by the schema (e.g. schema.org) for an object of type MolecularEntity.
The above will throw (The property monoisotopicMolecularWeight is not recognized by the schema (e.g. schema.org) for an object of type Product.)