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

updated rel descriptions, moved info to best practice #951

Merged
merged 2 commits into from
Feb 3, 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
17 changes: 17 additions & 0 deletions best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* [Static and Dynamic Catalogs](#static-and-dynamic-catalogs)
* [Catalog Layout](#catalog-layout)
* [Use of Links](#use-of-links)
* [Using Relation Types](#using-relation-types)
* [Versioning for Catalogs](#versioning-for-catalogs)
* [STAC on the Web](#stac-on-the-web)

Expand Down Expand Up @@ -311,6 +312,22 @@ So if you are writing a STAC client it is recommended to start with just support
turn, if your data is published online publicly or for use on an intranet then following these recommendations will ensure
that a wider range of clients will work with it.

## Using Relation Types

Implementors of STAC are highly recommended to be quite liberal with their `links`, and to use the `rel` field (in conjunction
with the `type` field) to communicate the structure and content of related entities. While each STAC spec describes some of the
'custom' relations STAC has set, the ideal is to reuse official [IANA Link Relation
Types](https://www.iana.org/assignments/link-relations/link-relations.xhtml) as much as possible. The following table describes
a number of the common official relations that are used in production STAC implementations.

| Type | Description |
| ------------ | ------------------------------------------------------------ |
| alternate | It is recommended that STAC Items are also available as HTML, and should use this rel with `"type" : "text/html"` to tell clients where they can get a version of the Item or Collection to view in a browser. See [STAC on the Web in Best Practices](#stac-on-the-web) for more information. |
| canonical | The URL of the [canonical](https://en.wikipedia.org/wiki/Canonical_link_element) version of the Item or Collection. API responses and copies of catalogs should use this to inform users that they are direct copy of another STAC Item, using the canonical rel to refer back to the primary location. |
| via | The URL of the source metadata that this STAC Item or Collection is created from. Used similarly to canonical, but refers back to a non-STAC record (Landsat MTL, Sentinel tileInfo.json, etc) |
| prev | Indicates that the link's context is a part of a series, and that the previous in the series is the link target. Typically used in STAC by API's, to return smaller groups of items or catalogs. |
| next | Indicates that the link's context is a part of a series, and that the next in the series is the link target. Typically used in STAC by API's, to return smaller groups of items or catalogs. |

## Versioning for Catalogs

In the Item and Collection STAC JSON, versions and deprecation can be indicated with the [Versioning Indicators Extension](./extensions/version).
Expand Down
4 changes: 4 additions & 0 deletions catalog-spec/catalog-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ The following types are commonly used as `rel` types in the Link Object of a STA

**Note:** A link to at least one `item` or `child` catalog is **REQUIRED**.

There are additional `rel` types in the [Using Relation Types](../best-practices.md#using-relation-types) best practice, but as
they are more typically used in Collections, as catalogs tend to just be used to structure STAC organization, so tend to just use
the ones above.

## Extensions

The [extensions page](../extensions/) gives an overview about relevant extensions for STAC Catalogs.
15 changes: 10 additions & 5 deletions collection-spec/collection-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,19 @@ This object describes a relationship with another entity. Data providers are adv
| Field Name | Type | Description |
| ---------- | ------ | ------------------------------------------------------------ |
| href | string | **REQUIRED.** The actual link in the format of an URL. Relative and absolute links are both allowed. |
| rel | string | **REQUIRED.** Relationship between the current document and the linked document. See chapter "Relation types" for more information. |
| rel | string | **REQUIRED.** Relationship between the current document and the linked document. See chapter "[Relation types](#relation-types)" for more information. |
| type | string | [Media type](../item-spec/item-spec.md#media-types) of the referenced entity. |
| title | string | A human readable title to be used in rendered displays of the link. |

A more complete list of possible 'rel' types can be seen at the [IANA page of Link Relation Types](https://www.iana.org/assignments/link-relations/link-relations.xhtml).

Please see the chapter 'relative vs absolute links' in the [Item spec](../item-spec/item-spec.md#relative-vs-absolute-links) for a discussion on that topic.

#### Relation types

The following types are commonly used as `rel` types in the Link Object of a Collection:
STAC Collections use a variety of `rel` types in the link object, to describe the exact nature of the link between this collection
and the entity it is linking to. It is recommended to use the official [IANA Link Relation
Types](https://www.iana.org/assignments/link-relations/link-relations.xhtml) where possible. The following table explains places
where custom STAC `rel` types are used for collections. This is done where there is not a clear official option, or where
STAC uses an official type but adds additional meaning for the STAC context.

| Type | Description |
| ------- | ------------------------------------------------------------ |
Expand All @@ -125,7 +127,10 @@ The following types are commonly used as `rel` types in the Link Object of a Col
| child | URL to a child STAC [Catalog](../catalog-spec/) or Collection. |
| item | URL to a STAC [Item](../item-spec/item-spec.md). All items linked from a collection MUST refer back to its collection with the [`collection` relation type](../item-spec/item-spec.md#relation-types). |
| license | The license URL(s) for the collection SHOULD be specified if the `license` field is set to `proprietary` or `various`. If there is no public license URL available, it is RECOMMENDED to supplement the STAC catalog with the license text in a separate file and link to this file. |
| derived_from | URL to a STAC Collection that was used as input data in the creation of this collection. See the note in [STAC Item](../item-spec/item-spec.md#relation-types) for more info. |
| derived_from | URL to a STAC Collection that was used as input data in the creation of this collection. See the note in [STAC Item](../item-spec/item-spec.md#derived_from) for more info. |

A more complete list of possible `rel` types and their meaning in STAC can be found in the [Using Relation
Types](../best-practices.md#using-relation-types) best practice.

**Note:** The [STAC Catalog specification](../catalog-spec/catalog-spec.md) requires a link to at least one `item` or `child` catalog. This is *not* a requirement for collections, but *recommended*. In contrast to catalogs, it is **REQUIRED** that items linked from a Collection MUST refer back to its Collection with the [`collection` relation type](../item-spec/item-spec.md#relation-types).

Expand Down
14 changes: 9 additions & 5 deletions item-spec/item-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ recommendations for particular `rel` types are given in the `rel` type descripti

#### Relation types

The following types are commonly used as `rel` types in the Link Object of an Item:
STAC Items use a variety of `rel` types in the link object, to describe the exact nature of the link between this item
and the entity it is linking to. It is recommended to use the official [IANA Link Relation
Types](https://www.iana.org/assignments/link-relations/link-relations.xhtml) where possible. The following table explains places
where STAC use custom `rel` types are used with items. This happens where there is not a clear official option, or where
STAC uses an official type but adds additional meaning for the STAC context.

| Type | Description |
| ------------ | ------------------------------------------------------------ |
Expand All @@ -133,11 +137,11 @@ The following types are commonly used as `rel` types in the Link Object of an It
| parent | URL to the parent STAC [Catalog](../catalog-spec/README.md) or [Collection](../collection-spec/README.md). |
| collection | STRONGLY RECOMMENDED. URL to a [Collection](../collection-spec/README.md). *Absolute* URLs should be used whenever possible. The referenced Collection is STRONGLY RECOMMENDED to implement the same STAC version as the Item. |
| derived_from | URL to a STAC Item that was used as input data in the creation of this Item. |
Copy link
Collaborator

@m-mohr m-mohr Jan 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move the whole derived_from part also to best practices? I think it would make sense.

| alternate | It is recommended that STAC Items are also available as HTML, and should use this rel with `"type" : "text/html"` to tell clients where they can get a version of the Item to view in a browser. See [STAC on the Web in Best Practices](../best-practices.md#stac-on-the-web) for more information. |
| canonical | The URL of the [canonical](https://en.wikipedia.org/wiki/Canonical_link_element) version of the Item. API responses and copies of catalogs should use this to inform users that they are direct copy of another STAC Item, using the canonical rel to refer back to the primary location. |
| via | The URL of the metadata that this STAC Item is created from. Used similarly to canonical, but refers back to a non-STAC record (Landsat MTL, Sentinel tileInfo.json, etc) |

A more complete list of possible 'rel' types can be seen at the [IANA page of Link Relation Types](https://www.iana.org/assignments/link-relations/link-relations.xhtml).
A more complete list of potential `rel` types and their meaning in STAC can be found in the [Using Relation
Types](../best-practices.md#using-relation-types) best practice.

##### derived_from

*Note regarding the type `derived_from`: A full provenance model is far beyond the scope of STAC, and the goal is to align with any good independent spec
that comes along for that. But the derived_from field is seen as a way to encourage fuller specs and at least start a linking
Expand Down