libSBML C API
5.18.0
|
The Group_t class is the first and most central class in the SBML Level 3 Groups package. This class represents a group of entities: a simple mechanism for indicating that particular components of an SBML model are related in some way. The nature of the relationship is left up to the modeler, and can be clarified by means of annotations on model components. Groups may contain either the same or different types of SBML objects, and groups may be nested if desired. There are no predefined modeling or mathematical semantics associated with groups.
The Groups class has one required attribute, "kind"; two optional attributes, "id" and "name"; and a single child element, ListOfMembers_t. The membership of a group is determined by the contents of the list of members stored in Member_t objects within the ListOfMembers_t child of a Group_t object. Since the Group_t class of objects is derived from SBase_t, and SBase_t provides the ability to attach SBO_t terms as well as MIRIAM annotations, the semantics of a given group in a model can be made more precise using references to external controlled vocabularies and ontologies.
The attribute "kind" on Group_t is used to indicate the nature of the group defined by a Group_t instance. The "kind" attribute must always have one of the following three possible values:
"classification"
: The group represents a class, and its members have an is-a relationship to the group. For example, the group could represent a type of molecule such as ATP, and the members could be species located in different compartments, thereby establishing that the species are pools of the same molecule in different locations."partonomy"
: The group represents a collection of parts, and its members have a part-of relationship to the group. For example, the group could represent a cellular structure, and individual compartments could be made members of the group to indicate they represent subparts of that cellular structure."collection"
: The grouping is merely a collection for convenience, without an implied relationship between the members. For example, the group could be used to collect together multiple disparate components of a model—species, reactions, events—involved in a particular phenotype, and apply a common annotation rather than having to copy the same annotation to each component individually.In the libSBML API for Groups, these possible values for the "kind" attribute are programmatically represented as constants so that callers will not normally need to deal with text string values. The following are the constants defined for the three values of "kind" (plus an additional constant to represent unrecognized values):
If an SBML element is referenced by a Group_t's child Member_t (directly or indirectly), it is considered to be a member of that Group_t. If the same element is referenced by multiple Member_t objects, this is equivalent to including it just once. (It is considered best practice to avoid this, but does not make for an invalid SBML document.)
Children of referenced elements are not considered to be members of the Group_t: a KineticLaw_t of a referenced Reaction_t is not itself a Group_t member. Even the membership of so-called SBML container classes (e.g., ListOfSpecies_t, ListOfCompartments_t, etc.) does not imply inclusion of children as members of the Group_t. The sole exception to this rule is the handling of ListOfMembers_t class, described below.
The implication of this is that any rule that applies to members of a group (such the meaning of the "kind" attribute, or the restrictions on the application of "sboTerm" attributes on a ListOfMembers_t) applies to the child group when referenced by the Group_t "id", and to the members of the child group when referenced by the ListOfMembers_t "id". In an example situation where a parent group includes two Species_t plus a Group_t which itself contains three other Species_t, if the parent group's ListOfMembers_t is given an "sboTerm" attribute value, that SBO_t term applies to the two species and the group, not to the three child species members of the second group. (Note also that in such a case, the parent group's "kind" attribute value would almost certainly be "collection"
or "partonomy"
, and not "classification"
, as two species and a group are very unlikely to be classified as the same thing.) In contrast, in the situation where a parent group includes two Species_t plus a ListOfMembers_t which contains three other Species_t, the parent group's ListOfMembers_t "sboTerm" would apply to the five Species_t, and could be more reasonably marked as a "classification"
.
In a future version of this SBML Level 3 Groups specification, it may be possible to perform set operations on groups, but for now, this type of union is the only set operation that is possible.
Groups are not permitted to be circular: no Member_t may reference itself, its parent ListOfMembers_t, nor its parent Group_t. If a Member_t references a Group_t, the same restrictions apply to that subgroup's children: they may not reference the Member_t, its parent ListOfMembers_t, nor its parent Group_t, and if any of those children reference a Group_t, the same restrictions apply to them, etc.
If a Member_t has a "idRef" or "metaIdRef" attribute which references an object from a namespace that is not understood by the interpreter of the SBML model, that Member_t must be ignored. The referenced object will not be understood by the interpreter, and therefore has no need to become a member of the group. If an interpreter cannot tell whether a referenced object does not exist or if exists in an unparsed namespace, it may choose to produce a warning.
Public Member Functions | |
int | Group_addMember (Group_t *g, const Member_t *m) |
Adds a copy of the given Member_t to this Group_t. More... | |
Group_t * | Group_clone (const Group_t *g) |
Creates and returns a deep copy of this Group_t object. More... | |
Group_t * | Group_create (unsigned int level, unsigned int version, unsigned int pkgVersion) |
Creates a new Group_t using the given SBML Level, Version and “groups” package version. More... | |
Member_t * | Group_createMember (Group_t *g) |
Creates a new Member_t object, adds it to this Group_t object and returns the Member_t object created. More... | |
void | Group_free (Group_t *g) |
Frees this Group_t object. More... | |
char * | Group_getId (const Group_t *g) |
Returns the value of the "id" attribute of this Group_t. More... | |
GroupKind_t | Group_getKind (const Group_t *g) |
Returns the value of the "kind" attribute of this Group_t. More... | |
char * | Group_getKindAsString (const Group_t *g) |
Returns the value of the "kind" attribute of this Group_t. More... | |
ListOf_t * | Group_getListOfMembers (Group_t *g) |
Returns a ListOf_t * containing Member_t objects from this Group_t. More... | |
Member_t * | Group_getMember (Group_t *g, unsigned int n) |
Get a Member_t from the Group_t. More... | |
Member_t * | Group_getMemberById (Group_t *g, const char *sid) |
Get a Member_t from the Group_t based on its identifier. More... | |
Member_t * | Group_getMemberByIdRef (Group_t *g, const char *sid) |
Get a Member_t from the Group_t based on the element to which it refers. More... | |
char * | Group_getName (const Group_t *g) |
Returns the value of the "name" attribute of this Group_t. More... | |
unsigned int | Group_getNumMembers (Group_t *g) |
Get the number of Member_t objects in this Group_t. More... | |
int | Group_hasRequiredAttributes (const Group_t *g) |
Predicate returning 1 (true) if all the required attributes for this Group_t object have been set. More... | |
int | Group_isSetId (const Group_t *g) |
Predicate returning 1 (true) if this Group_t's "id" attribute is set. More... | |
int | Group_isSetKind (const Group_t *g) |
Predicate returning 1 (true) if this Group_t's "kind" attribute is set. More... | |
int | Group_isSetName (const Group_t *g) |
Predicate returning 1 (true) if this Group_t's "name" attribute is set. More... | |
Member_t * | Group_removeMember (Group_t *g, unsigned int n) |
Removes the nth Member_t from this Group_t and returns a pointer to it. More... | |
Member_t * | Group_removeMemberById (Group_t *g, const char *sid) |
Removes the Member_t from this Group_t based on its identifier and returns a pointer to it. More... | |
int | Group_setId (Group_t *g, const char *id) |
Sets the value of the "id" attribute of this Group_t. More... | |
int | Group_setKind (Group_t *g, GroupKind_t kind) |
Sets the value of the "kind" attribute of this Group_t. More... | |
int | Group_setKindAsString (Group_t *g, const char *kind) |
Sets the value of the "kind" attribute of this Group_t. More... | |
int | Group_setName (Group_t *g, const char *name) |
Sets the value of the "name" attribute of this Group_t. More... | |
int | Group_unsetId (Group_t *g) |
Unsets the value of the "id" attribute of this Group_t. More... | |
int | Group_unsetKind (Group_t *g) |
Unsets the value of the "kind" attribute of this Group_t. More... | |
int | Group_unsetName (Group_t *g) |
Unsets the value of the "name" attribute of this Group_t. More... | |
GroupKind_t | GroupKind_fromString (const char *code) |
Returns the enumeration value corresponding to the given string or GROUP_KIND_UNKNOWN if there is no such match. More... | |
int | GroupKind_isValid (GroupKind_t gk) |
Predicate returning 1 (true) or 0 (false) depending on whether the given enumeration value is valid. More... | |
int | GroupKind_isValidString (const char *code) |
Predicate returning 1 (true) or 0 (false) depending on whether the given string is a valid enumeration value. More... | |
const char * | GroupKind_toString (GroupKind_t gk) |
Returns the string version of the provided enumeration value. More... | |
Adds a copy of the given Member_t to this Group_t.
g | the Group_t structure to which the Member_t should be added. |
m | the Member_t object to add. |
Creates and returns a deep copy of this Group_t object.
g | the Group_t structure. |
Group_t * Group_create | ( | unsigned int | level, |
unsigned int | version, | ||
unsigned int | pkgVersion | ||
) |
Creates a new Group_t using the given SBML Level, Version and “groups” package version.
level | an unsigned int, the SBML Level to assign to this Group_t. |
version | an unsigned int, the SBML Version to assign to this Group_t. |
pkgVersion | an unsigned int, the SBML Groups Version to assign to this Group_t. |
Creates a new Member_t object, adds it to this Group_t object and returns the Member_t object created.
char * Group_getId | ( | const Group_t * | g | ) |
Returns the value of the "id" attribute of this Group_t.
g | the Group_t structure whose id is sought. |
GroupKind_t Group_getKind | ( | const Group_t * | g | ) |
Returns the value of the "kind" attribute of this Group_t.
g | the Group_t structure whose kind is sought. |
"classification"
, to indicate that the group represents a class, and its members have an is-a relationship to the group.
"partonomy"
, to indicate that the group represents a collection of parts, and its members have a part-of relationship to the group.
"collection"
, to indicate that the grouping is merely a collection for convenience, without an implied relationship between the members. char * Group_getKindAsString | ( | const Group_t * | g | ) |
Returns the value of the "kind" attribute of this Group_t.
g | the Group_t structure whose kind is sought. |
"classification"
, to indicate that the group represents a class, and its members have an is-a relationship to the group.
"partonomy"
, to indicate that the group represents a collection of parts, and its members have a part-of relationship to the group.
"collection"
, to indicate that the grouping is merely a collection for convenience, without an implied relationship between the members. Returns a ListOf_t * containing Member_t objects from this Group_t.
g | the Group_t structure whose ListOfMembers_t is sought. |
Get a Member_t from the Group_t.
g | the Group_t structure to search. |
n | an unsigned int representing the index of the Member_t to retrieve. |
n
is invalid, NULL
is returned.Get a Member_t from the Group_t based on its identifier.
g | the Group_t structure to search. |
sid | a string representing the identifier of the Member_t to retrieve. |
sid
or NULL
if no such Member_t exists.Get a Member_t from the Group_t based on the element to which it refers.
g | the Group_t structure to search. |
sid | a string representing the "idRef" attribute of the Member_t object to retrieve. |
char * Group_getName | ( | const Group_t * | g | ) |
Returns the value of the "name" attribute of this Group_t.
g | the Group_t structure whose name is sought. |
unsigned int Group_getNumMembers | ( | Group_t * | g | ) |
int Group_hasRequiredAttributes | ( | const Group_t * | g | ) |
Predicate returning 1
(true) if all the required attributes for this Group_t object have been set.
g | the Group_t structure. |
1
(true) to indicate that all the required attributes of this Group_t have been set, otherwise 0
(false) is returned.int Group_isSetId | ( | const Group_t * | g | ) |
int Group_isSetKind | ( | const Group_t * | g | ) |
Predicate returning 1
(true) if this Group_t's "kind" attribute is set.
g | the Group_t structure. |
1
(true) if this Group_t's "kind" attribute has been set, otherwise 0
(false) is returned."classification"
, to indicate that the group represents a class, and its members have an is-a relationship to the group.
"partonomy"
, to indicate that the group represents a collection of parts, and its members have a part-of relationship to the group.
"collection"
, to indicate that the grouping is merely a collection for convenience, without an implied relationship between the members. int Group_isSetName | ( | const Group_t * | g | ) |
Removes the nth Member_t from this Group_t and returns a pointer to it.
g | the Group_t structure to search. |
n | an unsigned int representing the index of the Member_t to remove. |
Removes the Member_t from this Group_t based on its identifier and returns a pointer to it.
g | the Group_t structure to search. |
sid | a string representing the identifier of the Member_t to remove. |
int Group_setId | ( | Group_t * | g, |
const char * | id | ||
) |
Sets the value of the "id" attribute of this Group_t.
g | the Group_t structure. |
id | const char * value of the "id" attribute to be set. |
id
= NULL
or an empty string is equivalent to calling Group_unsetId(). int Group_setKind | ( | Group_t * | g, |
GroupKind_t | kind | ||
) |
Sets the value of the "kind" attribute of this Group_t.
g | the Group_t structure. |
kind | GroupKind_t value of the "kind" attribute to be set. |
"classification"
, to indicate that the group represents a class, and its members have an is-a relationship to the group.
"partonomy"
, to indicate that the group represents a collection of parts, and its members have a part-of relationship to the group.
"collection"
, to indicate that the grouping is merely a collection for convenience, without an implied relationship between the members. int Group_setKindAsString | ( | Group_t * | g, |
const char * | kind | ||
) |
Sets the value of the "kind" attribute of this Group_t.
g | the Group_t structure. |
kind | const char * of the "kind" attribute to be set. |
"classification"
, to indicate that the group represents a class, and its members have an is-a relationship to the group.
"partonomy"
, to indicate that the group represents a collection of parts, and its members have a part-of relationship to the group.
"collection"
, to indicate that the grouping is merely a collection for convenience, without an implied relationship between the members. int Group_setName | ( | Group_t * | g, |
const char * | name | ||
) |
Sets the value of the "name" attribute of this Group_t.
g | the Group_t structure. |
name | const char * value of the "name" attribute to be set. |
name
= NULL
or an empty string is equivalent to calling Group_unsetName(). int Group_unsetId | ( | Group_t * | g | ) |
Unsets the value of the "id" attribute of this Group_t.
g | the Group_t structure. |
int Group_unsetKind | ( | Group_t * | g | ) |
Unsets the value of the "kind" attribute of this Group_t.
g | the Group_t structure. |
"classification"
, to indicate that the group represents a class, and its members have an is-a relationship to the group.
"partonomy"
, to indicate that the group represents a collection of parts, and its members have a part-of relationship to the group.
"collection"
, to indicate that the grouping is merely a collection for convenience, without an implied relationship between the members. int Group_unsetName | ( | Group_t * | g | ) |
Unsets the value of the "name" attribute of this Group_t.
g | the Group_t structure. |
GroupKind_t GroupKind_fromString | ( | const char * | code | ) |
Returns the enumeration value corresponding to the given string or GROUP_KIND_UNKNOWN if there is no such match.
code | the string to convert to an enumeration value. |
int GroupKind_isValid | ( | GroupKind_t | gk | ) |
Predicate returning 1
(true) or 0
(false) depending on whether the given enumeration value is valid.
gk | the enumeration value to query. |
1
(true) if the value is GROUP_KIND_CLASSIFICATION, GROUP_KIND_PARTONOMY, or GROUP_KIND_COLLECTION; 0
(false) otherwise (including GROUP_KIND_UNKNOWN). int GroupKind_isValidString | ( | const char * | code | ) |
Predicate returning 1
(true) or 0
(false) depending on whether the given string is a valid enumeration value.
code | the string to query. |
1
(true) if the string is "classification", "partonomy", or "collection"; 0
(false) otherwise.1
(true), but "Classification" will return 0
(false). const char * GroupKind_toString | ( | GroupKind_t | gk | ) |
Returns the string version of the provided enumeration value.
gk | the enumeration value to convert. |
NULL
if the value is GROUP_KIND_UNKNOWN or another invalid enumeration value.