Get Resources from Eratos
get_resources.RdFind resources using the Eratos workspace API with various search and filter options.
Usage
get_resources(
query = NULL,
limit = 20,
skip = 0,
exclude = NULL,
type = NULL,
excludeType = NULL,
owner = NULL,
collections = NULL,
facets = NULL,
sort = "@date:asc",
scope = NULL,
property_filters = NULL
)Arguments
- query
Character string. Free text search query - supports wildcards (*) and simple AND/OR logic.
- limit
Integer (1-100). Limit the number of results. Defaults to 20.
- skip
Integer (>= 0). Starting index for results. Defaults to 0.
- exclude
Character string. Comma separated list of ERNs or IDs to exclude.
- type
Character string. Comma separated list of ERNs or IDs of schema types to include.
- excludeType
Character string. Comma separated list of ERNs or IDs of schema types to exclude.
- owner
Character string. Comma separated list of owner ERNs.
- collections
Character string. Comma separated list of collection ERNs.
- facets
Character string. Comma separated list of facets.
- sort
Character string. Sort order. Defaults to "@date:asc". If sorting other than name or @date, type must be specified.
- scope
Character string. Scope of the query (e.g. "Public" or "Private").
- property_filters
Named list. Advanced property filtering in the form list(property_name = list(op = "eq", value = "search_value")). Supported operations: "eq" (equal), "ne" (not equal), "gt" (greater than), "lt" (less than), "ge" (greater than or equal), "le" (less than or equal). Note: Property functions require type to also be set.
Details
This function queries the Eratos workspace API to find resources matching the specified criteria. The API supports both simple text search and advanced property-based filtering.
For advanced querying using property_filters, only properties that exist in the schema type definition can be queried, and not all properties within a schema are queryable.
Examples
if (FALSE) { # \dontrun{
# Simple text search
resources <- get_resources(query = "temperature*")
# Limit results and skip first 10
resources <- get_resources(query = "sensor", limit = 50, skip = 10)
# Filter by type and owner
resources <- get_resources(
type = "ern:e-pn.io:resource:eratos.sensor",
owner = "ern:e-pn.io:resource:eratos.user.john"
)
# Advanced property filtering
resources <- get_resources(
type = "block",
property_filters = list(
creator = list(op = "eq", value = "ern:e-pn.io:resource:eratos.creator.eratos")
)
)
# Sort by date descending
resources <- get_resources(sort = "@date:desc")
} # }