Learn R Programming

wikiTools (version 1.2.26)

v_Search: Search the VIAF database using CQL queries

Description

This function performs a search in the Virtual International Authority File (VIAF) database using Contextual Query Language (CQL). It handles pagination automatically to retrieve all matching records up to the API limits.

Usage

v_Search(
  CQL_Query,
  mode = c("default", "anyField", "allmainHeadingEl", "allNames", "allPersonalNames",
    "allTitle"),
  schema = c("VIAF", "brief")
)

Value

An object of class c("viaf", "list"). This is a list where each element is an individual VIAF record (also of class "viaf"). Returns NULL if no records are found or if a connection error occurs.

Arguments

CQL_Query

A string containing the search terms or a full CQL query.

mode

A character string specifying the search field. Options are:

  • "default": Uses the raw CQL_Query.

  • "anyField": Searches in any available field.

  • "allmainHeadingEl": Searches in the main heading elements.

  • "allNames": Searches across all name variants.

  • "allPersonalNames": Limits search to personal names.

  • "allTitle": Searches in work titles.

schema

A character string specifying the record detail level. Use "VIAF" for full clusters or "brief" for a lightweight version.

Details

The function automatically cleans XML namespaces (e.g., "ns2:") from the resulting JSON to provide a cleaner list structure. It also ensures that viafID values are treated as characters to prevent precision loss.

Examples

Run this code
if (FALSE) {
# Search for Miguel de Cervantes
results <- v_Search("Cervantes", mode = "allPersonalNames")

# Search for a specific title
works <- v_Search("Don Quixote", mode = "allTitle", schema = "brief")
}

Run the code above in your browser using DataLab