| Title: | Scoped Semantic Claims and Human Review Workflows |
|---|---|
| Description: | Provides a lightweight framework for constructing, reviewing, and documenting candidate semantic claims in tabular data. Candidate claims can be organised into bounded review tasks and presented through configurable human review interfaces. Review decisions, states, and provenance can be recorded while keeping the semantic representation independent of a particular review interface. |
| Authors: | Daniel Antal [aut, cre] (ORCID: <https://orcid.org/0000-0001-7513-6760>) |
| Maintainer: | Daniel Antal <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.0.8002 |
| Built: | 2026-12-02 11:32:24 UTC |
| Source: | https://github.com/dataobservatory-eu/betwixt |
Adds a named candidate column to a Betwixt candidate dataset. Candidate columns are stored as triplets consisting of a candidate value, an optional controlled range, and an optional semantic definition.
add_candidate_column( x, name, value, range = NA_character_, definition = NA_character_ )add_candidate_column( x, name, value, range = NA_character_, definition = NA_character_ )
x |
A data frame or tibble representing a Betwixt candidate dataset. |
name |
A character string giving the name of the candidate column. |
value |
A vector containing the candidate values to be reviewed.
Its length must be compatible with the number of rows in |
range |
A character vector containing the admissible or suggested
range of candidate values. Use |
definition |
A character vector containing identifiers or URLs
defining the semantic property represented by the candidate column.
Use |
add_candidate_column() does not modify existing candidate columns.
Candidate columns use semantic names supplied explicitly through name.
Contextual, non-reviewable information does not need to be added with this
function and can be appended with ordinary data manipulation operations,
for example dplyr::mutate(context_1 = held_by).
A tibble with three additional columns: name, name_range, and
name_definition, where name is the supplied candidate-column name.
Candidate ranges may contain reserved tokens that have special meanings in the review interface:
<other>Allows the reviewer to enter a value not included in
the proposed candidate range.
For backward compatibility, Other… (Unicode ellipsis)
and Other... (three periods) are also recognised.
<unknown>Indicates that an applicable value may exist, but its value is unknown.
<no-value>Indicates that no applicable value is possible.
Reserved tokens are recognised only when they appear
as complete range entries. Ordinary strings such as
Other, Unknown, and None retain their literal meanings.
Special values are optional and are not automatically appended to candidate ranges.
candidates <- tibble::tibble( row_id = 1:2, input_description = c("image-1", "image-2") ) candidates <- add_candidate_column( candidates, name = "instance_of", value = c("farmhouse", "bed"), range = rep("farmhouse | bed | Other...", 2), definition = rep( "https://www.wikidata.org/wiki/Property:P31", 2 ) ) names(candidates)candidates <- tibble::tibble( row_id = 1:2, input_description = c("image-1", "image-2") ) candidates <- add_candidate_column( candidates, name = "instance_of", value = c("farmhouse", "bed"), range = rep("farmhouse | bed | Other...", 2), definition = rep( "https://www.wikidata.org/wiki/Property:P31", 2 ) ) names(candidates)
Creates the canonical pipe-delimited representation of a candidate value range used in Betwixt semantic review.
Values may be supplied as a character vector or as one or more pipe-delimited character strings. Whitespace surrounding values is removed.
Candidate ranges may include ordinary values and reserved special values that control how the reviewer can respond to a semantic assertion.
add_candidate_range(...)add_candidate_range(...)
... |
Character values defining the candidate range. |
Candidate ranges define the values offered to a reviewer when examining a semantic assertion. The values are preserved in their supplied order.
The function combines the supplied values into a single pipe-delimited string. It does not validate their semantic meaning, resolve entities, or interpret special values.
A single pipe-delimited character string. If no values are
supplied, NA_character_ is returned.
Betwixt recognises the following reserved values in candidate ranges:
<other>Allows the reviewer to enter a value outside the proposed candidate
range. Displayed as Other [curator entered].
<unknown>Indicates that an applicable value may exist, but its value is
unknown. Displayed as Value unknown.
<no-value>Indicates that no applicable value is possible.
Displayed as No value possible.
Other… (Unicode ellipsis) and Other...
(three periods) are also recognised as equivalents of <other>.
The distinction between these values is semantic:
<other> requests a curator-entered replacement value.
<unknown> expresses uncertainty about an applicable value.
<no-value> expresses the absence of an applicable value.
Ordinary strings such as Other, Unknown, and None retain their
literal meanings and are not interpreted as reserved values.
Special values are optional and must be explicitly included in the candidate range. They are not automatically appended.
add_candidate_range() preserves the supplied tokens. Their special
behaviour is applied when the candidate range is rendered in the
Betwixt review interface.
# Ordinary candidate ranges add_candidate_range("depicts", "documents") add_candidate_range(c("depicts", "documents")) add_candidate_range("depicts|documents") add_candidate_range("depicts | documents") # Allow a curator to enter another value add_candidate_range("Spreading", "Debunking", "<other>") # Allow explicit uncertainty or absence of an applicable value add_candidate_range("Farmhouse", "Dwelling", "<unknown>", "<no-value>") # Combine ordinary and special values add_candidate_range( "Spreading", "Debunking", "Discussing", "<other>", "<unknown>", "<no-value>" )# Ordinary candidate ranges add_candidate_range("depicts", "documents") add_candidate_range(c("depicts", "documents")) add_candidate_range("depicts|documents") add_candidate_range("depicts | documents") # Allow a curator to enter another value add_candidate_range("Spreading", "Debunking", "<other>") # Allow explicit uncertainty or absence of an applicable value add_candidate_range("Farmhouse", "Dwelling", "<unknown>", "<no-value>") # Combine ordinary and special values add_candidate_range( "Spreading", "Debunking", "Discussing", "<other>", "<unknown>", "<no-value>" )
Identifies whether a Betwixt table uses wide, dual-wide, long, or dual-long
representation. It returns "invalid" for tables that cannot be identified
as a valid Betwixt representation.
betwixt_representation(x)betwixt_representation(x)
x |
A data frame representing a Betwixt table. |
One of "wide", "dual_wide", "long", "dual_long", or
"invalid".
x <- data.frame( row_id = 1:2, subject = c("Q1", "Q2"), instance_of = c("human", "human"), occupation = c("composer", "pianist") ) betwixt_representation(x) # "wide"x <- data.frame( row_id = 1:2, subject = c("Q1", "Q2"), instance_of = c("human", "human"), occupation = c("composer", "pianist") ) betwixt_representation(x) # "wide"
Constructs an initial wide-form candidate dataset for a Betwixt review. Each row associates an input with a subject and provides the information required to present candidate semantic assertions for review.
The subject forms the first reviewable candidate column. Additional
reviewable columns can subsequently be appended with
add_candidate_column().
An optional input predicate can express a candidate semantic relation
between the input and the subject, for example "depicts" or
"documents". When supplied, this relation is itself reviewable.
create_candidate_dataset( subject, input_url = NA_character_, input_media_url = NA_character_, input_label = NA_character_, input_description = NA_character_, label = NA_character_, description = NA_character_, alternative_label = NA_character_, alternative_description = NA_character_, input_predicate = NULL, input_predicate_range = NA_character_, subject_range = NA_character_, subject_definition = NA_character_, data_manager_name = "", data_manager_iri = "", data_manager_email = "", table_id = "", project_id = "", table_iri = "" )create_candidate_dataset( subject, input_url = NA_character_, input_media_url = NA_character_, input_label = NA_character_, input_description = NA_character_, label = NA_character_, description = NA_character_, alternative_label = NA_character_, alternative_description = NA_character_, input_predicate = NULL, input_predicate_range = NA_character_, subject_range = NA_character_, subject_definition = NA_character_, data_manager_name = "", data_manager_iri = "", data_manager_email = "", table_id = "", project_id = "", table_iri = "" )
subject |
A vector containing the subject identifiers or values to be
reviewed. The subject is stored in the |
input_url |
An optional character vector containing URLs or other resolvable locations of input resources that can be opened by the reviewer. |
input_media_url |
An optional character vector containing URLs or other resolvable locations of media that can be presented directly to the reviewer. |
input_label |
An optional character vector containing short human-readable labels identifying the inputs. |
input_description |
An optional character vector containing human-readable descriptions of the inputs. |
label |
An optional character vector containing human-readable labels for the subjects presented for review. |
description |
An optional character vector containing human-readable descriptions of the subjects presented for review. |
alternative_label |
An optional character vector containing alternative human-readable labels for the subjects presented for review, for example a translation or a label intended for a different user group. |
alternative_description |
An optional character vector containing alternative human-readable descriptions of the subjects presented for review, for example a translation, a more detailed description, or a description intended for a different user group. |
input_predicate |
An optional character vector expressing a candidate
semantic relation from the input to the subject, for example |
input_predicate_range |
An optional character vector containing the
admissible or suggested values for |
subject_range |
A character vector containing the admissible or
suggested subject values. Use |
subject_definition |
A character vector containing resolvable
identifiers or URLs defining the proposed subject. A supplied definition
indicates that the subject already exists as an identified entity;
|
data_manager_name |
Character string containing the name of the person responsible for preparing the candidate dataset. |
data_manager_iri |
Character string containing an IRI identifying the data manager, such as an ORCID, ISNI, or Wikidata URI. |
data_manager_email |
Character string containing the data manager's email address. |
table_id |
Character string identifying the table within a project. The identifier is local to the project and need not be an IRI. |
project_id |
Character string identifying the larger knowledge-production
project within which the table is created and reviewed. The optional
|
table_iri |
Optional absolute IRI identifying the logical
Betwixt table across its successive states and representations.
The IRI may resolve to the latest published state, while
historical states can be retained as separately identified
versions. Defaults to |
create_candidate_dataset() establishes the initial structure of a Betwixt
candidate dataset. row_id is generated automatically as an integer
sequence in input order.
Input columns describe or identify the serialised artefact supplied to the review process. They are distinct from the subject and from the semantic assertions proposed about that subject. An input may be a document, image, dataset, web resource, or another serialised artefact from which candidate assertions have been generated.
input_label and input_description are separate semantic fields.
Renderers may choose to present them together, but their distinction is
preserved in the candidate dataset.
When input_predicate is supplied, it expresses a candidate relation
directed from the input to the subject:
input -- input_predicate --> subject
The input predicate is therefore distinct from review provenance. It is a candidate domain assertion and can itself be accepted, rejected, deferred, or otherwise reviewed.
The subject, its candidate range, and its definition follow the same
candidate-column contract used by add_candidate_column() for subsequent
reviewable assertions.
Additional reviewable assertions can be appended with
add_candidate_column(). Display-only contextual information can be added
as context_* columns using ordinary data manipulation functions such as
dplyr::mutate().
Dataset-level provenance is stored in the provenance attribute rather
than repeated across observation rows. The generation timestamp is
recorded as an ISO 8601 UTC value at one-second precision. The software
agent and installed Betwixt package version are recorded automatically.
At least one of input_media_url or input_url must be supplied for each
row.
A tibble representing the initial Betwixt candidate dataset, with one row per input-subject observation. The table contains structural coordinates, input information, subject presentation information, and the candidate subject assertion.
The core columns are row_id, input_url, input_media_url,
input_label, input_description, label, description,
alternative_label, alternative_description, subject,
subject_range, and subject_definition.
If input_predicate is supplied, the tibble additionally contains
input_predicate and input_predicate_range.
# Candidate dataset without a reviewable input predicate delini_candidates <- create_candidate_dataset( input_media_url = delini$input_media_url, input_description = delini$input_description, label = delini$label, description = delini$description, subject = delini$subject, subject_range = delini$subject_range, subject_definition = delini$subject_definition ) delini_candidates # Candidate dataset with a reviewable input predicate delini_dual_candidates <- create_candidate_dataset( input_media_url = delini$input_media_url, input_description = delini$input_description, label = delini$label, description = delini$description, subject = delini$subject, subject_definition = delini$subject_definition, input_predicate = rep("depicts", nrow(delini)), input_predicate_range = rep( add_candidate_range("depicts", "documents", "Other…"), nrow(delini) ) ) delini_dual_candidates # Statistical example based on the W3C RDF Data Cube Vocabulary w3c_candidates <- create_candidate_dataset( input_url = rep( "https://www.w3.org/TR/vocab-data-cube/", nrow(w3c_life_expectancy) ), input_label = rep( "W3C RDF Data Cube Vocabulary", nrow(w3c_life_expectancy) ), label = w3c_life_expectancy$observation, description = paste( "Life expectancy observation for", w3c_life_expectancy$area ), subject = w3c_life_expectancy$observation ) w3c_candidates <- w3c_candidates |> add_candidate_column( name = "area", value = w3c_life_expectancy$area ) |> add_candidate_column( name = "period", value = w3c_life_expectancy$period ) |> add_candidate_column( name = "sex", value = w3c_life_expectancy$sex ) |> add_candidate_column( name = "life_expectancy", value = w3c_life_expectancy$life_expectancy ) w3c_candidates# Candidate dataset without a reviewable input predicate delini_candidates <- create_candidate_dataset( input_media_url = delini$input_media_url, input_description = delini$input_description, label = delini$label, description = delini$description, subject = delini$subject, subject_range = delini$subject_range, subject_definition = delini$subject_definition ) delini_candidates # Candidate dataset with a reviewable input predicate delini_dual_candidates <- create_candidate_dataset( input_media_url = delini$input_media_url, input_description = delini$input_description, label = delini$label, description = delini$description, subject = delini$subject, subject_definition = delini$subject_definition, input_predicate = rep("depicts", nrow(delini)), input_predicate_range = rep( add_candidate_range("depicts", "documents", "Other…"), nrow(delini) ) ) delini_dual_candidates # Statistical example based on the W3C RDF Data Cube Vocabulary w3c_candidates <- create_candidate_dataset( input_url = rep( "https://www.w3.org/TR/vocab-data-cube/", nrow(w3c_life_expectancy) ), input_label = rep( "W3C RDF Data Cube Vocabulary", nrow(w3c_life_expectancy) ), label = w3c_life_expectancy$observation, description = paste( "Life expectancy observation for", w3c_life_expectancy$area ), subject = w3c_life_expectancy$observation ) w3c_candidates <- w3c_candidates |> add_candidate_column( name = "area", value = w3c_life_expectancy$area ) |> add_candidate_column( name = "period", value = w3c_life_expectancy$period ) |> add_candidate_column( name = "sex", value = w3c_life_expectancy$sex ) |> add_candidate_column( name = "life_expectancy", value = w3c_life_expectancy$life_expectancy ) w3c_candidates
Creates a candidate dataset template for preparing a Betwixt review.
Standard descriptive and evidence columns can be included or omitted.
Additional reviewable columns are specified through columns, while
display-only contextual columns are specified through context.
create_candidate_template( input_url = TRUE, input_media_url = TRUE, input_label = TRUE, input_description = TRUE, label = TRUE, description = TRUE, alternative_label = FALSE, alternative_description = FALSE, input_predicate = FALSE, subject_range = TRUE, subject_definition = TRUE, columns = NULL, context = NULL, n = 0 )create_candidate_template( input_url = TRUE, input_media_url = TRUE, input_label = TRUE, input_description = TRUE, label = TRUE, description = TRUE, alternative_label = FALSE, alternative_description = FALSE, input_predicate = FALSE, subject_range = TRUE, subject_definition = TRUE, columns = NULL, context = NULL, n = 0 )
input_url |
Include the |
input_media_url |
Include the |
input_label |
Include |
input_description |
Include |
label |
Include |
description |
Include |
alternative_label |
Include |
alternative_description |
Include |
input_predicate |
Include |
subject_range |
Include the |
subject_definition |
Include the |
columns |
Optional character vector naming additional reviewable
candidate columns. Each creates a column with corresponding |
context |
Optional character vector naming display-only contextual columns. |
n |
Number of rows to initialise. |
By default, creates a header-only template for use in a spreadsheet
application. Set n to initialise rows for programmatic population.
Re-imported datasets can be checked with validate_candidate_dataset()
before rendering.
A data.frame containing row_id, subject, and the requested evidence,
descriptive, candidate, and contextual columns. Unpopulated fields are NA.
create_candidate_template() create_candidate_template( n = 3, columns = c("instance_of", "heritage_of"), context = "held_by" )create_candidate_template() create_candidate_template( n = 3, columns = c("instance_of", "heritage_of"), context = "held_by" )
A small cultural heritage dataset describing three artefacts and two archival records associated with the Delini farmstead at the Ethnographic Open-Air Museum of Latvia. It provides a worked example of heterogeneous semantic candidates that can be presented for human review with Betwixt.
The three artefacts are the Delini farmhouse, a tablet-woven sash, and a bed. The two archival records document the farmhouse: one contains photographs of it, while the other is a floor plan prepared for its reconstruction.
Each row associates an evidential resource with a described entity and candidate semantic values. Candidate values are accompanied, where applicable, by controlled ranges and semantic definitions.
delinidelini
A data frame with 5 rows and 16 variables:
Integer row identifier.
Optional URL of an evidential resource.
URL of the evidential media resource.
Short human-readable identifier for the evidence.
Human-readable label of the described entity.
Human-readable description of the described entity.
Candidate subject identifier or value.
Optional controlled range for the subject.
Optional semantic definition or resolvable reference associated with the subject.
Candidate value for the instance of assertion.
Optional controlled range for the instance of
value.
Optional semantic definition associated
with the instance of candidate.
Candidate value for the heritage of assertion.
Optional controlled range for the heritage of
value.
Optional semantic definition associated
with the heritage of candidate.
Display-only holding-institution context supplied to the reviewer.
Delini cultural heritage materials used in the Betwixt worked example.
data(delini) head(delini)data(delini) head(delini)
Projects a Betwixt review into one row per atomic assertion in the candidate and reviewed states.
Descriptive fields are represented as assertions about the subject. Each semantic candidate column is represented as a predicate, with its cell value forming the value of the atomic assertion. Review status is inherited from the aligned wide projection.
The long projection is derived from project_review_wide() and introduces
no additional review semantics.
Row-scoped context_* fields are inherited by each assertion generated from
the corresponding wide row. They provide descriptive context only: they do
not become assertions and do not receive review status.
project_review_long(review)project_review_long(review)
review |
A Betwixt review object returned by |
The long projection contains one row for each atomic assertion in both the candidate and reviewed states. The status plane supplies the review status of these assertions but does not itself generate additional long-form rows.
A data frame with one row per candidate or reviewed assertion and
columns assertion_number, row_id, zero or more context_* columns,
plane, subject, predicate, value, status, and provenance fields.
review_html <- render_review(delini) path <- tempfile(fileext = ".html") writeLines(review_html, path) review <- read_review(path) long <- project_review_long(review) head(long)review_html <- render_review(delini) path <- tempfile(fileext = ".html") writeLines(review_html, path) review <- read_review(path) long <- project_review_long(review) head(long)
Projects a Betwixt review into candidate, reviewed, and status planes while preserving the wide structure of the original review.
project_review_wide(review)project_review_wide(review)
review |
A Betwixt review object returned by |
The candidate plane contains the assertions presented for review. The reviewed plane contains the values persisted by the reviewer. The status plane describes the review state of each reviewable field.
Semantic assertions may carry explicit defer or reject qualifications.
These take precedence over states inferred from candidate and reviewed
values. Descriptive fields currently use inferred review states only.
For a finalised row, an unchanged value is corroborated, a changed
non-empty value is corrected, deletion of a candidate value is rejected,
and an absent descriptive assertion that remains absent is deferred.
Values in rows that have not been finalised are pending, unless an
explicit semantic qualification applies.
Reviewable fields include descriptive fields such as label, description,
alternative_label, and alternative_description, when present, together
with semantic assertion fields represented by _qualification columns.
An empty reviewed descriptive value is interpreted as rejection only when the corresponding candidate value was non-empty and the row was finalised. If both candidate and reviewed descriptive values are missing in a finalised row, the assertion is interpreted as deferred rather than rejected.
A data frame containing three structurally aligned wide planes,
identified by the plane column as candidate, reviewed, or status.
Review provenance is retained in the provenance attribute.
Reads a standalone Betwixt review HTML file and reconstructs the original candidate state, the persisted reviewed state, review metadata, and review provenance.
read_review(path)read_review(path)
path |
A single character string giving the path to a standalone Betwixt review HTML file. |
read_review() does not finalise semantic knowledge or construct a
subsequent stabilised semantic state. It reconstructs the review artefact
as saved by Betwixt.
The returned candidate and reviewed data frames preserve the same
evidence, descriptive, and semantic fields. The reviewed data additionally
contains assertion qualifications, row finalisation state, row outcome, and
optional row-level comments.
Review-wide information such as reviewer identity and IRI, lifecycle
timestamps, and the review-level comment is returned separately in
provenance.
The reconstructed review can be projected into assertion-oriented forms with
project_review_wide() and project_review_long(). The wide projection
preserves the candidate, reviewed, and status planes, while the long
projection represents individual semantic assertions as subject-predicate-value
records.
Betwixt review files preserve both original candidate values and the current
reviewed values in machine-readable HTML attributes and controls.
read_review() uses these persisted values to reconstruct the two states
independently.
A finalised Betwixt review is a completed review artefact. Reading such a file does not promote reviewed assertions into a subsequent stabilised semantic state or apply them to an external knowledge system.
A named list with four elements:
Review-level metadata including title, description, table_id,
sequence, and status.
Review provenance including the original and saved filenames, creation and lifecycle timestamps, reviewer name, IRI and email, and the optional review-level comment.
A data frame reconstructing the candidate state presented for review. It contains row number, the fields related to the inputs, the descriptive fields, and candidate semantic assertion values.
A data frame reconstructing the persisted reviewed state. It contains the current descriptive and semantic values, assertion qualifications, row finalisation state, row outcome, and optional row-level comments.
Empty optional fields describing the inputs and comments are returned
as NA_character_. row_id is returned as integer and
reviewed$finalised as logical.
## Not run: review <- read_review("muis-garments-review_1-finalised.html") review$metadata review$provenance review$candidate review$reviewed ## End(Not run)## Not run: review <- read_review("muis-garments-review_1-finalised.html") review$metadata review$provenance review$candidate review$reviewed ## End(Not run)
Renders a Betwixt candidate dataset as an interactive, standalone HTML
review. The type argument selects between a web-based review using
HTTP(S) resources and a local review using files stored alongside the
generated HTML document.
Both formats preserve the original candidate values alongside editable review values. The generated HTML includes the original filename and creation timestamp as artefact provenance. Timestamps are recorded in ISO 8601 UTC format at one-second precision.
A review belongs to a project, has a filename stem, and has a non-negative
sequence number. Sequence 0 represents the initial candidate review.
Subsequent review states may use sequence 1, 2, and so on. Saving a
draft or finalising a review does not itself change the sequence.
The project identifier identifies the larger knowledge-production project, while the table identifier identifies a table across successive review states. The filename stem independently determines the saved HTML filename.
render_local_html_review( candidate, cols = NULL, subheadings = NULL, title = "Betwixt Review", description = "Please review the following claims.", filename_stem = "betwixt-review", reviewer_name = "", reviewer_iri = "", table_id = "", table_iri = NULL, project_id = "", sequence = 0L, row_comment = FALSE, review_comment = FALSE, input_link_target = "blank", path = NULL ) render_review(candidate, ..., type = "web_html") render_web_html_review( candidate, cols = NULL, subheadings = NULL, title = "Betwixt Review", description = "Please review the following claims.", filename_stem = "betwixt-review", reviewer_name = "", reviewer_iri = "", table_id = "", table_iri = NULL, project_id = "", sequence = 0L, row_comment = FALSE, review_comment = FALSE, input_link_target = "blank", path = NULL )render_local_html_review( candidate, cols = NULL, subheadings = NULL, title = "Betwixt Review", description = "Please review the following claims.", filename_stem = "betwixt-review", reviewer_name = "", reviewer_iri = "", table_id = "", table_iri = NULL, project_id = "", sequence = 0L, row_comment = FALSE, review_comment = FALSE, input_link_target = "blank", path = NULL ) render_review(candidate, ..., type = "web_html") render_web_html_review( candidate, cols = NULL, subheadings = NULL, title = "Betwixt Review", description = "Please review the following claims.", filename_stem = "betwixt-review", reviewer_name = "", reviewer_iri = "", table_id = "", table_iri = NULL, project_id = "", sequence = 0L, row_comment = FALSE, review_comment = FALSE, input_link_target = "blank", path = NULL )
candidate |
A Betwixt candidate dataset. |
cols |
Optional named character vector containing presentation labels for candidate and context columns. |
subheadings |
Optional named character vector containing presentation subheadings for candidate columns. |
title |
Character string used as the review title. |
description |
Character string containing review instructions. |
filename_stem |
Base name for saved review files. Sequences greater
than |
reviewer_name |
Initial reviewer name. |
reviewer_iri |
IRI identifying the reviewer, such as an ORCID, ISNI, or Wikidata URI. |
table_id |
Identifier of the table across successive review states. |
table_iri |
Optional IRI identifying the source candidate table.
Candidate provenance takes precedence when present. If omitted,
an IRI is generated from |
project_id |
Identifier of the larger knowledge-production project. |
sequence |
Single non-negative integer identifying the review sequence.
Defaults to |
row_comment |
Logical. Add an optional comment field to each review row.
Defaults to |
review_comment |
Logical. Add an optional comment field for the review
as a whole. Defaults to |
input_link_target |
How links in the Input column are opened.
|
path |
Output directory for the generated HTML. For |
... |
Arguments passed to the selected review renderer. |
type |
Review format: |
The "web_html" renderer accepts HTTP(S) references in input_url and
input_media_url. These references are validated syntactically without
checking network availability.
The "local_html" renderer uses local resource paths, including relative
references such as media/photo.jpg. Resources must already exist and be
readable. Relative paths are resolved against the review output directory.
The local renderer does not copy resources automatically.
Both formats embed the review CSS and JavaScript in the HTML document. Local reviews can therefore be moved together with their referenced resources without changing the relative paths.
A character string containing the rendered HTML, returned invisibly
when written to path.
create_candidate_dataset(),
validate_candidate_dataset(),
validate_external_resources(),
validate_local_resources()
# Create a local review using photographs bundled with Betwixt. data(delini) review_path <- tempfile("delini-review-") dir.create(file.path(review_path, "media"), recursive = TRUE) # Resolve packaged images and copy them into the review directory. source_media <- sub( "^.*?/images/delini/", "media/delini/", delini$input_media_url ) source_files <- system.file(source_media, package = "betwixt") stopifnot(all(nzchar(source_files))) file.copy(source_files, file.path(review_path, "media")) # Use relative references in the candidate dataset. candidate <- create_candidate_dataset( subject = delini$subject, input_media_url = file.path("media", basename(source_files)), input_label = delini$input_label, input_description = delini$input_description, label = delini$label, description = delini$description, subject_range = delini$subject_range, subject_definition = delini$subject_definition ) render_local_html_review( candidate, title = "Deliņi Farmstead Review", filename_stem = "delini-review", path = review_path ) # Review using externally hosted photographs. data(delini) candidates <- create_candidate_dataset( input_media_url = delini$input_media_url, input_description = delini$input_description, label = delini$label, description = delini$description, subject = delini$subject, subject_range = delini$subject_range, subject_definition = delini$subject_definition ) review_html <- render_web_html_review( candidates, title = "Deliņi Farmstead Review" )# Create a local review using photographs bundled with Betwixt. data(delini) review_path <- tempfile("delini-review-") dir.create(file.path(review_path, "media"), recursive = TRUE) # Resolve packaged images and copy them into the review directory. source_media <- sub( "^.*?/images/delini/", "media/delini/", delini$input_media_url ) source_files <- system.file(source_media, package = "betwixt") stopifnot(all(nzchar(source_files))) file.copy(source_files, file.path(review_path, "media")) # Use relative references in the candidate dataset. candidate <- create_candidate_dataset( subject = delini$subject, input_media_url = file.path("media", basename(source_files)), input_label = delini$input_label, input_description = delini$input_description, label = delini$label, description = delini$description, subject_range = delini$subject_range, subject_definition = delini$subject_definition ) render_local_html_review( candidate, title = "Deliņi Farmstead Review", filename_stem = "delini-review", path = review_path ) # Review using externally hosted photographs. data(delini) candidates <- create_candidate_dataset( input_media_url = delini$input_media_url, input_description = delini$input_description, label = delini$label, description = delini$description, subject = delini$subject, subject_range = delini$subject_range, subject_definition = delini$subject_definition ) review_html <- render_web_html_review( candidates, title = "Deliņi Farmstead Review" )
Projects a Betwixt candidate or reviewed dataset into the canonical assertion representation.
The projection preserves the order of rows, fields, and pipe-separated
values in the supplied dataset. row_id identifies the originating
wide-form tuple. assertion_id identifies the position of the assertion
in the canonical long projection.
Dataset identity is represented with row_id = 0. Domain assertions,
input-to-subject relations, contextual statements, and row comments are
assigned distinct components.
Range and definition columns describe candidate fields and are not themselves projected as assertions. Review-state columns such as qualifications, finalisation, and outcomes are likewise not domain assertions.
review_pivot_longer(x)review_pivot_longer(x)
x |
A Betwixt candidate or reviewed data frame. |
A tibble with columns row_id, assertion_id, component,
subject, predicate, and value.
Serialises a reviewed Betwixt dataset as RDF Turtle. The serialisation preserves the candidate and reviewed datasets, review status, provenance, and available Betwixt assertion coordinates.
serialise_review( review, prefix, filename, title = NULL, description = NULL, reviewer_iri = NULL ) serialize_review( review, prefix, filename, title = NULL, description = NULL, reviewer_iri = NULL )serialise_review( review, prefix, filename, title = NULL, description = NULL, reviewer_iri = NULL ) serialize_review( review, prefix, filename, title = NULL, description = NULL, reviewer_iri = NULL )
review |
A Betwixt review object returned by |
prefix |
Base IRI for generated resources. |
filename |
Filename identifying the serialised dataset. |
title |
Optional dataset title. |
description |
Optional dataset description. |
reviewer_iri |
Optional persistent IRI identifying the reviewer. |
Each assertion is represented as a btx:Assertion.
row_id is serialised as btx:rowId. When assertion_id is available,
it is serialised as btx:assertionId.
A character string containing RDF Turtle.
path <- system.file( "examples", "muis-garments-review_1-finalised.html", package = "betwixt" ) review <- read_review(path) ttl <- serialise_review( review, prefix = "https://usebetwixt.com/examples/", filename = "muis-garments-review.ttl", title = "MuIS garment terminology review", description = "Reviewed terminology assertions for three MuIS garments." ) cat(ttl)path <- system.file( "examples", "muis-garments-review_1-finalised.html", package = "betwixt" ) review <- read_review(path) ttl <- serialise_review( review, prefix = "https://usebetwixt.com/examples/", filename = "muis-garments-review.ttl", title = "MuIS garment terminology review", description = "Reviewed terminology assertions for three MuIS garments." ) cat(ttl)
A small example candidate dataset containing GDP observations for Iceland and Malta in 2023 and 2024. The dataset demonstrates the Betwixt candidate-data structure using statistical data.
small_countries_datasetsmall_countries_dataset
A data frame with 4 rows and the following variables:
Stable integer identifier for the candidate row.
Resolvable DOI of the source Eurostat dataset.
Human-readable label for the observation.
Human-readable description of the observation.
Human-readable name of the country.
GeoNames URI identifying the country.
ISO 3166-1 alpha-2 country code.
URI defining the country-code system.
Gross domestic product at market prices.
URI identifying the Eurostat GDP concept B1GQ.
Reference year of the GDP observation; not reviewed.
Unit in which GDP is expressed; not reviewed.
Eurostat, National Accounts. The source dataset is identified by doi:10.2908/NAIDA_10_GDP.
small_countries_dataset validate_candidate_dataset(small_countries_dataset)small_countries_dataset validate_candidate_dataset(small_countries_dataset)
Checks the structural requirements of a Betwixt candidate dataset. Resource validation is handled separately.
validate_candidate_dataset(x)validate_candidate_dataset(x)
x |
A data frame representing a Betwixt candidate dataset. |
Invisibly returns x if validation succeeds.
validate_local_resources(), validate_external_resources()
Checks that input resource references use HTTP or HTTPS URLs. Pipe-separated resource references are supported.
validate_external_resources(x)validate_external_resources(x)
x |
A Betwixt candidate dataset. |
Invisibly returns x if validation succeeds.
Checks that local input resources exist and are readable.
Relative paths are resolved against path.
Pipe-separated resource references are supported.
validate_local_resources(x, path)validate_local_resources(x, path)
x |
A Betwixt candidate dataset. |
path |
Directory containing the local review resources. |
Invisibly returns x if validation succeeds.
A small statistical dataset based on the life expectancy example in the W3C RDF Data Cube Vocabulary specification. The observations demonstrate a multidimensional statistical use case that can be transformed into candidate data for human review with Betwixt.
The example contains male life expectancy observations for four Welsh areas during the 2004–2006 reference period.
w3c_life_expectancyw3c_life_expectancy
A data frame with 4 rows and 5 variables:
Identifier of the RDF Data Cube observation.
Reference area of the observation.
Reference period of the observation.
Sex dimension of the observation.
Life expectancy, measured in years.
W3C RDF Data Cube Vocabulary, life expectancy example: https://www.w3.org/TR/vocab-data-cube/
Cyganiak, R., Reynolds, D., and Tennison, J. (2014). RDF Data Cube Vocabulary. W3C Recommendation, 16 January 2014.
data(w3c_life_expectancy) w3c_life_expectancydata(w3c_life_expectancy) w3c_life_expectancy