Skip to content

schemaorg

Schema.org-compatible common metadata schemas.

Supports a subset of commonly useful fields.

Adds almost no constraints beyond the spec, except for fixing a multiplicity for fields.

Intended to serve as the basis for more specific schemas.

Note that this schemas ARE NOT able to parse arbitrary schema.org-aligned metadata, their purpose is to ensure that successfully parsed input is semantically enriched.

See schema.org official documentation for full explanation and list of all fields.

Thing

Bases: LDSchema

See https://schema.org/Thing for field documentation.

Source code in src/metador_core/schema/common/schemaorg.py
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
@schemaorg(type="Thing")
class Thing(LDSchema):
    """See https://schema.org/Thing for field documentation."""

    name: Optional[Text]
    """Name, title or caption of the entity."""

    identifier: Optional[Union[URL, Text]]  # can't put PropertyValue here, weird bug
    """Arbitrary identifier of the entity.

    Prefer @id if the identifier is web-resolvable, or use more
    specific fields if available."""

    url: Optional[URL]
    """URL of the entity."""

    description: Optional[Text]
    """Description of the entity."""

    # ----

    alternateName: Optional[List[Text]]
    """Known aliases of the entity."""

    sameAs: Optional[List[URL]]

name instance-attribute

name: Optional[Text]

Name, title or caption of the entity.

identifier instance-attribute

identifier: Optional[Union[URL, Text]]

Arbitrary identifier of the entity.

Prefer @id if the identifier is web-resolvable, or use more specific fields if available.

url instance-attribute

url: Optional[URL]

URL of the entity.

description instance-attribute

description: Optional[Text]

Description of the entity.

alternateName instance-attribute

alternateName: Optional[List[Text]]

Known aliases of the entity.

ValueCommon

Bases: Thing

Common properties of multiple *Value classes.

For some reason these have no common ancestor in schema.org.

Source code in src/metador_core/schema/common/schemaorg.py
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
class ValueCommon(Thing):
    """Common properties of multiple *Value classes.

    For some reason these have no common ancestor in schema.org.
    """

    value: Optional[Union[Bool, Number, Text, StructuredValue]]

    # valueReference: Optional[]

    minValue: Optional[Number]
    """Minimal value of property this value corresponds to."""

    maxValue: Optional[Number]
    """Maximal value of property this value corresponds to."""

    unitCode: Optional[Union[URL, Text]]
    """UN/CEFACT Common Code (3 characters) or URL.

    Other codes may be used with a prefix followed by a colon."""

    unitText: Optional[Text]
    """String indicating the unit of measurement.

    Useful if no standard unitCode can be provided.
    """

minValue instance-attribute

minValue: Optional[Number]

Minimal value of property this value corresponds to.

maxValue instance-attribute

maxValue: Optional[Number]

Maximal value of property this value corresponds to.

unitCode instance-attribute

unitCode: Optional[Union[URL, Text]]

UN/CEFACT Common Code (3 characters) or URL.

Other codes may be used with a prefix followed by a colon.

unitText instance-attribute

unitText: Optional[Text]

String indicating the unit of measurement.

Useful if no standard unitCode can be provided.

StructuredValue

Bases: ValueCommon

See https://schema.org/StructuredValue for field documentation.

Source code in src/metador_core/schema/common/schemaorg.py
96
97
98
@schemaorg(type="StructuredValue")
class StructuredValue(ValueCommon):
    """See https://schema.org/StructuredValue for field documentation."""

QuantitativeValue

Bases: StructuredValue

See https://schema.org/QuantitativeValue for field documentation.

Source code in src/metador_core/schema/common/schemaorg.py
101
102
103
@schemaorg(type="QuantitativeValue")
class QuantitativeValue(StructuredValue):
    """See https://schema.org/QuantitativeValue for field documentation."""

PropertyValue

Bases: StructuredValue

Use 'name' for the property name and 'description' for alternative human-readable value.

See https://schema.org/PropertyValue for field documentation.

Source code in src/metador_core/schema/common/schemaorg.py
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
@schemaorg(type="PropertyValue")
class PropertyValue(StructuredValue):
    """Use 'name' for the property name and 'description' for alternative human-readable value.

    See https://schema.org/PropertyValue for field documentation.
    """

    propertyID: Optional[Union[URL, Text]]
    """A commonly used identifier for the characteristic represented by the property,
    e.g. a manufacturer or a standard code for a property."""

    measurementTechnique: Optional[Union[URL, Text]]
    """A technique or technology used in a Dataset (or DataDownload, DataCatalog),
    corresponding to the method used for measuring the corresponding variable(s)
    (described using variableMeasured).

    This is oriented towards scientific and scholarly dataset publication but
    may have broader applicability; it is not intended as a full representation
    of measurement, but rather as a high level summary for dataset discovery.
    """

propertyID instance-attribute

propertyID: Optional[Union[URL, Text]]

A commonly used identifier for the characteristic represented by the property, e.g. a manufacturer or a standard code for a property.

measurementTechnique instance-attribute

measurementTechnique: Optional[Union[URL, Text]]

A technique or technology used in a Dataset (or DataDownload, DataCatalog), corresponding to the method used for measuring the corresponding variable(s) (described using variableMeasured).

This is oriented towards scientific and scholarly dataset publication but may have broader applicability; it is not intended as a full representation of measurement, but rather as a high level summary for dataset discovery.

Organization

Bases: Thing

See https://schema.org/Organization for field documentation.

Source code in src/metador_core/schema/common/schemaorg.py
131
132
133
134
135
136
@schemaorg(type="Organization")
class Organization(Thing):
    """See https://schema.org/Organization for field documentation."""

    address: Optional[Text]
    """Address of the organization."""

address instance-attribute

address: Optional[Text]

Address of the organization.

Person

Bases: Thing

See https://schema.org/Person for field documentation.

Source code in src/metador_core/schema/common/schemaorg.py
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
@schemaorg(type="Person")
class Person(Thing):
    """See https://schema.org/Person for field documentation."""

    givenName: Optional[Text]
    """Given name, typically the first name of a Person."""

    familyName: Optional[Text]
    """Family name of a Person."""

    additionalName: Optional[Text]
    """Additional name for a Person, e.g. for a middle name."""

    email: Optional[Text]
    """E-mail address."""

    affiliation: Optional[LDOrRef[Organization]]
    """An organization this person is affiliated with."""

givenName instance-attribute

givenName: Optional[Text]

Given name, typically the first name of a Person.

familyName instance-attribute

familyName: Optional[Text]

Family name of a Person.

additionalName instance-attribute

additionalName: Optional[Text]

Additional name for a Person, e.g. for a middle name.

email instance-attribute

email: Optional[Text]

E-mail address.

affiliation instance-attribute

affiliation: Optional[LDOrRef[Organization]]

An organization this person is affiliated with.

CreativeWork

Bases: Thing

See https://schema.org/CreativeWork for field documentation.

Source code in src/metador_core/schema/common/schemaorg.py
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
@schemaorg(type="CreativeWork")
class CreativeWork(Thing):
    """See https://schema.org/CreativeWork for field documentation."""

    version: Optional[Union[NonNegativeInt, Text]]
    """Version of this work.

    Either an integer, or a version string, e.g. "1.0.5".

    When using version strings, follow https://semver.org
    whenever applicable.
    """

    citation: Optional[Set[Union[LDOrRef[CreativeWork], Text]]]
    """Citation or reference to another creative work, e.g.
    another publication, scholarly article, etc."""

    # search

    abstract: Optional[Text]
    """A short description that summarizes the creative work."""

    keywords: Optional[Set[Text]]
    """Keywords or tags to describe this creative work."""

    # people

    author: Optional[List[LDOrRef[OrgOrPerson]]]
    """People responsible for the work, e.g. in research,
    the people who would be authors on the relevant paper."""

    contributor: Optional[List[LDOrRef[OrgOrPerson]]]
    """Additional people who contributed to the work, e.g.
    in research, the people who would be in the acknowledgements
    section of the relevant paper."""

    maintainer: Optional[List[LDOrRef[OrgOrPerson]]]
    producer: Optional[List[LDOrRef[OrgOrPerson]]]
    provider: Optional[List[LDOrRef[OrgOrPerson]]]
    publisher: Optional[List[LDOrRef[OrgOrPerson]]]
    sponsor: Optional[List[LDOrRef[OrgOrPerson]]]
    editor: Optional[List[LDOrRef[Person]]]

    # date

    dateCreated: Optional[DateOrDatetime]
    dateModified: Optional[DateOrDatetime]
    datePublished: Optional[DateOrDatetime]

    # legal

    copyrightHolder: Optional[LDOrRef[OrgOrPerson]]
    copyrightYear: Optional[Int]
    copyrightNotice: Optional[Text]
    license: Optional[Union[URL, LDOrRef[CreativeWork]]]

    # provenance

    about: Optional[Set[LDOrRef[Thing]]]
    subjectOf: Optional[Set[LDOrRef[CreativeWork]]]
    hasPart: Optional[Set[LDOrRef[CreativeWork]]]
    isPartOf: Optional[Set[Union[URL, LDOrRef[CreativeWork]]]]
    isBasedOn: Optional[Set[Union[URL, LDOrRef[CreativeWork]]]]

version instance-attribute

version: Optional[Union[NonNegativeInt, Text]]

Version of this work.

Either an integer, or a version string, e.g. "1.0.5".

When using version strings, follow https://semver.org whenever applicable.

citation instance-attribute

citation: Optional[Set[Union[LDOrRef[CreativeWork], Text]]]

Citation or reference to another creative work, e.g. another publication, scholarly article, etc.

abstract instance-attribute

abstract: Optional[Text]

A short description that summarizes the creative work.

keywords instance-attribute

keywords: Optional[Set[Text]]

Keywords or tags to describe this creative work.

author instance-attribute

author: Optional[List[LDOrRef[OrgOrPerson]]]

People responsible for the work, e.g. in research, the people who would be authors on the relevant paper.

contributor instance-attribute

contributor: Optional[List[LDOrRef[OrgOrPerson]]]

Additional people who contributed to the work, e.g. in research, the people who would be in the acknowledgements section of the relevant paper.

DefinedTermSet

Bases: CreativeWork

See https://schema.org/DefinedTermSet for field documentation.

Source code in src/metador_core/schema/common/schemaorg.py
232
233
234
235
236
@schemaorg(type="DefinedTermSet")
class DefinedTermSet(CreativeWork):
    """See https://schema.org/DefinedTermSet for field documentation."""

    hasDefinedTerm: List[LDOrRef[DefinedTerm]]

DefinedTerm

Bases: Thing

See https://schema.org/DefinedTerm for field documentation.

Source code in src/metador_core/schema/common/schemaorg.py
239
240
241
242
243
244
245
246
247
248
249
@schemaorg(type="DefinedTerm")
class DefinedTerm(Thing):
    """See https://schema.org/DefinedTerm for field documentation."""

    # NOTE: also use name and description

    termCode: Text
    """A code that identifies this DefinedTerm within a DefinedTermSet."""

    inDefinedTermSet: Optional[Union[URL, LDIdRef]]  # ref to a DefinedTermSet
    """A DefinedTermSet that contains this term."""

termCode instance-attribute

termCode: Text

A code that identifies this DefinedTerm within a DefinedTermSet.

inDefinedTermSet instance-attribute

inDefinedTermSet: Optional[Union[URL, LDIdRef]]

A DefinedTermSet that contains this term.

CategoryCodeSet

Bases: DefinedTermSet

See https://schema.org/CategoryCodeSet for field documentation.

Source code in src/metador_core/schema/common/schemaorg.py
252
253
254
255
256
@schemaorg(type="CategoryCodeSet")
class CategoryCodeSet(DefinedTermSet):
    """See https://schema.org/CategoryCodeSet for field documentation."""

    hasCategoryCode: List[LDOrRef[CategoryCode]]

CategoryCode

Bases: DefinedTerm

See https://schema.org/CategoryCode for field documentation.

Source code in src/metador_core/schema/common/schemaorg.py
259
260
261
262
263
264
265
266
267
@schemaorg(type="CategoryCode")
class CategoryCode(DefinedTerm):
    """See https://schema.org/CategoryCode for field documentation."""

    codeValue: Text
    """A short textual code that uniquely identifies the value."""

    inCodeSet: Optional[Union[URL, LDIdRef]]  # ref to a CategoryCodeSet
    """A CategoryCodeSet that contains this category code."""

codeValue instance-attribute

codeValue: Text

A short textual code that uniquely identifies the value.

inCodeSet instance-attribute

inCodeSet: Optional[Union[URL, LDIdRef]]

A CategoryCodeSet that contains this category code.

MediaObject

Bases: CreativeWork

See https://schema.org/MediaObject for field documentation.

Source code in src/metador_core/schema/common/schemaorg.py
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
@schemaorg(type="MediaObject")
class MediaObject(CreativeWork):
    """See https://schema.org/MediaObject for field documentation."""

    contentSize: Optional[Int]
    """Size of the object in bytes."""

    sha256: Optional[Text]
    """Sha256 hashsum string of the object."""

    encodingFormat: Optional[Union[URL, Text]]
    """MIME type, or if the format is too niche or no standard MIME type is
    defined, an URL pointing to a description of the format."""

    width: Optional[QuantitativeValue]
    """Width of the entity."""

    height: Optional[QuantitativeValue]
    """Height of the entity."""

    bitrate: Optional[Text]
    """Bitrate of the entity (e.g. for audio or video)."""

    duration: Optional[Duration]
    """Duration of the entity (e.g. for audio or video)."""

    startTime: Optional[TimeOrDatetime]
    """Physical starting time, e.g. of a recording or measurement."""

    endTime: Optional[TimeOrDatetime]
    """Physical ending time, e.g. of a recording or measurement."""

contentSize instance-attribute

contentSize: Optional[Int]

Size of the object in bytes.

sha256 instance-attribute

sha256: Optional[Text]

Sha256 hashsum string of the object.

encodingFormat instance-attribute

encodingFormat: Optional[Union[URL, Text]]

MIME type, or if the format is too niche or no standard MIME type is defined, an URL pointing to a description of the format.

width instance-attribute

width: Optional[QuantitativeValue]

Width of the entity.

height instance-attribute

height: Optional[QuantitativeValue]

Height of the entity.

bitrate instance-attribute

bitrate: Optional[Text]

Bitrate of the entity (e.g. for audio or video).

duration instance-attribute

duration: Optional[Duration]

Duration of the entity (e.g. for audio or video).

startTime instance-attribute

startTime: Optional[TimeOrDatetime]

Physical starting time, e.g. of a recording or measurement.

endTime instance-attribute

endTime: Optional[TimeOrDatetime]

Physical ending time, e.g. of a recording or measurement.

Dataset

Bases: CreativeWork

See https://schema.org/Dataset for field documentation.

Source code in src/metador_core/schema/common/schemaorg.py
306
307
308
309
310
311
312
313
314
@schemaorg(type="Dataset")
class Dataset(CreativeWork):
    """See https://schema.org/Dataset for field documentation."""

    distribution: Optional[URL]  # NOTE: for top level description could link to repo
    """Downloadable form of this dataset, at a specific location, in a specific format."""

    variableMeasured: Optional[List[Union[Text, PropertyValue]]]
    """Variables that are measured in the dataset."""

distribution instance-attribute

distribution: Optional[URL]

Downloadable form of this dataset, at a specific location, in a specific format.

variableMeasured instance-attribute

variableMeasured: Optional[List[Union[Text, PropertyValue]]]

Variables that are measured in the dataset.

Product

Bases: Thing

See https://schema.org/Product for field documentation.

Source code in src/metador_core/schema/common/schemaorg.py
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
@schemaorg(type="Product")
class Product(Thing):
    """See https://schema.org/Product for field documentation."""

    productID: Optional[Text]
    """The product identifier, such as ISBN."""

    # properties

    category: Optional[Union[Text, URL, CategoryCode, Thing]]
    """A category for the item.

    Greater signs or slashes can be used to informally indicate a category hierarchy.
    """

    material: Optional[Union[URL, Text, Product]]
    """A material that something is made from, e.g. leather, wool, cotton, paper."""

    pattern: Optional[Union[DefinedTerm, Text]]
    """A pattern that something has, for example 'polka dot', 'striped', 'Canadian flag'.

    Values are typically expressed as text, although links to controlled value schemes are also supported.
    """

    width: Optional[QuantitativeValue]
    height: Optional[QuantitativeValue]
    depth: Optional[QuantitativeValue]

    weight: Optional[QuantitativeValue]
    color: Optional[Text]

    additionalProperty: Optional[List[PropertyValue]]
    """A property-value pair representing an additional characteristic of the entity, e.g. a product feature or another characteristic for which there is no matching property in schema.org."""

    # meta

    productionDate: Optional[DateOrDatetime]
    releaseDate: Optional[DateOrDatetime]

    isRelatedTo: Optional[LDOrRef[Product]]
    isSimilarTo: Optional[LDOrRef[Product]]

productID instance-attribute

productID: Optional[Text]

The product identifier, such as ISBN.

category instance-attribute

category: Optional[Union[Text, URL, CategoryCode, Thing]]

A category for the item.

Greater signs or slashes can be used to informally indicate a category hierarchy.

material instance-attribute

material: Optional[Union[URL, Text, Product]]

A material that something is made from, e.g. leather, wool, cotton, paper.

pattern instance-attribute

pattern: Optional[Union[DefinedTerm, Text]]

A pattern that something has, for example 'polka dot', 'striped', 'Canadian flag'.

Values are typically expressed as text, although links to controlled value schemes are also supported.

additionalProperty instance-attribute

additionalProperty: Optional[List[PropertyValue]]

A property-value pair representing an additional characteristic of the entity, e.g. a product feature or another characteristic for which there is no matching property in schema.org.