Add dmozDomain and wikiDomain to default metadata fetches
Resolves #31
Change-Id: I61fcd8f045ebf164ee0586470ab58ea929e8e7ba
diff --git a/R/KorAPQuery.R b/R/KorAPQuery.R
index 85f1e8f..abd1734 100644
--- a/R/KorAPQuery.R
+++ b/R/KorAPQuery.R
@@ -45,7 +45,8 @@
"initialize", "KorAPQuery",
function(.Object, korapConnection = NULL, request = NULL, vc = "", totalResults = 0, nextStartIndex = 0, fields = c(
"corpusSigle", "textSigle", "pubDate", "pubPlace",
- "availability", "textClass", "snippet", "tokens"
+ "availability", "textClass", "dmozDomain", "wikiDomain",
+ "snippet", "tokens"
),
requestUrl = "", webUIRequestUrl = "", apiResponse = NULL, hasMoreMatches = FALSE, collectedMatches = NULL) {
.Object <- callNextMethod()
@@ -111,7 +112,7 @@
#' \item{**Publication info**:}{`author`, `editor`, `title`, `docTitle`, `corpusTitle` - authorship and titles}
#' \item{**Temporal data**:}{`pubDate`, `creationDate` - when text was published/created}
#' \item{**Publication details**:}{`pubPlace`, `publisher`, `reference` - where/how published}
-#' \item{**Text classification**:}{`textClass`, `textType`, `textTypeArt`, `textDomain`, `textColumn` - topic domain, genre, text type and column}
+#' \item{**Text classification**:}{`textClass`, `dmozDomain`, `wikiDomain`, `textType`, `textTypeArt`, `textDomain`, `textColumn` - topic domain, genre, text type and column}
#' \item{**Adminstrative and technical info**:}{`corpusEditor`, `availability`, `language`, `foundries` - access rights and annotations}
#' \item{**Content data**:}{`snippet`, `tokens`, `tokenSource`, `externalLink` - actual text content, tokenization, and link to source text}
#' \item{**System data**:}{`indexCreationDate`, `indexLastModified` - corpus indexing info}
@@ -206,6 +207,8 @@
"pubPlace",
"availability",
"textClass",
+ "dmozDomain",
+ "wikiDomain",
"snippet",
"tokens"
),
diff --git a/man/corpusQuery-KorAPConnection-method.Rd b/man/corpusQuery-KorAPConnection-method.Rd
index e26ad13..06356fa 100644
--- a/man/corpusQuery-KorAPConnection-method.Rd
+++ b/man/corpusQuery-KorAPConnection-method.Rd
@@ -19,7 +19,7 @@
metadataOnly = TRUE,
ql = if (missing(KorAPUrl)) "poliqarp" else httr2::url_parse(KorAPUrl)$query$ql,
fields = c("corpusSigle", "textSigle", "pubDate", "pubPlace", "availability",
- "textClass", "snippet", "tokens"),
+ "textClass", "dmozDomain", "wikiDomain", "snippet", "tokens"),
accessRewriteFatal = TRUE,
verbose = kco@verbose,
expand = length(vc) != length(query),
@@ -52,7 +52,7 @@
\item{\strong{Publication info}:}{\code{author}, \code{editor}, \code{title}, \code{docTitle}, \code{corpusTitle} - authorship and titles}
\item{\strong{Temporal data}:}{\code{pubDate}, \code{creationDate} - when text was published/created}
\item{\strong{Publication details}:}{\code{pubPlace}, \code{publisher}, \code{reference} - where/how published}
-\item{\strong{Text classification}:}{\code{textClass}, \code{textType}, \code{textTypeArt}, \code{textDomain}, \code{textColumn} - topic domain, genre, text type and column}
+\item{\strong{Text classification}:}{\code{textClass}, \code{dmozDomain}, \code{wikiDomain}, \code{textType}, \code{textTypeArt}, \code{textDomain}, \code{textColumn} - topic domain, genre, text type and column}
\item{\strong{Adminstrative and technical info}:}{\code{corpusEditor}, \code{availability}, \code{language}, \code{foundries} - access rights and annotations}
\item{\strong{Content data}:}{\code{snippet}, \code{tokens}, \code{tokenSource}, \code{externalLink} - actual text content, tokenization, and link to source text}
\item{\strong{System data}:}{\code{indexCreationDate}, \code{indexLastModified} - corpus indexing info}
diff --git a/man/initialize-KorAPQuery-method.Rd b/man/initialize-KorAPQuery-method.Rd
index beb44ad..79e9df4 100644
--- a/man/initialize-KorAPQuery-method.Rd
+++ b/man/initialize-KorAPQuery-method.Rd
@@ -12,7 +12,7 @@
totalResults = 0,
nextStartIndex = 0,
fields = c("corpusSigle", "textSigle", "pubDate", "pubPlace", "availability",
- "textClass", "snippet", "tokens"),
+ "textClass", "dmozDomain", "wikiDomain", "snippet", "tokens"),
requestUrl = "",
webUIRequestUrl = "",
apiResponse = NULL,
diff --git a/tests/testthat/test-corpusQuery.R b/tests/testthat/test-corpusQuery.R
index b5b73ee..7ef9e00 100644
--- a/tests/testthat/test-corpusQuery.R
+++ b/tests/testthat/test-corpusQuery.R
@@ -70,15 +70,15 @@
expect_equal(matches$matchStart[1], matches$matchEnd[1])
})
-test_that("fetchAll fetches textClass metadatum", {
+test_that("fetchAll fetches dmozDomain metadatum", {
skip_if_offline()
q <- KorAPConnection(accessToken = NULL, verbose = TRUE) %>%
corpusQuery("Ameisenplage", vc = "pubDate since 2014")
expectedResults <- q@totalResults
matches <- fetchAll(q)@collectedMatches
- expect_true(any(grepl("wissenschaft ", matches$textClass)))
- expect_true(any(grepl(" populaerwissenschaft", matches$textClass)))
- expect_true(any(grepl("kultur literatur", matches$textClass)))
+ # DeReKo-2026 renamed textClass to dmozDomain (space separated)
+ expect_true(any(grepl("wissenschaft ", matches$dmozDomain)))
+ expect_true(any(grepl(" populaerwissenschaft", matches$dmozDomain)))
})
test_that("Uncached query for non-matching search string return 0 results", {
diff --git a/tests/testthat/test-textMetadata.R b/tests/testthat/test-textMetadata.R
index 13c754a..6a44cd6 100644
--- a/tests/testthat/test-textMetadata.R
+++ b/tests/testthat/test-textMetadata.R
@@ -54,8 +54,10 @@
kco <- KorAPConnection(accessToken = NULL)
m <- textMetadata(kco, "WUD17/B96/57558")
- expect_true("staat-gesellschaft\\tbiographien-interviews" == m$textClass[1] ||
- grepl("\\t", m$textClass[1]),
+ # DeReKo-2026 renamed textClass to dmozDomain (list valued); list
+ # valued fields are flattened tab separated
+ expect_true("staat-gesellschaft\\tbiographien-interviews" == m$dmozDomain[1] ||
+ grepl("\\t", m$dmozDomain[1]),
"multiple text classes / domains should be tab separated")
})