Skip to content

The DSData class

gamslib.objectcsv.dsdata.DSData dataclass

DSData(dspath, dsid='', title='', description='', mimetype='', creator='', rights='', lang='', tags='')

Represents metadata for a single datastream of a GAMS object.

Fields:

  • dspath (str): Relative path to the datastream file.
  • dsid (str): Datastream identifier.
  • title (str): Title of the datastream.
  • description (str): Description of the datastream.
  • mimetype (str): MIME type of the datastream.
  • creator (str): Creator of the datastream.
  • rights (str): Rights statement for the datastream.
  • lang (str): Language(s) of the datastream.
  • tags (str): Additional tags for the datastream.

dspath instance-attribute

dspath

dsid class-attribute instance-attribute

dsid = ''

title class-attribute instance-attribute

title = ''

description class-attribute instance-attribute

description = ''

mimetype class-attribute instance-attribute

mimetype = ''

creator class-attribute instance-attribute

creator = ''

rights class-attribute instance-attribute

rights = ''

lang class-attribute instance-attribute

lang = ''

tags class-attribute instance-attribute

tags = ''

fieldnames classmethod

fieldnames()

Return the list of field names for DSData.

RETURNS DESCRIPTION
list[str]

list[str]: Names of all fields in the DSData dataclass.

merge

merge(other_dsdata)

Merge metadata from another DSData instance.

Selectively overwrites fields ('title', 'mimetype', 'creator', 'rights') with non-empty values from the other instance. Both datastreams must have the same dspath and dsid.

PARAMETER DESCRIPTION
other_dsdata

Another DSData instance to merge from.

TYPE: DSData

RAISES DESCRIPTION
ValueError

If dspath or dsid do not match.

validate

validate()

Validate required metadata fields.

RAISES DESCRIPTION
ValueError

If any required field (dspath, dsid, mimetype, rights) is empty.

guess_missing_values

guess_missing_values(object_path)

Infer missing metadata values by analyzing the datastream file.

Uses format detection and default values to fill in missing fields.

PARAMETER DESCRIPTION
object_path

Path to the object directory containing the datastream.

TYPE: Path