RomEntity: Base entity data object

RomEntityR Documentation

Base entity data object

Description

Object for storing a single entity with attribute and timeseries related

Details

Has standard methods for managing data and meta data

Value

reference class of type openmi.om.base.

an updated config if necessary or FALSE if it fails

loads the varid

the variable definition object for this entity

A property object for this entity derived from the local or remote DB OR populated by user inputs if property does not exist

the property object for this entity

the data from the remote connection

Public fields

name

what is it called

base_entity_type

kind of entity

datasource

RomDataSource

pk_name

the name of this entity's pk column

entity_id

unique ID of entity

sql_select_from

syntax to use to select via an odbc or other SQL based datasource

base_only

- how to export to list in case of complex multi table entity and ODBC

has_vardef

is pluggable?

varid

(optional) integer field for pluggable entities

vardef

(optional) full RomVariableDefinition

plugin

(optional) instance of dHVariablePlugin class

matrix_revision_id

Populated by any use of this object's save_field() method to indicate the revision ID of this change to the field table. Used to match Drupal 7's now deprecated revision system.

Methods

Public methods


Method get_id()

Usage
RomEntity$get_id()
Returns

get_id the unique id of this entity alias to remote pkid, subclassed as function


Method propvalues()

Usage
RomEntity$propvalues(propname = NULL, varid = NULL, propcode = NULL)
Arguments
propname

optional name to filter

varid

option variable to filter

propcode

optional code to filter

Returns

propvalues unique properties of this entity


Method tsvalues()

Usage
RomEntity$tsvalues(varkey = NULL, tstime = NULL, tsendtime = NULL)
Arguments
varkey

option variable to filter

tstime

timespan begin

tsendtime

timespan end

Returns

tsvalues unique timeseries records for this entity


Method new()

Usage
RomEntity$new(datasource = NULL, config = list(), load_remote = FALSE)
Arguments
datasource

RESTful repository (optional)

config

list of attributes to set, see also: to_list() for format

load_remote

automatically query REST data source for matches?

Returns

object instance


Method handle_config()

Usage
RomEntity$handle_config(config)
Arguments
config

Method insure_varid()

Usage
RomEntity$insure_varid(config)
Arguments
config

Method get_vardef()

Usage
RomEntity$get_vardef(config = FALSE, refresh = FALSE)
Arguments
config

list of attributes to set, see also: to_list() for format

refresh

automatically refresh var info?


Method get_prop()

Get a 1st order property from this entity (assuming this entities entity_type. This method will search for a user propname, varkey, or propcode from dh_properties using this entity's id (derived from RomEntity$get_id() as the featureid. If the property is not set locally (if remote = FALSE) or in the DB (if remote = TRUE), then it will return an instance of RomProperty with the specified user inputs and this entity's ID.

Usage
RomEntity$get_prop(
  propname = NULL,
  varkey = NULL,
  propcode = NULL,
  remote = TRUE
)
Arguments
propname

Propname of the first order property

varkey

varkey of the first order property (usually used in case of new prop creation)

propcode

propcode of the first order property (usually used in case of new prop creation)

remote

look at remote datasource for properties?


Method set_prop()

Usage
RomEntity$set_prop(
  propname,
  propcode = NULL,
  propvalue = NULL,
  varkey = NULL,
  data_matrix = NULL,
  remote = TRUE
)
Arguments
propname

name or property

propcode

if alpha property use this

propvalue

if numeric property use this

varkey

which varkey? defaults to guess Constant and AlphanumericConstant

data_matrix

dataframe contained rows/cols

remote

look at remote datasource?


Method from_list()

Usage
RomEntity$from_list(config)
Arguments
config

list of attributes to set, see also: to_list() for format

Returns

NULL


Method load_data()

Usage
RomEntity$load_data(config, load_remote)
Arguments
config
load_remote

automatically query remote data source for matches?


Method load_plugin()

Usage
RomEntity$load_plugin()
Returns

nothing, but loads the objects plugin


Method to_list()

Usage
RomEntity$to_list(base_only = FALSE)
Arguments
base_only

whether to only use base columns (TRUE) or add fields (FALSE)

Returns

list of object attributes suitable for input to new() and from_list() methods


Method save()

Usage
RomEntity$save(push_remote = FALSE)
Arguments
push_remote

update locally only or push to remote database

Returns

NULL


Method delete()

Usage
RomEntity$delete(delete_remote = FALSE)
Arguments
delete_remote

update locally only or push to remote database

Returns

NULL


Method save_field()

Usage
RomEntity$save_field(
  class_field_name,
  field_table,
  value_pairs,
  pkeys = c("entity_type", "entity_id")
)
Arguments
class_field_name

what is this field called on this object (deprecated)

field_table

table to insert into

value_pairs

attriutes to add to insert above the basic entity info (field value here)

pkeys

whether to automatically propagate changes to remote data source

Returns

NULL


Method clone()

The objects of this class are cloneable with this method.

Usage
RomEntity$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

NA

Examples

NA

HARPgroup/hydro-tools documentation built on July 4, 2025, 11:05 a.m.