gmAdd
adds a new object to a geometallurgical database. Its attributes can be set and updated with gmSet
gmAdd(where, what, data, rg=getOption("defaultRightsGroup"), EXPR=substitute(where), envir=parent.frame(), db=getOption("gmDB"), force=FALSE)
gmSet(where, data, varID=NULL, childs=NULL, members=NULL,EXPR=substitute(where), envir=parent.frame(), db=getOption("gmDB"), update=TRUE)
gmExpr
, a ID from the database
is possible, too.what
, which will be updatedwhere
.where
.FALSE
, the case of missing required class members results in an abortion, otherwise only warnings are printed.TRUE
, set objects will be updated instead of adding new entries.gmAdd
returns the gmID of the first added object.
gmAdd
adds one or more new objects of the specified variable name to a geometallurgical database. The number of new objects is determined by
data
. This is a list or data frame stating values for the class members of each new object. If force=TRUE
missing required class
members are ignored and a warning is given. If force=FALSE
the insert is aborded in the case of missing required members with a corresponding
error message. If no rights group is given the object will not be linked to the default rights group. If that is not explicitly set by
gmDefaultRightsGroup
the new object will not be linked to any rights group. Therefore it will be accessible by everyone. For the actual insertion of the values of the members, the function gmSet
is used. If a member given in data
is already set for this
object, then the database is being updated. Otherwise this attribute is added. Attributes which are not allowed for this object result in an abortion
and an error message.
If gmSet
is used outside gmAdd
the argmuments varID
, childs
and members
may be missing and therefore set to
NULL
. Then they are queried prior to the insertion. This setting is used to determine, if gmSet
is called by gmAdd
. If
data
contains a set object, setting the argument update
to TRUE
prohibits updating this member. Instead an additional entry
is added.
If gmSet
is called by gmAdd
and a creationTime is missing in data
, gmSet
adds the actual time instead.
Since that for variables of the type set more than one entry is permitted, you have the possibility of updating the entry or adding a new reference
by setting update=FALSE
. If there is already more than one entry, updating is not permitted.
gmRead
, gmExpr
## Not run:
# gmAdd(root,"project",list(gmTitle="sunny thursday", gmCreator=3))
# gmSet(root$project[gmTitle=="sunny thursday"], list(gmName="something"))
# ## End(Not run)
Run the code above in your browser using DataLab