Skip to content

Commit

Permalink
feat(Article): Add pagination, pageStart, pageEnd properties
Browse files Browse the repository at this point in the history
This is consistent with schema.org which has these properites on `Article` (and others, but not `CreativeWork`)
  • Loading branch information
nokome committed Mar 12, 2020
1 parent 5689374 commit 276e0b9
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 14 deletions.
30 changes: 25 additions & 5 deletions py/stencila/schema/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,18 @@ def __init__(
class Article(CreativeWork):
"""An article, including news and scholarly articles."""

pageEnd: Optional[Union[str, int]] = None
"""The page on which the article ends; for example "138" or "xvi"."""

pageStart: Optional[Union[str, int]] = None
"""The page on which the article starts; for example "135" or "xiii"."""

pagination: Optional[str] = None
"""Any description of pages that is not separated into pageStart and pageEnd;
for example, "1-6, 9, 55".
"""


def __init__(
self,
alternateNames: Optional[Array[str]] = None,
Expand All @@ -850,6 +862,9 @@ def __init__(
licenses: Optional[Array[Union[str, "CreativeWorkTypes"]]] = None,
meta: Optional[Dict[str, Any]] = None,
name: Optional[str] = None,
pageEnd: Optional[Union[str, int]] = None,
pageStart: Optional[Union[str, int]] = None,
pagination: Optional[str] = None,
parts: Optional[Array["CreativeWorkTypes"]] = None,
publisher: Optional[Union["Person", "Organization"]] = None,
references: Optional[Array[Union[str, "CreativeWorkTypes"]]] = None,
Expand Down Expand Up @@ -887,7 +902,12 @@ def __init__(
url=url,
version=version
)

if pageEnd is not None:
self.pageEnd = pageEnd
if pageStart is not None:
self.pageStart = pageStart
if pagination is not None:
self.pagination = pagination


class Collection(CreativeWork):
Expand Down Expand Up @@ -2453,10 +2473,10 @@ class PublicationIssue(CreativeWork):
"""Identifies the issue of publication; for example, "iii" or "2"."""

pageEnd: Optional[Union[str, int]] = None
"""The page on which the work ends; for example "138" or "xvi"."""
"""The page on which the issue ends; for example "138" or "xvi"."""

pageStart: Optional[Union[str, int]] = None
"""The page on which the work starts; for example "135" or "xiii"."""
"""The page on which the issue starts; for example "135" or "xiii"."""

pagination: Optional[str] = None
"""Any description of pages that is not separated into pageStart and pageEnd;
Expand Down Expand Up @@ -2544,10 +2564,10 @@ class PublicationVolume(CreativeWork):
"""

pageEnd: Optional[Union[str, int]] = None
"""The page on which the work ends; for example "138" or "xvi"."""
"""The page on which the volume ends; for example "138" or "xvi"."""

pageStart: Optional[Union[str, int]] = None
"""The page on which the work starts; for example "135" or "xiii"."""
"""The page on which the volume starts; for example "135" or "xiii"."""

pagination: Optional[str] = None
"""Any description of pages that is not separated into pageStart and pageEnd;
Expand Down
18 changes: 13 additions & 5 deletions r/R/types.R
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,9 @@ CreativeWork <- function(
#' @param licenses License documents that applies to this content, typically indicated by URL.
#' @param meta Metadata associated with this item.
#' @param name The name of the item.
#' @param pageEnd The page on which the article ends; for example "138" or "xvi".
#' @param pageStart The page on which the article starts; for example "135" or "xiii".
#' @param pagination Any description of pages that is not separated into pageStart and pageEnd; for example, "1-6, 9, 55".
#' @param parts Elements of the collection which can be a variety of different elements, such as Articles, Datatables, Tables and more.
#' @param publisher A publisher of the CreativeWork.
#' @param references References to other creative works, such as another publication, web page, scholarly article, etc.
Expand Down Expand Up @@ -781,6 +784,9 @@ Article <- function(
licenses,
meta,
name,
pageEnd,
pageStart,
pagination,
parts,
publisher,
references,
Expand Down Expand Up @@ -819,7 +825,9 @@ Article <- function(
version = version
)
self$type <- as_scalar("Article")

self[["pageEnd"]] <- check_property("Article", "pageEnd", FALSE, missing(pageEnd), Union("character", "numeric"), pageEnd)
self[["pageStart"]] <- check_property("Article", "pageStart", FALSE, missing(pageStart), Union("character", "numeric"), pageStart)
self[["pagination"]] <- check_property("Article", "pagination", FALSE, missing(pagination), "character", pagination)
class(self) <- c(class(self), "Article")
self
}
Expand Down Expand Up @@ -2528,8 +2536,8 @@ PropertyValue <- function(
#' @param licenses License documents that applies to this content, typically indicated by URL.
#' @param meta Metadata associated with this item.
#' @param name The name of the item.
#' @param pageEnd The page on which the work ends; for example "138" or "xvi".
#' @param pageStart The page on which the work starts; for example "135" or "xiii".
#' @param pageEnd The page on which the issue ends; for example "138" or "xvi".
#' @param pageStart The page on which the issue starts; for example "135" or "xiii".
#' @param pagination Any description of pages that is not separated into pageStart and pageEnd; for example, "1-6, 9, 55".
#' @param parts Elements of the collection which can be a variety of different elements, such as Articles, Datatables, Tables and more.
#' @param publisher A publisher of the CreativeWork.
Expand Down Expand Up @@ -2635,8 +2643,8 @@ PublicationIssue <- function(
#' @param licenses License documents that applies to this content, typically indicated by URL.
#' @param meta Metadata associated with this item.
#' @param name The name of the item.
#' @param pageEnd The page on which the work ends; for example "138" or "xvi".
#' @param pageStart The page on which the work starts; for example "135" or "xiii".
#' @param pageEnd The page on which the volume ends; for example "138" or "xvi".
#' @param pageStart The page on which the volume starts; for example "135" or "xiii".
#' @param pagination Any description of pages that is not separated into pageStart and pageEnd; for example, "1-6, 9, 55".
#' @param parts Elements of the collection which can be a variety of different elements, such as Articles, Datatables, Tables and more.
#' @param publisher A publisher of the CreativeWork.
Expand Down
19 changes: 19 additions & 0 deletions schema/Article.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,22 @@ role: primary
status: unstable
category: metadata
description: An article, including news and scholarly articles.
properties:
pageStart:
'@id': schema:pageStart
description: The page on which the article starts; for example "135" or "xiii".
anyOf:
- type: string
- type: integer
pageEnd:
'@id': schema:pageEnd
description: The page on which the article ends; for example "138" or "xvi".
anyOf:
- type: string
- type: integer
pagination:
'@id': schema:pagination
description: |
Any description of pages that is not separated into pageStart and pageEnd;
for example, "1-6, 9, 55".
type: string
4 changes: 2 additions & 2 deletions schema/PublicationIssue.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ properties:
- type: integer
pageStart:
'@id': schema:pageStart
description: The page on which the work starts; for example "135" or "xiii".
description: The page on which the issue starts; for example "135" or "xiii".
anyOf:
- type: string
- type: integer
pageEnd:
'@id': schema:pageEnd
description: The page on which the work ends; for example "138" or "xvi".
description: The page on which the issue ends; for example "138" or "xvi".
anyOf:
- type: string
- type: integer
Expand Down
4 changes: 2 additions & 2 deletions schema/PublicationVolume.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ description: |
properties:
pageStart:
'@id': schema:pageStart
description: The page on which the work starts; for example "135" or "xiii".
description: The page on which the volume starts; for example "135" or "xiii".
anyOf:
- type: string
- type: integer
pageEnd:
'@id': schema:pageEnd
description: The page on which the work ends; for example "138" or "xvi".
description: The page on which the volume ends; for example "138" or "xvi".
anyOf:
- type: string
- type: integer
Expand Down

0 comments on commit 276e0b9

Please sign in to comment.