Query for data from the CSTMC (Canadian Science & Technology Museum Corporation)

cstmc_changes(offset = 0, limit = 31, as = "list", ...)

cstmc_datasets(offset = 0, limit = 31, as = "list", ...)

cstmc_group_list(
  offset = 0,
  limit = 31,
  sort = NULL,
  groups = NULL,
  all_fields = FALSE,
  as = "list",
  ...
)

cstmc_group_show(id, include_datasets = TRUE, as = "list", ...)

cstmc_tag_list(
  query = "*:*",
  vocabulary_id = NULL,
  all_fields = FALSE,
  as = "list",
  ...
)

cstmc_tag_show(id, as = "list", ...)

cstmc_package_search(
  q = "*:*",
  fq = NULL,
  sort = NULL,
  rows = NULL,
  start = NULL,
  facet = FALSE,
  facet.limit = NULL,
  facet.field = NULL,
  as = "list",
  ...
)

cstmc_package_show(id, use_default_schema = FALSE, as = "list", ...)

cstmc_resource_search(
  q = "*:*",
  sort = NULL,
  offset = NULL,
  limit = NULL,
  as = "list",
  ...
)

Arguments

offset

Record to start at, default to beginning.

limit

Number of records to return.

as

(character) One of list (default), table, or json. Parsing with table option uses jsonlite::fromJSON(..., simplifyDataFrame = TRUE), which attempts to parse data to data.frame's when possible, so the result can vary.

...

Curl args passed on to httr::POST

sort

Field to sort on. You can specify ascending (e.g., score desc) or descending (e.g., score asc), sort by two fields (e.g., score desc, price asc), or sort by a function (e.g., sum(x_f, y_f) desc, which sorts by the sum of x_f and y_f in a descending order).

groups

(character) A list of names of the groups to return, if given only groups whose names are in this list will be returned

all_fields

(logical) Return full tag or group dictionaries instead of just names. Default: FALSE

id

(character) The name or id of the tag

include_datasets

(logical) Include a list of the group's datasets. Default: TRUE

query

(character) A tag name query to search for, if given only tags whose names contain this string will be returned

vocabulary_id

(character) The id or name of a vocabulary, if give only tags that belong to this vocabulary will be returned

q

Query terms, defaults to ':', or everything. It is a string of the form field:term or a list of strings, each of the same form. Within each string, field is a field or extra field on the Resource domain object. If field is hash, then an attempt is made to match the term as a prefix of the Resource.hash field. If field is an extra field, then an attempt is made to match against the extra fields stored against the Resource.

fq

Filter query, this does not affect the search, only what gets returned

rows

Number of records to return. Defaults to 10.

start

Record to start at, default to beginning.

facet

(logical) Whether to return facet results or not. Default: FALSE

facet.limit

(numeric) This param indicates the maximum number of constraint counts that should be returned for the facet fields. A negative value means unlimited. Default: 100. Can be specified on a per field basis.

facet.field

(charcter) This param allows you to specify a field which should be treated as a facet. It will iterate over each Term in the field and generate a facet count using that Term as the constraint. This parameter can be specified multiple times to indicate multiple facet fields. None of the other params in this section will have any effect without specifying at least one field name using this param.

use_default_schema

(logical) Use default package schema instead of a custom schema defined with an IDatasetForm plugin. Default: FALSE

References

http://data.techno-science.ca/

Examples

if (FALSE) { # Changes cstmc_changes() cstmc_changes(as='json') cstmc_changes(as='table') # List datasets cstmc_datasets() # List groups cstmc_group_list() # Show groups cstmc_group_show('communications') # List tags cstmc_tag_list('aviation') # Show tags cstmc_tag_show('Aviation') # Search for packages cstmc_package_search(q = '*:*') cstmc_package_search(q = '*:*', rows = 2, as='json') cstmc_package_search(q = '*:*', rows = 2, as='table') cstmc_package_search(q = '*:*', sort = 'score asc') cstmc_package_search(q = '*:*', fq = 'num_tags:[3 TO *]')$count # Show packages cstmc_package_show('34d60b13-1fd5-430e-b0ec-c8bc7f4841cf') cstmc_package_show('34d60b13-1fd5-430e-b0ec-c8bc7f4841cf', as='json') cstmc_package_show('34d60b13-1fd5-430e-b0ec-c8bc7f4841cf', as='table') cstmc_package_show('34d60b13-1fd5-430e-b0ec-c8bc7f4841cf', TRUE) # Search for resources cstmc_resource_search(q = 'name:data') cstmc_resource_search(q = 'name:data', as='json') cstmc_resource_search(q = 'name:data', as='table') cstmc_resource_search(q = 'name:data', limit = 2, as='table') }