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

Avoid duplication in schema with metadataEntity #608

Merged
merged 5 commits into from
Dec 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions extensions/3DTILES_metadata/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,21 +326,21 @@ Tileset authors may define their own additional statistics, like `_mode` in the

### Overview

While [classes](#class) within a schema define the data types and meanings of properties, properties do not take on particular values until a metadata is assigned (i.e. the class is "instatiated") to a particular entity within the 3D Tiles hierarchy. Property values may be assigned to entities as described in the sections below.
While [classes](#class) within a schema define the data types and meanings of properties, properties do not take on particular values until a metadata is assigned (i.e. the class is "instatiated") as a particular metadata entity within the 3D Tiles hierarchy. Each metadata entity contains the name of the class that it is an instance of, as well as a dictionary of property values that correspond to the properties of that class. This common structure is defined in [metadataEntity.schema.json](./schema/metadataEntity.schema.json).

Each property value assigned must be defined by a class property with the same alphanumeric property ID, with values matching the data type of the class property. An entity may provide values for only a subset of the properties of its class, but class properties marked `required: true` must not be omitted.

Most property values are encoded as JSON within the entity to which they are assigned. One notable exception is metadata assigned to [implicit tiles](#implicit-tile-properties), stored in a more compact binary form.
Most property values are encoded as JSON within the entity. One notable exception is metadata assigned to [implicit tiles](#implicit-tile-properties), stored in a more compact binary form.

### Tileset Properties

*Defined in [tileset.schema.json](./schema/tileset.schema.json)*.
*Defined in [tileset.schema.json](./schema/tileset.schema.json) and [metadataEntity.schema.json](./schema/metadataEntity.schema.json)*.

Properties assigned to tilesets provide metadata about the tileset as a whole. Common examples might include year of collection, author details, or other general context for the tileset contents.

The `tileset` object within a tileset's `3DTILES_metadata` extension must specify its class (`class`). Within a `properties` dictionary, values for properties are given, encoded as JSON types according to the [JSON Format](../../specification/Metadata/README.md#json-format) specification.

> **Example:** The example below defines properties of a tileset, with the tileset representing an instance of a "city" class. Required properties "dateFounded" and "population" are given; optional property "country" is omitted.
> **Example:** The example below defines properties of a tileset, with the tileset being an instance of a "city" class. Required properties "dateFounded" and "population" are given; optional property "country" is omitted.
>
> ```jsonc
> {
Expand Down Expand Up @@ -373,7 +373,7 @@ The `tileset` object within a tileset's `3DTILES_metadata` extension must specif

### Tile Properties

*Defined in [tile.3DTILES_metadata.schema.json](./schema/tile.3DTILES_metadata.schema.json)*.
*Defined in [tile.3DTILES_metadata.schema.json](./schema/tile.3DTILES_metadata.schema.json) and [metadataEntity.schema.json](./schema/metadataEntity.schema.json)*.

Property values may be assigned to individual tiles, including (for example) spatial hints to optimize traversal algorithms. The example below uses the built-in semantic `TILE_MAXIMUM_HEIGHT` from the [3D Metadata Semantic Reference](../../specification/Metadata/Semantics).

Expand Down Expand Up @@ -486,7 +486,7 @@ Binary property value arrays are located in buffer views of the implicit tiling

### Content Group Properties

*Defined in [group.schema.json](./schema/group.schema.json) and [tileset.3DTILES_metadata.schema.json](./schema/content.3DTILES_metadata.schema.json)*.
*Defined in [group.schema.json](./schema/group.schema.json), [metadataEntity.schema.json](./schema/metadataEntity.schema.json), and [tileset.3DTILES_metadata.schema.json](./schema/content.3DTILES_metadata.schema.json)*.

Tiles may contain more than one content entity (see: [`3DTILES_multiple_contents`](../3DTILES_multiple_contents)), or multiple tiles may reference content sharing the same metadata. In these cases, metadata assigned to the tile would be inadequate or inefficient for describing tile contents. This extension allows content to be organized into collections, or "groups", and metadata may be associated with each group. Groups are useful for supporting metadata on only a subset of a tile's content, or for working with collections of contents as layers, e.g. to manage visibility or visual styling.

Expand Down
50 changes: 4 additions & 46 deletions extensions/3DTILES_metadata/schema/group.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,55 +6,13 @@
"description": "An object containing metadata about a group.",
"allOf": [
{
"$ref": "tilesetProperty.schema.json"
"$ref": "metadataEntity.schema.json"
}
],
"properties": {
"class": {
"type": "string",
"description": "The class that property values conform to. The value must be a class ID declared in the `classes` dictionary."
},
"properties": {
"type": "object",
"description": "A dictionary, where each key corresponds to a property ID in the class' `properties` dictionary and each value contains the property values. The type of the value must match the property definition: For `BOOLEAN` use `true` or `false`. For `STRING` use a JSON string. For numeric types use a JSON number. For `ENUM` use a valid enum `name`, not an integer value. For `ARRAY`, `VECN`, and `MATN` types use a JSON array containing values matching the `componentType`. Required properties must be included in this dictionary.",
"minProperties": 1,
"additionalProperties": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "boolean"
}
},
{
"type": "array",
"items": {
"type": "number"
}
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
},
"class": {},
"properties": {},
"extensions": {},
"extras": {}
},
"required": [
"class",
"properties"
]
}
}
60 changes: 60 additions & 0 deletions extensions/3DTILES_metadata/schema/metadataEntity.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "metadataEntity.schema.json",
"title": "Metadata Entity",
"type": "object",
"description": "An object containing a reference to a class from a metadata schema, and property values that conform to the properties of that class.",
"allOf": [
{
"$ref": "tilesetProperty.schema.json"
}
],
"properties": {
"class": {
"type": "string",
"description": "The class that property values conform to. The value must be a class ID declared in the `classes` dictionary."
},
"properties": {
"type": "object",
"description": "A dictionary, where each key corresponds to a property ID in the class' `properties` dictionary and each value contains the property values. The type of the value must match the property definition: For `BOOLEAN` use `true` or `false`. For `STRING` use a JSON string. For numeric types use a JSON number. For `ENUM` use a valid enum `name`, not an integer value. For `ARRAY`, `VECN`, and `MATN` types use a JSON array containing values matching the `componentType`. Required properties must be included in this dictionary.",
"minProperties": 1,
"additionalProperties": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "boolean"
}
},
{
"type": "array",
"items": {
"type": "number"
}
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
},
"extensions": {},
"extras": {}
},
"required": [
"class",
"properties"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,55 +6,13 @@
"description": "An object containing metadata about a tile. This extension must not be added to tiles using the `3DTILES_implicit_tiling` extension since tile metadata is provided separately in the subtrees.",
"allOf": [
{
"$ref": "tilesetProperty.schema.json"
"$ref": "metadataEntity.schema.json"
}
],
"properties": {
"class": {
"type": "string",
"description": "The class that property values conform to. The value must be a class ID declared in the `classes` dictionary."
},
"properties": {
"type": "object",
"description": "A dictionary, where each key corresponds to a property ID in the class' `properties` dictionary and each value contains the property values. The type of the value must match the property definition: For `BOOLEAN` use `true` or `false`. For `STRING` use a JSON string. For numeric types use a JSON number. For `ENUM` use a valid enum `name`, not an integer value. For `ARRAY`, `VECN`, and `MATN` types use a JSON array containing values matching the `componentType`. Required properties must be included in this dictionary.",
"minProperties": 1,
"additionalProperties": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "boolean"
}
},
{
"type": "array",
"items": {
"type": "number"
}
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
},
"class": {},
"properties": {},
"extensions": {},
"extras": {}
},
"required": [
"class",
"properties"
]
}
}
50 changes: 4 additions & 46 deletions extensions/3DTILES_metadata/schema/tileset.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,55 +6,13 @@
"description": "An object containing metadata about the tileset.",
"allOf": [
{
"$ref": "tilesetProperty.schema.json"
"$ref": "metadataEntity.schema.json"
}
],
"properties": {
"class": {
"type": "string",
"description": "The class that property values conform to. The value must be a class ID declared in the `classes` dictionary."
},
"properties": {
"type": "object",
"description": "A dictionary, where each key corresponds to a property ID in the class' `properties` dictionary and each value contains the property values. The type of the value must match the property definition: For `BOOLEAN` use `true` or `false`. For `STRING` use a JSON string. For `ENUM` use a valid enum `name`, not an integer value. For `ARRAY`, `VECN`, and `MATN` types use a JSON array containing values matching the `componentType`. Required properties must be included in this dictionary.",
"minProperties": 1,
"additionalProperties": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "boolean"
}
},
{
"type": "array",
"items": {
"type": "number"
}
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
},
"class": {},
"properties": {},
"extensions": {},
"extras": {}
},
"required": [
"class",
"properties"
]
}
}