Expected value of schema:category used on a schema:Product #440
If you want to model product category hierarchies (like product catalog groups), you can directly use rdfs:Class or skos:Concept (because they are compatible with schema:Thing) and the respective taxonomic relations rdfs:subClassOf or skos:broader / skos:narrower.
There is also a pending proposal to add SKOS to schema.org, see
http://www.w3.org/wiki/WebSchemas/SKOS
This would allow using schema:ConceptCode for schema:category.
When I look at schema.org/category's description:
A category for the item. Greater signs or slashes can be used to informally indicate a category hierarchy
I wonder whether schema.org/ItemList (or maybe even schema.org/BreadcrumbList) shouldn't be added as expected type?
After all, on many e-commerce sites the breadcrumb represents the category hierarchy, making it a possible resource for category data, eg:
microdata:
<body itemscope itemtype="http://schema.org/ItemPage">
<div itemprop="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList">
<ol id="item-list-elements">
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<a itemprop="item" href="https://example.com/dresses">
<span itemprop="name">Dresses</span>
</a>
<meta itemprop="position" content="1" />
</li>
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<a itemprop="item" href="https://example.com/dresses/real">
<span itemprop="name">Real Dresses</span>
</a>
<meta itemprop="position" content="2" />
</li>
</ol>
</div>
<div itemscope itemtype="http://schema.org/Product">
<h1 itemprop="name">Evening gown</h1>
<div itemref="item-list-elements" itemprop="category" itemscope itemtype="http://schema.org/ItemList"></div>
</div>
</body>
RDFa
<body vocab="http://schema.org/" typeof="ItemPage">
<div property="breadcrumb" typeof="BreadcrumbList">
<link property="rdfa:copy" href="#item-list-elements">
<ol resource="#item-list-elements" typeof="rdfa:Pattern">
<li property="itemListElement" typeof="ListItem">
<a property="item" typeof="CollectionPage" href="https://example.com/dresses">
<span property="name">Dresses</span>
</a>
<meta property="position" content="1" />
</li>
<li property="itemListElement" typeof="ListItem">
<a property="item" typeof="CollectionPage" href="https://example.com/dresses/real">
<span property="name">Real Dresses</span>
</a>
<meta property="position" content="2" />
</li>
</ol>
</div>
<div typeof="Product">
<h1 property="name">Evening gown</h1>
<div property="category" typeof="ItemList">
<link property="rdfa:copy" href="#item-list-elements"/>
</div>
</div>
</body>
I would not mix the two issues. For multiple categories, you do not need ItemList (because the order is not important).
It makes things more complicated if we combine category and breadcrumb markup.
"you do not need ItemList (because the order is not important)."
If the order doesn't matter then why does the description mention "category hierarchy"?
"It makes things more complicated if we combine category and breadcrumb markup."
My idea is based on the description mentioning a hierarchy and why I suggested re-using the breadcrumb data, but I agree code-wise it isn't the easiest solution.
The order of an ItemList defines a sequence, like
Breakfast -> Lunch -> Dinner
What you seem to want to achieve is a hierarchy, like
Food -> Cheese -> Cheddar
ItemList does not have a mechanism for hierarchy, and secretly assuming that the order of the ItemList represent the hierarchical order in this case will not scale, IMO.
The idea of allowing a delimiter-based microsyntax for hierachical category information was inspired by the fact that the Google product taxonomy has been using this for quite a while.
"ItemList does not have a mechanism for hierarchy, and secretly assuming that the order of the ItemList represent the hierarchical order in this case will not scale, IMO."
Thanks for explaining the nuance, I hadn't picked that up yet. So it's a good day as I learned something new. :)
@mfhepp thanks for the feedback.
For the use case I have in mind there already exists a formal classification tree based on IEC 61360 / ISO 13584. However this formal classification is not presented to the customer. Instead the product catalog as presented on the web is a somewhat looser (more marketing-oriented) poly-hierarchy which is already modeled in SKOS. As such the proposal you link to is very encouraging.
The downside of using SKOS is that it is almost too generic. We actually defined a subclass of skos:Concept to use for such a purpose:
http://data.semaku.com/schema/v1/MarketingCategory
This is to be able to differentiate these instances as being more specific than a plain old SKOS concept. As such one can expect a product category to 'contain' products whereas a plain old concept would not necessarily.
I can see this may get rather blurred for some cases, Cheddar may be a product category for a supermarket and Breakfast may be for a cafe, but allowing different parties to mark up what they see as being their product categories seems pretty reasonable to me.
In this case, I would suggest to create an OWL ontology from your external classification, e.g. using our tool PCS2OWL, publish it on the Web, and then simply use a multi-typed entity in RDFa or JSON-LD or additionalType in Microdata.
http://wiki.goodrelations-vocabulary.org/Tools/PCS2OWL
schema:category is exactly for the simple cases where you do not have more than a string for indicating category information. If you have more, I suggest to use regular type information.
If you don't mind me asking @mfhepp and @danbri ,
If a site's categories and products are classified according to the UNSPSC/GPC standard, is there any value in expressing this via structured data, and if so, how would one go about and do this?
Would something like this work (and represent anything of value)?
<div itemscope itemtype="http://schema.org/Product">
<span itemprop="category" itemid="urn:unspsc:52161505" itemscope itemtype="http://schema.org/Thing">
<span itemprop="name">Televisions</span>
</span>
...
</div>
or
<div itemscope itemtype="http://schema.org/Product">
<span itemprop="category" itemid="gpc:10001400" itemscope itemtype="http://schema.org/Thing">
<span itemprop="name">Audio Visual/Photography > Audio Visual Equipment > Televisions > Televisions</span>
</span>
...
</div>
If you craft a URN for a type from an external scheme, I would use additionalType
You can either use that URN directly or define a new class, subclass of schema:Product, directly in your markup, and link to the URN via sameAs.
I see the following two idioms for this use-case:
<div itemscope itemtype="http://schema.org/product">
<div itemprop="additionalType" itemscope itemtype="http://schema.org/Class">
<link itemprop="sameAs" href="urn:unspsc:52161505" />
Category: <div itemprop="name">Televisions</div>
</div>
</div>
or
<div itemscope itemtype="http://schema.org/product">
Category: <div itemprop="category" content="unspsc:52161505">Televisions</div>
</div>
Do unspsc/GPC define URNs? Unless they are already heavily used I wouldn't actively encourage them around schema.org
Do unspsc/GPC define URNs? Unless they are already heavily used I wouldn't actively encourage them around schema.org
Related to issue #131
So the expected value of schema:category when used with schema:Product would be text. Or is there any value to create a schema:ProductCategory analogous to schema:PhysicalActivity / schema:PhysicalActivityCategory?
There are several use cases where this may be very useful to be able to better markup a product taxonomy.