Learn R Programming

RKorAPClient (version 0.5.9)

KorAPQuery-class: Class KorAPQuery

Description

KorAPQuery objects represent the current state of a query to a KorAP server. New KorAPQuery objects are typically created by the corpusQuery method.

fetchNext fetches the next bunch of results of a KorAP query.

frequencyQuery combines corpusQuery, corpusStats and ci to compute a table with the relative frequencies and confidence intervals of one ore multiple search terms across one or multiple virtual corpora.

Usage

# S4 method for KorAPQuery
initialize(
  .Object,
  korapConnection = NULL,
  request = NULL,
  vc = "",
  totalResults = 0,
  nextStartIndex = 0,
  fields = c("corpusSigle", "textSigle", "pubDate", "pubPlace", "availability",
    "textClass", "snippet"),
  requestUrl = "",
  webUIRequestUrl = "",
  apiResponse = NULL,
  hasMoreMatches = FALSE,
  collectedMatches = NULL
)

# S4 method for KorAPQuery fetchNext( kqo, offset = kqo@nextStartIndex, maxFetch = maxResultsPerPage, verbose = kqo@korapConnection@verbose )

# S4 method for KorAPQuery fetchAll(kqo, verbose = kqo@korapConnection@verbose)

# S4 method for KorAPQuery fetchRest(kqo, verbose = kqo@korapConnection@verbose)

# S4 method for KorAPConnection frequencyQuery( kco, query, vc = "", conf.level = 0.95, as.alternatives = FALSE, ... )

# S3 method for KorAPQuery format(x, ...)

# S4 method for KorAPQuery show(object)

Arguments

.Object

<U+2026>

korapConnection

KorAPConnection object

request

query part of the request URL

vc

definition of a virtual corpus

totalResults

number of hits the query has yielded

nextStartIndex

at what index to start the next fetch of query results

fields

what data / metadata fields should be collected

requestUrl

complete URL of the API request

webUIRequestUrl

URL of a web frontend request corresponding to the API request

apiResponse

data-frame representation of the JSON response of the API request

hasMoreMatches

logical that signals if more query results can be fetched

collectedMatches

matches already fetched from the KorAP-API-server

kqo

object obtained from corpusQuery

offset

start offset for query results to fetch

maxFetch

maximum number of query results to fetch

verbose

print progress information if true

kco

KorAPConnection object (obtained e.g. from new("KorAPConnection")

query

string that contains the corpus query. The query language depends on the ql parameter. Either query must be provided or KorAPUrl.

conf.level

confidence level of the returned confidence interval (passed through ci to prop.test).

as.alternatives

LOGICAL that specifies if the query terms should be treated as alternatives. If as.alternatives is TRUE, the sum over all query hits, instead of the respective vc token sizes is used as total for the calculation of relative frequencies.

...

further arguments passed to or from other methods

x

KorAPQuery object

object

KorAPQuery object

Value

The kqo input object with updated slots collectedMatches, apiResponse, nextStartIndex, hasMoreMatches

References

https://ids-pub.bsz-bw.de/frontdoor/index/index/docId/9026

Examples

Run this code
# NOT RUN {
q <- new("KorAPConnection") %>% corpusQuery("Ameisenplage") %>% fetchNext()
q@collectedMatches
# }
# NOT RUN {
# }
# NOT RUN {
q <- new("KorAPConnection") %>% corpusQuery("Ameisenplage") %>% fetchAll()
q@collectedMatches
# }
# NOT RUN {
# }
# NOT RUN {
q <- new("KorAPConnection") %>% corpusQuery("Ameisenplage") %>% fetchRest()
q@collectedMatches
# }
# NOT RUN {
# }
# NOT RUN {
new("KorAPConnection", verbose = TRUE) %>%
  frequencyQuery(c("M<U+00FC>cke", "Schnake"), paste0("pubDate in ", 2000:2003))
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab