Fair Data Point Schemas and Definitions#
- class fdp.metadataschema.MetadataSchema(fair_data_point: FairDataPoint = None, uuid: str = None)#
Bases:
FairDataPointItemClass representing a Fair Data Point Metadata Schema.
- URL_PATH = 'metadata-schemas'#
- CONTENT_TYPE = 'application/json'#
- property name: str#
The
nameproperty.
- property description: str#
The
descriptionattribute.
- property definition: str#
Get or set the
definitionproperty of the Metadata Schema.Warning
the definitiona MUST be a RDF string
- Raises:
TypeError – if the
definitionis not a strValueError – if the string does not contain a valid RDF graph
- property suggestedResourceName: str#
The
suggestedResourceNameproperty.
- property suggestedUrlPrefix: str#
The
suggestedUrlPrefixproperty.
- property abstractSchema: str#
The
abstractSchemaproperty.
- property extendsSchemaUuids: set#
Get the list of the Schemas’ UUIDs extended by the Metadata Schema.
Note
the setter for this property is the
add_extendSchemaUuidsfunction.
- add_extendsSchemaUuids(metadata_schema: str | MetadataSchema | list[str] | list[MetadataSchema])#
Adds Metadata Schemas (one or a list) to the list of Metadata Schema extended.
- Parameters:
metadata_schema (str or MetadataSchema instance or a list of str or MetadataSchema instances) – the UUID of the Metadata Schema or the MetadataSchema instance to add ora a list of them
- Returns:
none
- Raises:
TypeError – if the
metadata_schemais not a str nor a MetadataSchema instance or a list of them
- property version: str#
The version attribute.
- publish(version: Version = None, comment: str = None)#
- create()#
Creates a new Metadata Schema.
- delete()#
Deletes a Metadata Schema from the Fair Data Point. On success, UUID attribute is set to None
- update()#
Deletes a Metadata Schema from the Fair Data Point. On success, UUID attribute is set to None
- get_by_name(name: str, ignore_case: bool = False, draft: bool = False)#
Retrieve the Metadata Schema with the given name.
- Parameters:
name – the name of the metadata schema to retrieve
ignore_case – if True, performs a case-insensitive search
draft – if True, retrieves the draft of the Metadata Schema drafts, if any
- Returns:
the Metadata Schema or None
- Return type:
- get_by_uuid(uuid: str, draft: bool = False)#
Retrieve the Metadata Schema with the given uuid.
- Parameters:
uuid – the uuid of the metadata schema to retrieve
draft – if True, retrieves the draft of the Metadata Schema drafts, if any
- Returns:
the Metadata Schema or None
- Return type:
- list(draft: bool = False)#
Retrieve the list of all the Metadata Schemas.
- Parameters:
draft – if True, retrieves only the list of Metadata Schemas’ drafts, if any
- Returns:
a list of the Metadata Schema
- Return type:
list[MetadataSchema]
- class fdp.resourcedefinition.ResourceDefinition(fair_data_point: FairDataPoint = None, uuid: str = None)#
Bases:
FairDataPointItemClass representing a Fair Data Point Resource Definition.
- URL_PATH = 'resource-definitions'#
- CONTENT_TYPE = 'application/json'#
- property name: str#
The
nameproperty.
- property urlPrefix: str#
Get or set the
urlPrefixproperty of the Resource Definition.
- property metadataSchemaUuids: list#
Get the Metadata Schemas’s UUID of the Resource Definition.
Note
the setter for this property is the
add_metadataSchemaUuidsfunction.
- add_metadataSchemaUuids(metadata_schema: str | MetadataSchema | list[str] | list[MetadataSchema])#
Adds a Metadata Schema to the Resource Definition.
- Parameters:
metadata_schema (str or MetadataSchema instance or a list of str or MetadataSchema instances) – the UUID of the Metadata Schema or the MetadataSchema instance to add to the Resource Definition
- Returns:
none
- Raises:
TypeError – if the
metadata_schemais not a str nor a MetadataSchema instance or a list of them
- property children: dict#
Get the children of the Resource Definition.
Note
the setter for this property is the
add_childrenfunction.
- add_children(children: dict | list[dict])#
Adds one or more children to the the Resource Definition.
- Parameters:
children – the children to add to the Resource Definition. The dictionary must be of the type:
{ "resourceDefinitionUuid": string, "relationUri": string }
- Returns:
none
- Raises:
TypeError – if the
childrenis not a dict nor a list of dict or is missing of one mandatory attribute.
Note
the function does not check for duplication.
Warning
the
childdictionary is incomplete. It lacks the listView attribute.
- property externalLinks: list[dict]#
Get the externalLinks property of the Resource Definition.
Note
the setter for this property is the
add_externalLinksfunction.
- add_externalLinks(links: dict | list[dict])#
Adds external links to the the Resource Definition.
- Parameters:
links – the external link or a list of external links to add to the Resource Definition. The dictionary must be of the type:
{ "title": string, "propertyUri": string }
- Returns:
none
- Raises:
TypeError – if the
linksis not a dict nor a list of dict
- get_by_name(name: str, ignore_case: bool = False)#
Retrieve the Resource Definition with the given name.
- Parameters:
name – the name of the resource definition to retrieve
ignore_case – if True, performs a case-insensitive search
- Returns:
the Resource Definition or None
- Return type:
- get_by_uuid(uuid: str)#
Retrieve the Resource Definition with the given uuid.
- Parameters:
uuid – the uuid of the resource definition to retrieve
- Returns:
the Resource Definition or None
- Return type:
- list()#
Retrieve the list of all the Metadata Schemas.
- Returns:
a list of the Metadata Schema
- Return type:
list[MetadataSchema]