1

I am currently looking into schema.org to use it with API platform, but there are certain properties that I don't understand.

Let's take https://schema.org/Organization for example:

A Thing (and this case an Organization) has properties, like a name and an address. Now what I don't understand is the property department. However in real life an organization doesn't have just a single department; it has several at least.

Shouldn't that property be oneToMany?

Or do I not understand it and does department link to the parent company, which makes the child Organization (the one with the department property) a department? But if that was to be the case I'd think there would be a Department object instead (extending from the Organization object).

When I define this property in my API Platform's schema.yaml, it expects a single value, just like I would expect from the schema.org's documentation.

Am I missing something? Can someone please explain how I should interpret and use such properties?

Edit: I found out that API Platform expects every property to have a single value, unless specified otherwise. So I have to setup the department property to be oneToMany. That combined with the great explanation below (the accepted answer) explains it all.

vrijdenker
  • 1,371
  • 1
  • 12
  • 25

1 Answers1

1

All Schema.org properties can have multiple values. Usually it doesn’t make sense for every property (e.g., birthDate), but it’s possible anyway.

For the department property, the domain (the item which has this property) is the parent organization, and the range (the item which is the value of this property) is the department. In cases like this, where the domain and range expect the same types, you have to interpret the textual definition to make sure for which "direction" the property is intended.

(If, for some reason, you can’t provide multiple values for a property, note that you can use every Schema.org property in the other direction, too, even if no inverse property is defined.)

Examples

An organization (#1) has two departments (#2, #3).

JSON-LD

Using an array ([]):

{
  "@context": "http://schema.org/",
  "@type": "Organization",
  "@id": "#1",
  "department": [
    {
      "@type": "Organization",
      "@id": "#2"
    },
    {
      "@type": "Organization",
      "@id": "#3"
    }
  ]
}

Microdata

Repeating the property:

<div itemscope itemtype="http://schema.org/Organization" itemid="#1">
  <div itemprop="department" itemscope itemtype="http://schema.org/Organization" itemid="#2"></div>
  <div itemprop="department" itemscope itemtype="http://schema.org/Organization" itemid="#3"></div>
</div>

RDFa

Repeating the property:

<div typeof="schema:Organization" resource="#1">
  <div property="schema:department" typeof="schema:Organization" resource="#2"></div>
  <div property="schema:department" typeof="schema:Organization" resource="#3"></div>
</div>
unor
  • 92,415
  • 26
  • 211
  • 360
  • Thank you for your great explanation on how to interprete the properties on schema.org. I now also edited my question explaining how to fix the API part. – vrijdenker May 06 '19 at 05:56