Fair Data Point Schemas and Definitions#

class fdp.metadataschema.MetadataSchema(fair_data_point: FairDataPoint = None, uuid: str = None)#

Bases: FairDataPointItem

Class representing a Fair Data Point Metadata Schema.

URL_PATH = 'metadata-schemas'#
CONTENT_TYPE = 'application/json'#
property name: str#

The name property.

property description: str#

The description attribute.

property definition: str#

Get or set the definition property of the Metadata Schema.

Warning

the definitiona MUST be a RDF string

Raises:
  • TypeError – if the definition is not a str

  • ValueError – if the string does not contain a valid RDF graph

property suggestedResourceName: str#

The suggestedResourceName property.

property suggestedUrlPrefix: str#

The suggestedUrlPrefix property.

property abstractSchema: str#

The abstractSchema property.

property extendsSchemaUuids: set#

Get the list of the Schemas’ UUIDs extended by the Metadata Schema.

Note

the setter for this property is the add_extendSchemaUuids function.

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_schema is 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:

MetadataSchema

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:

MetadataSchema

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: FairDataPointItem

Class representing a Fair Data Point Resource Definition.

URL_PATH = 'resource-definitions'#
CONTENT_TYPE = 'application/json'#
property name: str#

The name property.

property urlPrefix: str#

Get or set the urlPrefix property 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_metadataSchemaUuids function.

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_schema is 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_children function.

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 children is 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 child dictionary is incomplete. It lacks the listView attribute.

Get the externalLinks property of the Resource Definition.

Note

the setter for this property is the add_externalLinks function.

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 links is 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:

ResourceDefinition

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:

ResourceDefinition

list()#

Retrieve the list of all the Metadata Schemas.

Returns:

a list of the Metadata Schema

Return type:

list[MetadataSchema]