Story {stoRy} | R Documentation |
R6 class representing an LTO thematically annotated story
Description
The stoRy package uses the Story
R6 class to represent the LTO
thematic annotations for individual works of fiction. This class is mostly
useful for accessing information about an LTO thematically annotated story
for which the story ID is known in advance.
Details
The class operates on the stories of whichever LTO version happens to be
actively loaded into the stoRy package level environment. This is
the LTO demo
version by default. Run which_lto()
to check which LTO
version is active in your R session.
Search the latest LTO dev
version stories on the Theme Ontology website
at https://www.themeontology.org/stories.
Methods
Public methods
Method new()
Initialize an LTO thematically annotated story.
Usage
Story$new(story_id)
Arguments
story_id
A length-one character vector corresponding to the ID of an LTO thematically annotated work of fiction.
Returns
A new Story
object.
Method story_id()
return A length-one character vector corresponding to the story ID.
Usage
Story$story_id()
Method title()
return A length-one character vector corresponding to the story title.
Usage
Story$title()
Method description()
return A length-one character vector corresponding to some summary information about the story. This is typically a synopsis and/or details about the authorship, production, distribution, etc.
Usage
Story$description()
Method date()
return A length-one character vector corresponding to the story release date.
Usage
Story$date()
Method references()
return A tibble of story reference urls, if any.
Usage
Story$references()
Method collections()
return A tibble of LTO collections to which the story belongs, if any.
Usage
Story$collections()
Method themes()
return A tibble of thematic annotations.
Usage
Story$themes()
Method source()
return The path of the st.txt file containing the story thematic annotations. This is the file path as it occurs on the Theme Ontology GitHub repository at https://github.com/theme-ontology/theming.
Usage
Story$source()
Method obj_internal_tbl()
return A special tibble that is used internally by package functions.
Usage
Story$obj_internal_tbl()
Method print()
Print story object info to console.
Usage
Story$print(canonical = FALSE, width = NULL, ...)
Arguments
canonical
Set to FALSE for pretty output.
width
Width of text output to generate. This defaults to NULL, which means the
stoRy_opt("width")
value is used. Runoptions(stoRy.width = 120L)
to change the column width to be 120 characters, etc....
Additional arguments
Method clone()
The objects of this class are cloneable with this method.
Usage
Story$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
See Also
Use Collection()
to initialize an collection of LTO thematically
annotated stories.
Use Theme()
to initialize an LTO theme.
Use Themeset()
to initialize a set of related LTO themes.
Examples
## Not run:
# Initialize the LTO `demo` version of a classic The Twilight Zone (1959) story:
set_lto("demo")
story <- Story$new(story_id = "tz1959e1x22")
# Print story info and thematic annotations to console:
story
# Print story info and thematic annotations in st.txt format:
story$print(canonical = TRUE)
# Return the story title:
story$title()
# Return the story description:
story$description()
# Return a tibble of thematic annotations:
story$themes()
## End(Not run)