heliport.core package

Subpackages

Submodules

heliport.core.adapters module

Account adapters for usage with allauth.

class heliport.core.adapters.AccountAdapter(request=None)

Bases: DefaultAccountAdapter

Adapter that allows enabling/disabling registration via settings.

is_open_for_signup(request)

Allow creation of local accounts based on settings.

save_user(request, user, form, commit=True)

Save the new user.

This takes the user created in the parent class and creates a HeliportUser object for it.

class heliport.core.adapters.HelmholtzIDAccountAdapter(request=None)

Bases: DefaultSocialAccountAdapter

Adapter for use with Helmholtz ID.

is_open_for_signup(request, sociallogin)

Allow new Helmholtz ID accounts based on settings.

pre_social_login(request, sociallogin)

Disallow login based on configurable eduperson entitlements.

save_user(request, sociallogin, form=None)

Save the new user.

The parent class internally calls AccountAdapter.save_user(), thus the user’s HELIPORT user already exists. Here, we enrich it with more information provided by the sociallogin.

validate_disconnect(account, accounts)

Allow LDAP users to disconnect their socialaccounts.

heliport.core.adapters.get_display_name(user: User)

Return a user’s display name.

heliport.core.admin module

Registers Django admin pages.

See django.contrib.admin.ModelAdmin from Django documentation.

class heliport.core.admin.LoginInfoAdmin(model, admin_site)

Bases: ModelAdmin

Admin interface that only shows non-sensitive information.

fields = ['user', 'name', 'type']
property media
class heliport.core.admin.ProjectAdmin(model, admin_site)

Bases: ModelAdmin

filter_horizontal = ('co_owners',)
property media

heliport.core.app_interaction module

class heliport.core.app_interaction.Module

Bases: ABC

abstract get_url(project)
icon = 'fa-solid fa-question'
abstract is_configured(project)
abstract property module_id
abstract property name
class heliport.core.app_interaction.ModuleSection(name, project, is_configured_cache)

Bases: object

add(module)
property addable
property addable_list
property included
property included_list
is_configured(module)
class heliport.core.app_interaction.PreconfiguredModuleSection(name, project, is_configured_cache)

Bases: ModuleSection

is_configured(module)
heliport.core.app_interaction.generate_graph(project)
heliport.core.app_interaction.generate_project_dropdown(project)
heliport.core.app_interaction.generate_project_navbar(project)
heliport.core.app_interaction.get_heliport_apps()
heliport.core.app_interaction.get_module_index()
heliport.core.app_interaction.get_project_create_urls()
heliport.core.app_interaction.get_search_urls()
heliport.core.app_interaction.serialize_project_data(project)

heliport.core.apps module

Django app configuration.

Some HELIPORT hooks can be registered in app config django.apps.AppConfig.ready().

See also Django documentation

class heliport.core.apps.HeliportConfig(app_name, app_module)

Bases: AppConfig

App configuration for the main HELIPORT app. This is part of Django’s plugin system.

name = 'heliport.core'
ready()

Register hooks and import settings.

heliport.core.apps.post_migrate_handler(**kwargs)

heliport.core.attribute_description module

class heliport.core.attribute_description.AttrObj(label, persistent_id, description='')

Bases: object

Attribute Object to hold information that a normal DigitalObject would have for the purpose of supplying a simple constant value to the attribute_digital_object parameter when creating instances of BaseAttribute:

  • label - Short string to be shown as the property name

  • persistent_id - Globally unique persistent identifier for the property (in the format of a URL)

  • description (optional) - Longer string to describe this property

to_rdflib_node()

Return an rdflib:rdflib.Node for this object.

This method is needed when describing a graph in AttributeType.rdf_triples(). See heliport.vocabulary_descriptor.TripleDescription.to_node(). heliport.models.DigitalObject.to_rdflib_node() implements this interface for DigitalObjects.

class heliport.core.attribute_description.AttrObjT

Bases: BasicObjType

Represent a value that is an AttrObj.

to_string(obj, options)
class heliport.core.attribute_description.Attribute(attribute_digital_object, attribute_type, object_field, **kwargs)

Bases: BaseAttribute

Get value from attribute name as string. In the following example “distance_from_sun” is the attribute name:

class Planet:
    distance_from_sun: str

@static_attributes.register(Planet)
def planet_attributes() -> typing.List[BaseAttribute]:
    return [
        Attribute(
            AttrObj("Distance from the sun", "https://example.org/distance_from_sun"), StringT, "distance_from_sun"
        )
    ]

See also BaseAttribute for more information.

getattr(obj)

Get attribute by name (object_field).

object_field: str

The name of the attribute where to get the value from.

setattr(obj, value)

Set attribute by name.

Raises:

TypeError – if attribute specified by object_field is a read only property

class heliport.core.attribute_description.AttributeType

Bases: object

The abstract base class for types used in a BaseAttribute. The AttributeType controls how values of some property behave and are presented/encoded. Different HELIPORT modules can implement additional subclasses of this class to be able to represent any object they need. Many basic types are already implemented.

deserialize(obj, options)

Generate an object of this type from obj.

Parameters:
  • obj – description of an object of this type as a string or primitive type (like list of dict)

  • options – other kwargs when instantiating a BaseAttribute

form_template_name = 'core/form_field/input.html'

Path to a django template for editing an object of this type in a form. The template is rendered with context from get_form_context_data()

get_context_data(obj, options)

The context (a dict) to be used when rendering template_name to render objects of this type in html. The function can return None to indicate that the object should not be shown at all. The following things are in the context by default:

  • value (string representation of th object)

  • options

  • obj

Parameters:
  • obj – the object to be rendered as html

  • options – other kwargs when instantiating a BaseAttribute

get_form_context_data(key, obj, options)

The context (a dict) to be used when rendering form_template_name to render objects of this type as an html form input. The following things are in the context by default:

  • value (string representation of th object) if available

  • key

  • options

Parameters:
  • key – the name under which the input should be posted when submitting the form

  • obj – the object to be shown as an input

  • options – other kwargs when instantiating a BaseAttribute

abstract rdf_triples(sub, pred, the_object, options) Iterator[TripleDescription]

Generator of heliport.vocabulary_descriptor.TripleDescription s describing objects of this type in rdf. It is necessary to use TripleDescriptions instead of returning an rdflib.Graph directly because TripleDescription s allow recursive encoding, of the objects used in returned triples, later.

render_empty_input(key, options)

Represent an empty object of this type as HTML form input. This is similar to to_input() but for when the object is not created yet. By default, the template specified with form_template_name is rendered using result form get_form_context_data().

Parameters:
  • key – the name under which the input should be posted when submitting the form

  • options – other kwargs when instantiating a BaseAttribute

template_name = 'core/types/string.html'

Path to a django template for showing an object of this type. The template is rendered with context from get_context_data().

test_exists(obj, options)

Test if obj is considered existent. In some cases only existent objects might be shown. By default, an obj is considered existent if it is not None.

to_html(obj, options)

Represent an object of this type in HTML. Returning None signals to not show the object at all. By default, the template specified with template_name is rendered using result form get_context_data().

Parameters:
  • obj – the object to be shown as an input

  • options – other kwargs when instantiating a BaseAttribute

to_id(obj, options)

Generate an id for the obj. This is used in BaseAttribute.get_id() to generate an id for an attribute-value pair.

to_inputs(key, obj, options)

Represent an object of this type as HTML form input. By default, the template specified with form_template_name is rendered using result form get_form_context_data().

Parameters:
  • key – the name under which the input should be posted when submitting the form

  • obj – the object to be shown as an input or None if not object exists yet

  • options – other kwargs when instantiating a BaseAttribute

to_json(obj, options)

Represent an obj of this type in json.

to_string(obj, options) str | None

Represent an object of this type as a human-readable string. Return value of None signals to not show the object at all.

Parameters:
  • obj – the object to be shown as an input

  • options – other kwargs when instantiating a BaseAttribute

class heliport.core.attribute_description.BaseAttribute(attribute_digital_object, attribute_type, **kwargs)

Bases: object

Base class for all attribute descriptions.

As an example the description of distance_from_sun:

class Planet:
    distance_from_sun: str

@static_attributes.register(Planet)
def planet_attributes() -> typing.List[BaseAttribute]:
    return [
        Attribute(
            AttrObj("Distance from the sun", "https://example.org/distance_from_sun"), StringT, "distance_from_sun"
        )
    ]

Note

The DecoratorDict heliport.serializers.static_attributes can be imported and used to register the metadata attribute description in heliport. If Planet were a DigitalObject the decorator heliport.serializers.register_digital_object_attributes() should be used.

Attribute descriptions contain:

Description of the metadata property

In the example this is detailed information what the “distance from the sun” is. This can include

  • information like persistent identifier of the property in some metadata standard

  • human-readable description

  • detailed description using key value pairs. (Example: Distance from earth)

This information is specified via the first argument attribute_digital_object of the constructor and available via the attribute property.

In the most basic case, like just a persistent identifier and a human-readable label, an AttrObj can be used. For more complex descriptions a heliport.models.DigitalObject can be used. To reference DigitalObjects in code you can create a class similar to heliport.models.Vocabulary. To describe DigitalObjects in code (needed before they can be referenced) you can write a function similar to heliport.vocabulary_core.insert_core_vocabulary() and call it in your apps post_migrate hook (see heliport.apps.HeliportConfig for an example).

How to get the value given an object

In the example this is the information that the value for the distance from the sun can be gotten from the "distance_from_sun" parameter of a Planet object.

This information is determined by the subclass of BaseAttribute that is used. For example the subclass Attribute uses Attribute.object_field (the attribute name) to get the value. Feel free to write additional subclasses in your app to be able to access complex attributes.

How to work with the value (type specific information)

In the example this is how distance should be displayed and serialized. A generic type or a more useful, but with more effort to implement, specific type for distances could be used. Feel free to implement subclasses of AttributeType in your app to control how your objects are displayed and serialized.

The type is available via attribute_type and specified via the second argument attribute_type of the constructor. when specifying attribute_type an instance of AttributeType or a callable that returns an instance of AttributeType (like a subclass of AttributeType itself) can be used:

attr1 = Attribute(..., StringT(), ...)
attr2 = Attribute(..., StringT, ...)
Additional parameters

Other kwargs are stored and available to AttributeType and in subclasses of BaseAttribute. Both can define what additional parameters they understand. Some parameters are defined in BaseAttribute. You can look through the attributes and methods to find them. They can be identified by the following style: “ADDITIONAL PARAMETER "<parameter name>"”.

Helper functions

A lot of functions are implemented in this base class. These functions call corresponding functions in the subcomponents of the description in the appropriate way.

attribute_type: AttributeType

the type all values of the described attribute have

bind_to(obj)

An attribute description does not contain information about a concrete object that might have the attribute. This enables the construction of queries based on attribute descriptions. However, this means that many methods require an obj parameter. BoundAttribute stores a BaseAttribute together with an obj to address this.

Parameters:

obj – The attribute description may describe attributes of obj.

Returns:

A BoundAttribute where obj is used and not needed any more as parameter.

property description: str

A longer human-readable description of the metadata attribute.

deserialize(data)

Deserialize data to an instance of the type described by attribute_type. See AttributeType.deserialize() for more information.

exists_on(obj)

Determine if the attributes exists on obj.

See AttributeType.test_exists() for more details.

get_id(obj)

ID of a property value pair to identify it e.g. in html forms. The ID is generated based on persistent_id, label, property_category, overwrite_property_id and AttributeType.to_id().

get_is_public(obj) bool

By default, is_always_public and is_public_name are considered. Subclasses may implement additional behaviour. See also set_is_public() and public_settable().

Parameters:

obj – The object of which the decision if the described attribute is public should be made.

Returns:

Decision if the described attribute is public on obj.

abstract getattr(obj)

Don’t use this function but instead used value_from(). Overwrite this function in subclasses to implement how the described attribute is accessed on some object.

Parameters:

obj – The object where the attribute value should be gotten from

Returns:

The value of the attribute on obj or None if obj does not have a value for this attribute

property handles_list: bool

Determines if the value of the described attribute is a list.

property is_always_public

Some information, like a globally unique id, is always publicly known about any object. is_always_public contains if the described property is such an always publicly known property. This is specified via the ADDITIONAL PARAMETER "is_public".

property is_public_name: str

Attributes can be specified to be publicly visible. This information could be stored as a separate property on some object:

class A:
    b: int
    b_is_public: bool

The name of that attribute (“b_is_public” in the example) is this property. The value is taken from the ADDITIONAL PARAMETER "is_public_name". Note that subclasses of Attribute generate this parameter by default as “<attribute_name>_is_public”.

property label: str

Short human-readable text to describe the metadata attribute.

property omit_from_external_objects: bool

Is True if attribute is omitted from metadata of external objects.

An object is external if it represents an external identifier. (:prop:`heliport.core.models.DigitalObject.represents_external_identifier`)

This is needed for example to exclude the heliport creation date for external objects from the metadata export since the object already existed before it was “created” in HELIPORT.

The value is taken from the ADDITIONAL PARAMETER "omit_from_external".

property overwrite_property_id: str

Property value pairs can be identified via an id returned from get_id(). This id is normally generated automatically but can be specified explicitly via the ADDITIONAL PARAMETER "property_id". overwrite_property_id contains the explicitly specified id or None if it does not exist.

property persistent_id: str

The persistent identifier of the metadata attribute.

property property_category: str

Properties can be grouped into categories to split a long list of properties into smaller ones for ease of viewing. This attribute takes its value from ADDITIONAL PARAMETER "property_category".

public_settable(obj)

Determine if set_is_public() is going to succeed on obj.

See also get_is_public().

rdf_triples(obj)

Serialize obj into RDF triples. For more details see AttributeType.rdf_triples().

property read_only: bool

Specified if the attribute is read only.

The value is taken from the ADDITIONAL PARAMETER "read_only".

render_empty_input(key)

Similar to to_inputs() without obj parameter but behaviour could be customized independently in some AttributeType. See AttributeType.render_empty_input() for more information.

set_is_public(obj, value: bool)

By default, is_public_name is used to set the public status of the described attribute. If obj has an attribute save, it is called after attribute specified by is_public_name is set to value. Subclasses may implement additional behaviour. See also get_is_public().

Parameters:
  • obj – The object for which the public status of the described attribute should be changed.

  • value – The new public status. (True means the attribute should be public)

Raises:
setattr(obj, value)

Don’t use this function but instead use value_to(). Overwrite this function in subclasses to implement the way the described attribute sets the value on some object.

Parameters:
  • obj – The object where the attribute value should be set to value

  • value – The value that the described attribute should be set to

to_html(obj)

Serialize obj as html. For more details see AttributeType.to_html().

to_inputs(key, obj=None)

Serialize obj as list of html inputs. For more details see AttributeType.to_inputs().

Parameters:
  • key – The key that should be used for this attribute in POST data.

  • obj – The object for which the inputs should be generated. If obj is not provided empty form inputs are generated.

Returns:

List of rendered html inputs.

to_json(obj)

Serialize obj to json. See AttributeType.to_json() for more details.

to_string(obj) str | None

Serialize obj as human-readable string. For more details see AttributeType.to_string().

value_from(obj)

Get the value of this attribute from the obj.

Implements the “How to get the value given an object” part of the attribute description. value_from uses getattr() internally to get the value. value_from should always be used when a value needs to be gotten while getattr() should always be overwritten in subclasses to implement the actual getting functionality. The corresponding method for setting attribute values is value_to().

Parameters:

obj – The object of which the attribute value should be determined.

Returns:

The value of the described attribute on obj

value_to(obj, value)

Implements the “How to set the value given an object” part of the attribute description. value_to uses setattr() internally to set the value. value_to should always be used when a value needs to be set while setattr() should always be overwritten in subclasses to implement the actual setting functionality. The corresponding method for getting attribute values is value_from().

Parameters:
  • obj – The object of which the attribute value should be set.

  • value – The new value that should be used for the attribute on obj.

class heliport.core.attribute_description.BasicLiteralType

Bases: AttributeType

Something that can be passed directly to rdflib.Literal in order to represent it in an rdflib.Graph.

rdf_triples(sub, pred, the_object, options)
class heliport.core.attribute_description.BasicObjType

Bases: AttributeType

Represent objects like AttrObj or heliport.models.DigitalObject that might have the following Attributes:

  • persistent_id

  • digital_object_id

  • identifier_link

  • label

  • description

Don’t use this AttributeType directly. Use a specific subclass like DigitalObjectT or AttrObjT.

rdf_triples(sub, pred, the_object, options)
to_id(obj, options)
to_json(obj, options)
class heliport.core.attribute_description.BoundAttribute(attribute, bound_to)

Bases: object

Contains information about a subclass of BaseAttribute (attribute) and a specific object (bound_to). This allows it to offer properties in many places where BaseAttribute has methods that have an obj parameter. In django templates this is more than a way to simplify code, because only functions without arguments can be called there. One way to create a BoundAttribute is using BaseAttribute.bind_to().

property as_html

See BaseAttribute.to_html().

property as_json

See BaseAttribute.to_json().

property as_string

See BaseAttribute.to_string().

property exists

See BaseAttribute.exists_on().

property is_public

See BaseAttribute.get_is_public().

property label

See BaseAttribute.label().

property property_category

See BaseAttribute.property_category.

property property_id

See BaseAttribute.get_id().

property public_settable

See BaseAttribute.public_settable().

property rdf_triples

See BaseAttribute.rdf_triples().

property value

See BaseAttribute.value_from().

class heliport.core.attribute_description.ConstantAttribute(attribute, value, attribute_type=None, **kwargs)

Bases: BaseAttribute

Get always the same constant value without looking at the object that has this attribute.

getattr(obj)
Parameters:

obj – The object that has this constant attribute (ignored)

Returns:

Always value specified by value

value: Any

The constant value always used for this attribute

class heliport.core.attribute_description.ContributionT

Bases: BasicObjType

Represent a value that is a heliport.models.Contribution.

class ContributionDescription(contribution_type, contributing_heliport_user)

Bases: InternalValueDescription

Description of a heliport.models.Contribution. This is the type returned by deserialization. Deserialization can not return a Contribution directly, because the heliport.models.DigitalObject, where a contribution is for, is sometimes unknown during deserialization but is always required when storing a heliport.models.Contribution in the database. Additionally, it is bad to create persistent objects during deserialization because deserialization is also used as validation in Django Rest framework.

get_value(parent)

Generate a real heliport.models.Contribution from this description.

Parameters:

parent – The object where the attribute of type ContributionT is set. This is the object where the contribution is for.

deserialize(obj, options)
form_template_name = 'core/form_field/contribution.html'

Path to a django template for editing an object of this type in a form. The template is rendered with context from get_form_context_data()

get_form_context_data(key, obj, options)

In addition to the base implementation this includes the contribution "type" and all potentially possible "contribution_types".

to_id(obj, options)
to_json(obj, options)

Represent the contribution obj as json. This uses PersonT to represent the contributor as json.

to_string(obj, options)
class heliport.core.attribute_description.DateT

Bases: BasicLiteralType

Represent a value that is a python datetime object.

deserialize(obj, options)

Uses utils.string_tools.parse_date_time() to generate a datetime from obj.

Raises:

DeserializationError – if no valid format could be found.

get_form_context_data(key, obj, options)

Includes additionally to the base implementation type of date in context to set it on html input.

to_string(obj, options)

Use strftime to format obj that is a datetime as string. The time is included only if "include_time" is set to True in options.

exception heliport.core.attribute_description.DeserializationError(detail=None, code=None)

Bases: ValidationError

Indicates that the data provided to an implementation of AttributeType.deserialize() is invalid. DeserializationError being a subclass of ValidationError leads to special handling in Django Rest Framework, where ValidationError s are used to generate an error response for the user.

class heliport.core.attribute_description.DigitalObjectT

Bases: BasicObjType

Represent a value that is a heliport.models.DigitalObject.

deserialize(obj, options)
form_template_name = 'core/form_field/digital_object.html'

Path to a django template for editing an object of this type in a form. The template is rendered with context from get_form_context_data()

get_form_context_data(key, obj, options)

In addition to base implementation include "label" and "value" in context.

  • label - Human readable representation of the DigitalObject

  • value - digital_object_id to be used as value in an html input

template_name = 'core/types/digital_object.html'

Path to a django template for showing a DigitalObject. The template is rendered with context from AttributeType.get_context_data(). # noqa: E501

to_string(obj, options)
class heliport.core.attribute_description.DynamicAttribute(attribute_model, attribute_type=None, **kwargs)

Bases: BaseAttribute

Get value for a heliport.models.DigitalObject via its heliport.models.DigitalObjectRelation s or heliport.models.DigitalObjectAttributes.

attribute_model is an instance of heliport.models.DigitalObjectRelation or heliport.models.DigitalObjectAttributes. Specifying attribute_type is optional. The following rules are used to generate the default:

  • heliport.models.DigitalObjectRelationDigitalObjectT

  • heliport.models.DigitalObjectAttributesStringT

  • is DigitalObjectAttribute + predicate or value indicate url → UrlT

Warning

The object needs to be known (it is the subject of attribute_model) when instantiating a DynamicAttribute class, whereas other BaseAttribute subclasses are general. So by the nature of dynamic attributes DynamicAttribute can only be used when generating attributes dynamically at runtime for a given object.

Note

Why is this class called “DynamicAttribute”?

HELIPORT distinguishes between dynamic attributes that are attributes editable by users at runtime without conforming to any schema and static attributes that are defined in a schema and stored in specialized tables.

attribute_model: DigitalObjectAttributes | DigitalObjectRelation

The django model where this attribute gets its value from.

get_id(obj) str

Generate string to identify this attribute in html forms. See BaseAttribute.get_id() for more information.

get_is_public(obj)

Get public availability from attribute_model.

Raises:

AssertionError – if obj does not match subject of attribute_model

getattr(obj)

Get value from attribute_model.

public_settable(obj)

Because it is known how to set heliport.models.DigitalObjectAttributes.is_public and heliport.models.DigitalObjectRelation.is_public this always returns True.

Raises:

AssertionError – if obj does not match subject of attribute_model

set_is_public(obj, value: bool)

Set public availability of attribute_model to value.

Raises:

AssertionError – if obj does not match subject of attribute_model

setattr(obj, value)

Set value on attribute_model.

If value for heliport.models.DigitalObjectAttributes is "" or value is None attribute_model is deleted. If attribute_model is None a new instance of heliport.models.DigitalObjectRelation or heliport.models.DigitalObjectAttributes is created in the database based on if value is a heliport.models.DigitalObject or not.

Raises:

AssertionError – if obj does not match subject of attribute_model

class heliport.core.attribute_description.EnumAttribute(attribute_digital_object, attribute_type, object_field, **kwargs)

Bases: Attribute

Get value as a tuple of actual value and human-readable string for attributes that are Django enumeration types. Should be used with an AttributeType, like EnumStringT, that supports this format of value.

getattr(obj)

Use get_[object_field]_display() to get the human-readable component of the tuple. Get the first component like the base class Attribute.

class heliport.core.attribute_description.EnumStringT(value_dict=None)

Bases: AttributeType

Type that represents values that are tuples of the actual value and a string representation of the value. EnumStringT is used in conjunction with EnumAttribute to describe attributes that are Django enumeration types.

deserialize(obj, options)
rdf_triples(sub, pred, value_tuple, options)
to_id(value_tuple, options)
to_json(value_tuple, options)

Objects of EnumStringT are represented like {"value": ..., "description": ...} in json.

to_string(value_tuple, options)
value_dict: dict

Maps actual values to their string representations, allowing to replace some default string representations. # noqa: E501 When deserializing, it is allowed to supply string representations that are converted to values via this dict. # noqa: E501

class heliport.core.attribute_description.FunctionResultAttribute(attribute_digital_object, attribute_type, object_field, **kwargs)

Bases: Attribute

Get the value for this attribute by calling a method of an object specified by object_field. This is very similar to the base class but Attribute would return a function whereas this class returns the result when calling this function. FunctionResultAttribute is a read only attribute.

getattr(obj)

Get value by calling the method, specified by object_field, on obj with no arguments.

class heliport.core.attribute_description.InternalValueDescription

Bases: object

Contains the information to get or create some object. This is used for implementations of AttributeType.deserialize(). There are two reasons to return an InternalValueDescription instead of the value itself:

  • The value does not exist yet (no persistent object should be created during validation)

  • The value depends on things unknown during validation (the parent where this value becomes an attribute)

For an example see ContributionT.ContributionDescription.

describes_list = False

Specifies if get_value() returns a list or a single object It might not be possible to deduce this simply from the result of get_value() because # noqa: E501 get_value() might make persistent changes and therefore should be called only once. # noqa: E501

abstract get_value(parent)

A function that is called when actually needing the value this object is describing.

Parameters:

parent – The object where the returned object is assigned to an attribute.

class heliport.core.attribute_description.ListT(item_type: AttributeType | Type[AttributeType])

Bases: AttributeType

Represent a value that is a list where all elements have the type item_type. Similar to when instantiating a BaseAttribute specifying item_type as an instance of AttributeType or as a callable that returns an instance of AttributeType (like a subclass of AttributeType itself) is possible:

string_list1 = ListT(StringT())
string_list2 = ListT(StringT)
class ListDescription(values)

Bases: InternalValueDescription

ListT.deserialize() returns an instance of this class. This is needed because items might return an instance of InternalValueDescription when deserialized so ListT.ListDescription is used to evaluate InternalValueDescription s recursively.

describes_list = True

Specifies if get_value() returns a list or a single object It might not be possible to deduce this simply from the result of get_value() because # noqa: E501 get_value() might make persistent changes and therefore should be called only once. # noqa: E501

get_value(parent)

Return a list where all InternalValueDescription s are evaluated.

deserialize(obj, options)
get_context_data(obj, options)

Ignores base implementation and returns instead:

  • values - A list of html representations of all items in the list

  • options - like in the base implementation, other kwargs when instantiating a BaseAttribute

rdf_triples(sub, pred, the_objects, options)
render_empty_input(key, options)
template_name = 'core/types/list.html'

Path to a django template for showing an object of this type. The template is rendered with context from get_context_data().

test_exists(obj, options)
to_inputs(key, obj, options)

Return a list of rendered html inputs. See also AttributeType.to_inputs().

to_json(obj, options)
to_string(object_list, options)

Items of the list are separated by newline characters.

class heliport.core.attribute_description.ManyAttribute(attribute_digital_object, attribute_type, object_field, **kwargs)

Bases: Attribute

Get the value for this attribute from a Django many-to-many relationship.

attribute_type is always a ListT. If the passed attribute_type is not a kind of ListT, the attribute_type is assumed to be a ListT of the specified attribute_type.

An example usage of ManyAttribute:

class Planet(models.Model):
    orbits = models.ManyToManyField(Star)

@static_attributes.register(Planet)
def planet_attributes() -> typing.List[BaseAttribute]:
    return [
        ManyAttribute(
            AttrObj("orbits", "https://example.org/orbits"), StarT, "orbits"
        )
    ]

See BaseAttribute for details where things like static_attributes come from in the example.

getattr(obj)

Get value from many attribute.

If the ADDITIONAL PARAMETER "casted" is set to True, the casted_or_self() method is called on all resulting values. heliport.models.DigitalObject implements such a heliport.models.DigitalObject.casted_or_self() method. This is necessary because django returns objects that are not casted to their most specific type but instead to a base class.

setattr(obj, value)

Set value via many attribute.

class heliport.core.attribute_description.PersonT

Bases: BasicObjType

Represent a value that is a heliport.models.HeliportUser.

deserialize(obj, options)
to_id(heliport_user, options)
to_json(heliport_user, options)
class heliport.core.attribute_description.ProjectT

Bases: DigitalObjectT

Represent a value that is a heliport.models.Project.

deserialize(obj, options)
get_form_context_data(key, obj, options)

In addition to the base implementation include "type_constraint" to digital_object_id of the project type. This is used when autocompleting in an html form input.

template_name = 'core/types/digital_object.html'

Path to a django template for showing a DigitalObject. The template is rendered with context from AttributeType.get_context_data(). # noqa: E501

to_string(obj, options)
class heliport.core.attribute_description.StringT

Bases: BasicLiteralType

Represent an object that is a python string.

deserialize(obj, options)

Deserialize like the base implementation but return "" instead of None if not "allow_null" is set to True in options.

class heliport.core.attribute_description.TypeAttribute(the_type, attribute_type=None, **kwargs)

Bases: ConstantAttribute

An attribute that specifies the type of the object.

Normally subclasses of BaseAttribute have a description of the property as first parameter of the constructor. TypeAttribute fills this information automatically to describe the property is of type. the_type can be anything (but is a heliport.models.DigitalObject in most cases; see documentation for description of metadata property in BaseAttribute for information how to access DigitalObject s in code). If the subclass of AttributeType can not be deduced for the_type, the type of the_type can be specified by the attribute_type argument.

class heliport.core.attribute_description.UriRefT

Bases: AttributeType

Represent values that are rdflib.URIRef s.

rdf_triples(sub, pred, the_object, options)
template_name = 'core/types/url.html'

Path to a django template for showing an object of this type. The template is rendered with context from get_context_data().

class heliport.core.attribute_description.UrlT

Bases: AttributeType

A string that encodes a URL.

rdf_triples(sub, pred, the_url, options)
template_name = 'core/types/url.html'

Path to a django template for showing an object of this type. The template is rendered with context from get_context_data().

test_exists(obj, options)

A URL is considered existed if it is not None and not "".

heliport.core.attribute_description.get_attribute_type(obj: Any) Type[AttributeType]

This function is used for example to allow the attribute_type to be optional for ConstantAttribute, where the AttributeType can be deduced from the value using get_attribute_type().

Parameters:

obj – The instance for which an AttributeType should be found.

Returns:

Appropriate subclass of AttributeType to be used with the obj instance.

Raises:

AttributeError – if no matching AttributeType was found.

heliport.core.conf module

Additional settings for this app.

See also django appconf

class heliport.core.conf.HeliportAppConf(**kwargs)

Bases: AppConf

General settings of the heliport.core app.

All settings in this class can be overwritten in settings.py

ABOUT_URL = 'https://heliport.hzdr.de'

URL pointing to an external about page

AUTOCOMPLETE_COUNT = 10

The number of entries returned from autocomplete views

CRYPTO_KEY = 'wRgR7w12NiYl0GmI1KeBKodRdeB97XzS7RJME_XG_D8='

The key used for encryption of credentials in the database. (The key shown in the docs is just the dummy value from the CI.)

DOCS_URL = 'https://heliport.hzdr.de/documentation/'

URL pointing to an external documentation page

GROUP_NAME_PREFIX = 'heliportprojectgroup'

The name prefix for heliport groups

HOST = 'http://127.0.0.1:8000'

Despite the name HOST, this setting contains the protocol, host, and port of the HELIPORT instance. A HELIPORT instance at https://heliport.example.com/app/ has the HOST value https://heliport.example.com.

HZDR_ID_PREFIX = 'HZDR'

Prefix used for generation of project identifiers

IMPRINT_URL = 'https://www.hzdr.de/impressum'

URL pointing to an external imprint page

MAINTENANCE_MESSAGE = 'No maintenance today'
MAINTENANCE_MESSAGE_LEVEL = 0
class Meta

Bases: object

prefix = 'HELIPORT_CORE'
PRIVACY_URL = 'https://heliport.hzdr.de/privacy/index.html'

URL pointing to an external privacy policy page

TOS_URL = 'https://heliport.hzdr.de/terms/index.html'

URL pointing to an external terms of service page

class heliport.core.conf.HeliportHandlesAppConf(**kwargs)

Bases: AppConf

Handle-related settings of the heliport.core app.

All settings in this class can be overwritten in settings.py

API_URL = 'https://handle.hzdr.de/api/handles'
CERTIFICATE_PATH = '/etc/ssl/certs/heliport_handle_admin.crt'
DESCRIPTION = 'This handle is generated by HELIPORT at Helmholtz-Zentrum Dresden-Rossendorf. HELIPORT is a system in its early prototyping phase and not yet available to the public. If you are at HZDR and you have access rights, you can follow the URL below. '
class Meta

Bases: object

prefix = 'HELIPORT_HANDLE'
PREFIX = '20.500.12865'
PRIVATE_KEY_PATH = '/etc/ssl/private/heliport_handle_admin.key'
REGISTER_HANDLES = False
SERVER_URL = 'https://handle.hzdr.de'
USE_DUMMY_STRING_FOR_UNREGISTERED_HANDLES = True

heliport.core.context_processors module

Additional context processors for HELIPORT.

heliport.core.context_processors.auth_settings(request)

Add auth-related settings into context.

This is required in order to access these settings from templates without adapting allauth views.

heliport.core.digital_object_actions module

Register your actions in apps.py like this:

from django.apps import AppConfig
from heliport.core.digital_object_actions import actions

class MyConfig(AppConfig):
    name = "my_app_name"

    def ready(self):
        from .views import MyAction, my_action_generation_func
        actions.register(MyAction)
        actions.register(my_action_generation_func)

where my_cation_generation_func is a function returning a list of actions, given optionally a heliport.core.digital_object_interface.GeneralDigitalObject, a heliport.core.models.Project and/or a heliport.core.models.HeliportUser, and MyAction is a subclass of Action.

class heliport.core.digital_object_actions.Action(obj: ObjType = None, project: Project = None, user: HeliportUser = None)

Bases: ABC

Represent an action that can be executed on some digital objects.

abstract property applicable: bool

Determine if the action is executable for the given obj, project and user.

abstract property icon: str

Name of a fontawesome icon.

Link to where the action can be executed.

abstract property name: str

Display name of this action.

heliport.core.digital_object_actions.get_actions(obj: ObjType = None, project: Project = None, user: HeliportUser = None) List[Action]

Get all registered actions that are applicable for the given parameters.

heliport.core.digital_object_aspects module

class heliport.core.digital_object_aspects.Directory

Bases: FileOrDirectory

base class for actual directories.

abstract get_parts() Iterable[FileObj | DirectoryObj]

Get the parts of the digital object.

is_directory = True
class heliport.core.digital_object_aspects.DirectoryObj

Bases: GeneralDigitalObject

A GeneralDigitalObject that represents a Directory.

abstract as_directory(context: Context) Directory

Return the Directory that this object represents.

is_directory = True
is_file = False
class heliport.core.digital_object_aspects.File

Bases: FileOrDirectory

base class for actual files.

abstract close()

Free allocated resources. Call open() in between close and use.

is_file = True
abstract mimetype() str

Mimetype of file content. Note that the file may need to be opened before the mimetype is available.

abstract open()

Bring the file into a state that read() starts from the beginning of the file. This may allocate resources that need to be freed using close(). It is allowed to reopen a closed file or an already opened file to start from the beginning.

abstract read(number_of_bytes=None) bytes

Get next number_of_bytes from the file or the entire file. Note that the actual number of bytes returned may be different from the number of bytes requested.

abstract size() int | None

The exact size of this file in bytes. None if no exact size is known.

class heliport.core.digital_object_aspects.FileObj

Bases: GeneralDigitalObject

A GeneralDigitalObject that represents a File.

abstract as_file(context: Context) File

Return the File that this object represents.

is_directory = False
is_file = True
class heliport.core.digital_object_aspects.FileOrDirectory

Bases: object

Baseclass for actual files or directories.

abstract get_file_info() Dict[str, str]

Get key value pairs as string for information like file size or last modified date.

is_directory = False
is_file = False

heliport.core.digital_object_class module

Functions to use if importing heliport.core.models.DigitalObject would result in errors because of cyclical imports.

heliport.core.digital_object_class.digital_object_class() Type[DigitalObject]

Returns the heliport.core.models.DigitalObject class.

heliport.core.digital_object_class.digital_objects()

Use this if you would write DigitalObject.objects normally.

heliport.core.digital_object_interface module

This module contains the base that define an interface between heliport apps via digital objects.

The interface is centered around the GeneralDigitalObject. Digital object implementations may inherit from one or multiple digital object aspects like heliport.core.digital_object_aspects.FileObj. Note that these aspect classes do not share any method names (even including __init__) which allows multiple inheritance without special care.

HELIPORT apps can register their digital object types, in apps.py like so:

from django.apps import AppConfig
from heliport.core.digital_object_resolution import object_types

class MyConfig(AppConfig):
    name = "my_app_name"

    def ready(self):
        from .models import MyGeneralDigitalObject
        object_types.register(MyGeneralDigitalObject)

where MyGeneralDigitalObject is a heliport.core.digital_object_interface.GeneralDigitalObject.

class heliport.core.digital_object_interface.GeneralDigitalObject

Bases: GeneralValue, Resolvable

Represent an object. Check also the baseclasses for methods to implement. This is an abstract class but doesn’t inherit form ABC because metaclass conflict when inheriting from it in Django models.

access(context: Context)

Access control. Always no access by default. Subclass to change this.

actions(user: HeliportUser = None, project: Project = None)

Actions available for this object given the parameters.

abstract as_digital_object(context: Context) DigitalObject

Import and save the object as heliport.core.models.DigitalObject.

heliport.core.digital_object_resolution module

Functionality to allow resolving objects from url parameters.

Register your objects in apps.py like this:

from django.apps import AppConfig
from heliport.core.digital_object_resolution import object_types

class MyConfig(AppConfig):
    name = "my_app_name"

    def ready(self):
        from .models import MyObject
        object_types.register(MyObject)

where MyObject is a Resolvable but more specifically a heliport.core.digital_object_interface.GeneralDigitalObject in most cases.

class heliport.core.digital_object_resolution.Resolvable

Bases: object

This class does not inherit form ABC in order to avoid metaclass conflicts.

as_digital_object_if_exists(context: Context)

Get digital object from this resolvable.

Uses the fact that resolve() returns existing digital objects, to return it if a heliport.core.models.DigitalObject instance exists for this resolvable.

abstract get_identifying_params() Dict[str, str]

The params that can be passed to resolve() to recreate this object.

abstract static resolve(params: Dict[str, str], context: Context) GeneralDigitalObject | None

Given some parameters, construct or find a matching object and return it.

abstract static type_id() str

The name used to reference this type in URLs and elsewhere.

heliport.core.digital_object_resolution.params_for(resolvable: Resolvable)

Get a dict of params for some resolvable. This uses Resolvable.get_identifying_params() but has special handling for heliport.core.models.DigitalObject instances. Because they can just be resolved by digital_object_id.

heliport.core.digital_object_resolution.resolve(params: Dict[str, str], context: Context) GeneralDigitalObject | DigitalObject | None

Resolve an object based on some params.

If “digital_object_id” in params a heliport.core.models.DigitalObject instance with that id is returned, casted as the proper subclass. If “type” in params, the registered Resolvable instance for that type is used to Resolvable.resolve() the params.

Parameters:
  • params – Parameters to construct the object from

  • context – You must make sure to close the context yourself.

Returns:

The resolved GeneralDigitalObject or None if nothing was found.

heliport.core.digital_object_resolution.url_for(url_str: str, resolvable: Resolvable, **kwargs)

Generates a URL for a view that takes a Resolvable as input via get params.

Parameters:
  • url_str – The name of the url. This is normally a combination of app name and url name separated by “:”. An example would be: "core:as_digital_object"

  • resolvable – The object that should be provided as parameter to the view.

  • kwargs – kwargs that are needed for generating the url from the url name. E.g. if you have ".../<int:project>/..." as url config you need to provide project as key word argument.

Returns:

URL as string

heliport.core.forms module

Forms for usage in core HELIPORT views.

class heliport.core.forms.ChangePasswordForm(*args, **kwargs)

Bases: HeliportAllauthPasswordChangeFormMixin, ChangePasswordForm

Allauth’s ChangePasswordForm, adapted for HELIPORT.

base_fields = {'oldpassword': <allauth.account.forms.PasswordField object>, 'password1': <allauth.account.forms.SetPasswordField object>, 'password2': <allauth.account.forms.PasswordField object>}
declared_fields = {'oldpassword': <allauth.account.forms.PasswordField object>, 'password1': <allauth.account.forms.SetPasswordField object>, 'password2': <allauth.account.forms.PasswordField object>}
property media
class heliport.core.forms.HeliportAllauthFormMixin(*args, **kwargs)

Bases: object

Cosmetic changes for allauth forms used in HELIPORT.

field_order = ['email', 'username', 'oldpassword', 'password1', 'password2', 'first_name', 'last_name', 'email2', 'orcid']

Order of the form fields. Fields not present are ignored.

class heliport.core.forms.HeliportAllauthPasswordChangeFormMixin(*args, **kwargs)

Bases: HeliportAllauthFormMixin

Cosmetic changes for allauth password change forms used in HELIPORT.

class heliport.core.forms.HelmholtzIDSignupForm(*args, **kwargs)

Bases: HeliportAllauthFormMixin, SignupForm

Form for account setup after Helmholtz ID login.

base_fields = {'email': <django.forms.fields.EmailField object>, 'orcid': <heliport.core.forms.OrcidField object>, 'username': <django.forms.fields.CharField object>}
declared_fields = {'email': <django.forms.fields.EmailField object>, 'orcid': <heliport.core.forms.OrcidField object>, 'username': <django.forms.fields.CharField object>}
property media
class heliport.core.forms.OrcidField(*args, **kwargs)

Bases: URLField

URL field specialized for ORCIDs.

class heliport.core.forms.OrcidInput(attrs=None)

Bases: URLInput

URL input specialized for entry of ORCIDs.

property media
class heliport.core.forms.ResetPasswordKeyForm(*args, **kwargs)

Bases: HeliportAllauthPasswordChangeFormMixin, ResetPasswordKeyForm

Allauth’s ResetPasswordKeyForm, adapted for HELIPORT.

base_fields = {'password1': <allauth.account.forms.SetPasswordField object>, 'password2': <allauth.account.forms.PasswordField object>}
declared_fields = {'password1': <allauth.account.forms.SetPasswordField object>, 'password2': <allauth.account.forms.PasswordField object>}
property media
class heliport.core.forms.SetPasswordForm(*args, **kwargs)

Bases: HeliportAllauthFormMixin, SetPasswordForm

Allauth’s SetPasswordForm, adapted for HELIPORT.

base_fields = {'password1': <allauth.account.forms.SetPasswordField object>, 'password2': <allauth.account.forms.PasswordField object>}
declared_fields = {'password1': <allauth.account.forms.SetPasswordField object>, 'password2': <allauth.account.forms.PasswordField object>}
property media
class heliport.core.forms.SignupForm(*args, **kwargs)

Bases: HeliportAllauthFormMixin, SignupForm

Form for user self registration.

base_fields = {'email': <django.forms.fields.EmailField object>, 'first_name': <django.forms.fields.CharField object>, 'last_name': <django.forms.fields.CharField object>, 'orcid': <heliport.core.forms.OrcidField object>, 'username': <django.forms.fields.CharField object>}
declared_fields = {'email': <django.forms.fields.EmailField object>, 'first_name': <django.forms.fields.CharField object>, 'last_name': <django.forms.fields.CharField object>, 'orcid': <heliport.core.forms.OrcidField object>, 'username': <django.forms.fields.CharField object>}
property media
heliport.core.forms.validate_orcid(input: str) None

Validate whether a given input string is an ORCID.

We only ensure the input looks plausible, i.e. it looks like https://orcid.org/0000-0002-1825-0097 and the checksum is correct. More information on the format and th checksum algorithm can be found on the ORCID support page.

heliport.core.interface module

Module with special name “interface” hooks into HELIPORT.

Some functions and heliport.core.app_interaction.Module subclasses are detected by HELIPORT and control how HELIPORT uses this app.

Note that this module must be imported in __init__.py of the django app.

This particular module is the HELIPORT interface of the HELIPORT core app itself.

class heliport.core.interface.Images

Bases: Module

get_url(project)
is_configured(project)
module_id = 'images'
name = 'Images'
class heliport.core.interface.ProjectConfigurationModule

Bases: Module

get_url(project)
icon = 'fa-solid fa-gear'
is_configured(project)
module_id = 'project_configuration'
name = 'Project Configuration'
class heliport.core.interface.SubProjects

Bases: Module

get_url(project)
icon = 'fa-solid fa-table-cells-large'
is_configured(project)
module_id = 'subprojects'
name = 'Subprojects'
class heliport.core.interface.Tags

Bases: Module

get_url(project)
icon = 'fa-solid fa-tags'
is_configured(project)
module_id = 'tags'
name = 'Tags'
class heliport.core.interface.Timeline

Bases: Module

get_url(project)
icon = 'fa-solid fa-clock'
is_configured(project)
module_id = 'timeline'
name = 'Project Timeline'
heliport.core.interface.get_search_url()
heliport.core.interface.serialize_project(project)

heliport.core.mixins module

class heliport.core.mixins.HeliportBreadcrumbsMixin

Bases: object

static get_app_label(app_name, path, project)
get_context_data(**kwargs)
class heliport.core.mixins.HeliportLoginRequiredMixin

Bases: LoginRequiredMixin

login_url = '/login'
permission_denied_message = 'Please log in to view this site'
raise_exception = False
class heliport.core.mixins.HeliportObjectMixin

Bases: HeliportLoginRequiredMixin, UserPassesTestMixin, HeliportBreadcrumbsMixin

get_context_data(**kwargs)
test_func()
class heliport.core.mixins.HeliportProjectMixin

Bases: HeliportLoginRequiredMixin, UserPassesTestMixin, HeliportBreadcrumbsMixin

get_context_data(**kwargs)
test_func()

heliport.core.models module

Contains django.db.models.Model classes for Django ORM.

See Quick example from Django documentation.

This module provides classes like DigitalObject, that can be subclassed in HELIPORT apps.

class heliport.core.models.Contribution(*args, **kwargs)

Bases: Model

People who contributed to a DigitalObject in some way.

This is mostly used for contributions to a Project.

class ContributionTypes(value)

Bases: TextChoices

List of contribution types as defined by DataCite.

CONTACT_PERSON = 'ContactPerson'
DATA_COLLECTOR = 'DataCollector'
DATA_CURATOR = 'DataCurator'
DATA_MANAGER = 'DataManager'
DISTRIBUTOR = 'Distributor'
EDITOR = 'Editor'
HOSTING_INSTITUTION = 'HostingInstitution'
OTHER = 'Other'
PRODUCER = 'Producer'
PROJECT_LEADER = 'ProjectLeader'
PROJECT_MANAGER = 'ProjectManager'
PROJECT_MEMBER = 'ProjectMember'
REGISTRATION_AGENCY = 'RegistrationAgency'
REGISTRATION_AUTHORITY = 'RegistrationAuthority'
RELATED_PERSON = 'RelatedPerson'
RESEARCHER = 'Researcher'
RESEARCH_GROUP = 'ResearchGroup'
RIGHTS_HOLDER = 'RightsHolder'
SPONSOR = 'Sponsor'
SUPERVISOR = 'Supervisor'
WORK_PACKAGE_LEADER = 'WorkPackageLeader'
exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

contribution_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

contribution_to

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

contribution_to_id
contributor

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

contributor_id
get_type_display(*, field=<django.db.models.fields.CharField: type>)
objects = <django.db.models.manager.Manager object>
to_rdflib_node()

Represent contribution as RDF.

Contributions are represented as BNodes using the uuid property of contribution.

type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

classmethod type_from_str(the_type)

Get contribution type identifier given human readable label.

uuid

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class heliport.core.models.DigitalObject(*args, **kwargs)

Bases: Model, GeneralDigitalObject

Representing an arbitrary thing that can have metadata.

This is a core model for HELIPORT as basically everything that is added to HELIPORT is a DigitalObject. The main purpose of many apps is to subclass the DigitalObject model and implement respective functionality.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

class ObjectPermissions(value)

Bases: IntegerChoices

Defines levels of permissions.

Note that these are not enforced at the moment.

PRIVATE = 3

only members of this Digital Object can see and edit

PROJECT = 2

Private + Members of a project that this object is in can see and edit

PUBLIC = 1

Everybody can see and edit

access(context: Context)

Get permission checker for this object and context.

For example:

obj.access(context).assert_read_permission()  # raise error otherwise
if obj.access(context).check_permission():
    obj.label = None  # do some update

See also heliport.core.permissions.PermissionChecker.

For serialization as a heliport.core.digital_object_interface.GeneralDigitalObject.

add_tag(tag)

Tag the object with tag. See also Tag.set_on().

archive

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

as_digital_object(context: Context)

Save this object and cast to subclass if necessary.

For serialization as a heliport.core.digital_object_interface.GeneralDigitalObject.

as_digital_object_if_exists(context)

Return self because this is already a digital object that exists.

For serialization as a heliport.core.digital_object_resolution.Resolvable.

as_html() str

Get html representing this object to be rendered into some template.

For serialization as a heliport.core.utils.serialization.GeneralValue.

as_rdf() RootedRDFGraph

Get rdf graph of this object.

This currently returns a blank node if no persistent_id is set.

For serialization as a heliport.core.utils.serialization.GeneralValue.

as_text() str

Get a string representation of this object.

For serialization as a heliport.core.utils.serialization.GeneralValue.

attributes

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

casted_as_subclass()

Cast a generic DigitalObject instance to the subclass it should be.

Returns None if this object really is just a generic digital object.

Note that this works only for direct subclasses. Also note that this is hugely inefficient right now, especially when casting many objects during one request.

This functionality could be much improved by using django-polymorphic.

casted_or_self()

Cast a generic DigitalObject instance to the subclass or return itself.

Same as casted_as_subclass() but doesn’t cast if there is no subclass.

This functionality could be much improved by using django-polymorphic.

category

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property category_in_persistent_id

Determine if the namespace a.k.a. category is part of the PID.

property category_list

Get the category path as list of digital objects.

The category is internally stored as string of ids separated by “/”.

Note that the name “category” is deprecated in favour of “namespace”.

property category_str

The category of the digital object formatted for the user.

Each category is represented by its label. The labels are separated by “/”.

This is deprecated, use :prop:`namespace_str` instead.

co_owners

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

property context: Context | None

Get context previously set using set_context().

If this function does not return None the return value can be used for optimizations where expensive setup and teardown steps can be shared between operations. See heliport.utils.collections.ExitContext for more details.

contribution_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

property contributions

All known Contribution instances to this object.

This is also settable.

create_copy()

Related Django docs: Copying model instances.

created

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

datamanagementplan

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

datasource

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

dbjob

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

dbpathdir

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

dbpathfile

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

dbsmbdirectory

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

dbsmbfile

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

dbsshdirectory

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

dbsshfile

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

deleted

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description_is_public

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

digital_object_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

documentation

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

executable

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

full_url()

Get absolute landing page url as configured in settings.

This url may identify the DigitalObject if no other PID exists. This is also the url a PID may redirect to during PID resolution.

gateproject

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

generated_persistent_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_identifying_params() Dict[str, str]

For resolution.

get_next_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=True, **kwargs)
get_next_by_last_modified(*, field=<django.db.models.fields.DateTimeField: last_modified>, is_next=True, **kwargs)
get_permission_display(*, field=<django.db.models.fields.IntegerField: permission>)
get_previous_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=False, **kwargs)
get_previous_by_last_modified(*, field=<django.db.models.fields.DateTimeField: last_modified>, is_next=False, **kwargs)
get_tags(project=None)

Get all tags of this DigitalObject.

See also add_tag(), remove_tag() and heliport.core.utils.queries.tags_of().

Parameters:

project – if provided the result is limited to tags in this project.

property identifier_display

Shorter version of the PID for nicer display.

It is common to use this when in html link tags where the actual link refers to :prop:`identifier_link`.

property identifier_label

Human-readable label of the identifier scheme of the PID of this object.

The PID of digital object.

It is made sure that this works as URL. Fallback is full_url().

property identifier_scheme

Scheme of the PID of this object.

The scheme has a URL prefix an id for use in datacite and a scheme label. See heliport.core.utils.IDs for more information.

image

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

is_helper

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property is_subclass

Test if this object should be casted to a subclass.

This functionality could be much improved by using django-polymorphic.

job

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

label

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

label_is_public

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property last_category

The last category of the digital object.

The last category itself is also a digital object.

last_modified

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

last_modified_is_public

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

local_url(request)

Get absolute landing page url as the user see it.

For example the user might access HELIPORT through a proxy.

members()

All people where this DigitalObject belongs to.

This information is frequently used for access control.

members_is_public

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property namespace_str

A more appropriately named alias for category_str.

Note that the name “category” is deprecated in favour of “namespace” because the category is part of the PID generation and a namespace conveys that better and a category is basically a type and types can in principle change but the PID not also there can be multiple types. The concept of a type exists separately in HELIPORT as a normal relation.

static not_subclass_query()

Django ORM query parameters to test if an object is not a subclass.

This functionality could be much improved by using django-polymorphic.

objectgraph

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

objects = <django.db.models.manager.Manager object>
owner

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

owner_id
permission

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

persistent_id

URI that identifies this digital object e.g. the Handle

predicate_attributes

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

predicate_relations

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

project

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

projects

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

projects_is_public

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

propertypath_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

publication

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

register_handle(request)

Register a new handle.

If this object already has a PID this function just saves the object.

You must make sure that prior to calling:

  • The category a.k.a. namespace is already set

  • The object is already saved

  • No PID was ever previously generated for this object.

Parameters:

request – This parameter no longer does anything. You may pass None.

register_handle_if_applicable(request=None)

Register a new PID if there is not already a PID set or previously generated.

This function can be called after saving a digital object that may or may not be new.

Parameters:

request – This parameter no longer does anything. You may pass None.

relations

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

property relative_url

Get landing page url for this DigitalObject at HELIPORT instance.

remove_tag(tag)

Object is no longer tagged with tag. See also Tag.unset_on().

property represents_external_identifier

Whether this object stands for itself or is an external resource.

An external resource is something that has an identifier that does not resolve to the HELIPORT landing page of this object. For example a publication may be identified in HELIPORT by a DOI that resolves to a publication repository, or a term in an ontology may be identified by a URI that resolves to its definition.

static resolve(params: Dict[str, str], context: Context) GeneralDigitalObject | None

For resolution.

reverse_relations

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

save_with_handle(category, project, request=None)

Save the object while adding some common extra information.

This encapsulates a very common pattern to save a DigitalObject.

Parameters:
  • category – The namespace as string of labels separated by “/”

  • project – A project to add to the DigitalObject.

  • request – Has no longer any effect.

set_context(context: Context)

Set context later accessible as :prop:`context`.

Set an heliport.core.utils.context.Context to be used by operations of this DigitalObject. By setting the context you guarantee that, and you are responsible for, closing the context after all operations are done. It is not allowed to change the user or downgrade the permission back to public again. Create a new digital object instance for that.

set_identifier(new_identifier)

Set the PID but normalize it first.

In some cases this function may make network requests (HEAD request) to determine if a variation of the identifier is actually valid. Therefore, this function should ideally be called in a celery job.

sharelatex

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

special_heliport_role

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property suffix_for_pid_generation

A string to use as a suffix in PID generation.

Note that it is not guaranteed that this suffix is used. For example a different suffix may be used if the PID is already registered for another object.

table

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

tag

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

tags_where_property

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

tags_where_type_required

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

tags_where_value

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

test_category_migrated()

Check whether the is migrated from the old format of labels instead of IDs.

I think this function can be deleted by now.

to_rdflib_node()

May be deprecated in the future in favour of as_rdf().

static type_id() str

For resolution.

versioncontrol

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

versioncontrolfile

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

property viewing_user: HeliportUser | None

The user that currently deals with this digital object.

Information may be restricted to what the user can see. None means to only include public infos.

class heliport.core.models.DigitalObjectAttributes(*args, **kwargs)

Bases: Model

Describes digital objects using arbitrary properties where values are a strings.

See also DigitalObjectRelation.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

digital_object_attribute_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_public

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
predicate

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

predicate_id
special_heliport_role

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

subject

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

subject_id
value

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class heliport.core.models.DigitalObjectRelation(*args, **kwargs)

Bases: Model

Triple that describes the subject using a key value pair.

The subject, predicate (key) and object (value) must all be digital objects. See DigitalObjectAttributes for when the value is a string.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

digital_object_relation_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_public

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

object

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

object_id
objects = <django.db.models.manager.Manager object>
predicate

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

predicate_id
special_heliport_role

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

subject

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

subject_id
class heliport.core.models.FromDB(role_name_in_db)

Bases: object

Get a digital object by special_heliport_role.

This is a python descriptor used in Vocabulary. It hanldes getting objects lazily (need to call :prop:`obj` later) when attribute is accessed on class and get object directly when attribute is accessed on instance.

property obj

Get the digital object.

class heliport.core.models.HeliportGroup(*args, **kwargs)

Bases: Model

HELIPORT specific group information.

The actual group from authentication is available as auth_group.

The user model is extended in a similar way in the HeliportUser model.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

auth_group

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

auth_group_id
backend_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

display_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

classmethod get_default_group()

Create a default group if it doesn’t exist.

group_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
project_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class heliport.core.models.HeliportUser(*args, **kwargs)

Bases: Model

HELIPORT specific user information.

The actual user from authentication is available as auth_user.

The group model is extended in a similar way in the HeliportGroup model.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

affiliation

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

auth_user

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

auth_user_id
authentication_backend_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

co_experimentalist_gate_projects

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

co_owned_digital_objects

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

contribution_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

digitalobject_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

display_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property email: str | None

The user’s email address.

Taken from authentication backend with fall back to :prop:`stored_email`.

email_is_public

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

email_sha1_is_public

Whether to show sha1 of email in public foaf metadata. Note that email hash can be reversed especially if you have the users name.

executionlog_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

experimentalist_gate_projects

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

gateuser

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

local_contact_gate_projects

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

logininfo_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <django.db.models.manager.Manager object>
orcid

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property public_email: str | None

The users :prop:`email` or None if it is not public.

set_orcid(orcid)

Set orcid and normalize.

stored_email

Email to use when no auth_user exists

to_rdflib_node()

Represent user by orcid or uuid.

This method is needed when describing a graph in heliport.core.attribute_description.AttributeType.rdf_triples(). See heliport.vocabulary_descriptor.TripleDescription.to_node().

user_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

uuid

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class heliport.core.models.Image(*args, **kwargs)

Bases: DigitalObject

Represent an Image in HELIPORT.

exception DoesNotExist

Bases: DoesNotExist

class ImageStates(value)

Bases: IntegerChoices

When creating new image state is “UPLOADING”.

After uploading it is either “OK” or “FAILED”.

FAILED = 3
OK = 1
UPLOADING = 2
exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

digitalobject_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

digitalobject_ptr_id
directory

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

download_data()

Get image data as bytes.

Download from server specified by login. If download fails status is set to FAILED.

download_url_is_public

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

fail(message)

Set status to FAILED with user message.

filename

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_custom_url(user=None)

Get custom landing page URL.

This function is recognized when showing the landing page and the landing page becomes the image data itself when using the default landing page type.

If the user does not have access the normal landing page is shown.

get_status_display(*, field=<django.db.models.fields.IntegerField: status>)
login

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

login_id
message

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property mimetype

Image mimetype.

property path

Get pathlib Path of image at computer specified by login.

replace_if_exists

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

status

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

tablecell_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

upload_image(image_url)

Upload image to computer defined by login.

The image data is taken from base46 encoded image_url parameter.

class heliport.core.models.LoginInfo(*args, **kwargs)

Bases: Model

Encrypted user credentials and SSH keys.

Note that tokens are stored as key attribute.

exception DoesNotExist

Bases: ObjectDoesNotExist

class LoginTypes(value)

Bases: TextChoices

Define allowed login types using Django TextChoices.

SSH = 'ssh connection'
TOKEN = 'authentication token'
USER_PASSWORD = 'username and password'
exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

build_command_executor(depth=10)

Generate heliport.core.utils.command_line_execution.CommandExecutor.

Only applicable to SSH keys. The connection is performed to the machine using the SSH key. SSH logins can be recursive by the via property up to a maximum depth specified by the depth parameter.

build_command_executor_indirection()

Build command executor for the SSH indirection specified via via.

Returns None if no indirection is specified. See also build_command_executor().

property connected: bool

Connected status of SSH logins.

SSH logins are considered connected if there is an SSH key generated for them. If the connection gets disconnected by the User the SSH key is deleted also from the allowed hosts on the specified machine.

data

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

datasource_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

dbsmbdirectory_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

dbsmbfile_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

dbsshdirectory_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

dbsshfile_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

encrypted_password

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_to_connect_list(depth=10, exclude_self=False) list

Get list of SSH Logins parameters that need to be connected before this one.

Parameters:
  • depth – Max recursion depth. Raise ValueError when exceeded.

  • exclude_self – exclude the current login from the list.

get_type_display(*, field=<django.db.models.fields.CharField: type>)
get_unconnected_parents() list

Get unconnected ssh indirections.

Same as get_to_connect_list() with exclude_self=True.

image_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

key

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

login_info_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

logininfo_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

machine

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
property password

Decrypted password.

slurm

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

user

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

user_id
userjobconfig_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

username

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

via

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

via_id
class heliport.core.models.MetadataField(attribute_vocab, normalizer=<class 'str'>, *, role_name_in_db='attribute')

Bases: object

Defines a python descriptor for metadata properties.

This descriptor should be used on DigitalObject subclasses.

In principle most properties of subclasses of DigitalObject can be considered “Metadata Properties” however using MetadataFiled has the added convenience that metadata serialization is automatically taken care of just by specifying the metadata property in the class definition. On top of that Storage if the property is public and can be shown on the landing page to everybody is handled without extra code.

Use it for example like this:

class MyClass(DigitalObject):
    link = MetadataField(Vocabulary.primary_topic, url_normalizer)

The first argument comes from Vocabulary and defines the metadata property to use for serialization. The second argument is optional and is just a function that is called before setting the value. heliport.core.utils.normalization.url_normalizer() is used in the example.

The values are stored as DigitalObjectAttributes and identified by thir property as well as an additional identification string that is by default “attribute”. This means if you have multiple properties with the same metadata property you need to set the role_name_in_db parameter uniquely for each. Also if you change the metadata attribute or the role_name_in_db you need to write a database migration.

query(instance)

Get the Django ORM query parameters to query relevant values.

These query parameters are for querying DigitalObjectAttributes.

class heliport.core.models.NamedToken(*args, **kwargs)

Bases: Model

HELIPORT API Token that is assigned a name by the user.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

auth_token

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

auth_token_id
name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
token_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class heliport.core.models.Project(*args, **kwargs)

Bases: DigitalObject

Class for storing a HELIPORT project.

Project is the main container for all kinds of DigitalObject instances. A project is also the main way of managing access to digital objects.

exception DoesNotExist

Bases: DoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

digital_object_lookup()

Get parts as dict of query sets keyed by type as string.

digitalobject_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

digitalobject_ptr_id
get_custom_view_url(user=None)

This defines the custom landing page to be the object graph.

get_parent_projects(exclude: Iterable | None = None)

Get set of all projects that have this project as subproject.

Ignore subprojects and subprojects of subprojects that are in the exclude set. The project itself is also part of the result.

group

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

group_id
hzdr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

last_modified_aggregate()

Get the last date this project or one of its parts was modified.

Note that parts in subprojects are not counted.

original_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

parts

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

parts_is_public

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

project_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

sub_project_list(max_level=8, level=1, parent_path=None)

Get a list of named tuples with the following attributes:

  • path: list of parent project ids

  • level: how deep is the subproject nested (as iterable python range)

  • project: the subproject model instance

  • has_child: boolean indicating if there are more subprojects under this

for each subproject

uuid

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class heliport.core.models.Tag(*args, **kwargs)

Bases: DigitalObject

A Digital Object D is tagged with a tag if relation (D, attribute, value) exists.

exception DoesNotExist

Bases: DoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

applicable_for(obj: DigitalObject)

Determine if obj has type required by the tag.

property as_dict

Return a serialized version of this tag as dict to be converted to JSON.

attribute

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

attribute_id
digitalobject_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

digitalobject_ptr_id
get_key_value()

Return tuple of attribute and value.

Attribute defaults to has_tag and value to the tag itself if they are None.

get_next_by_last_use_date(*, field=<django.db.models.fields.DateTimeField: last_use_date>, is_next=True, **kwargs)
get_previous_by_last_use_date(*, field=<django.db.models.fields.DateTimeField: last_use_date>, is_next=False, **kwargs)
hex_color

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property html_color

Color to be used in html e.g. #00FF35.

property html_foreground_color

Color to be used for text if background has html_color.

last_use_date

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

relation_query_set()

Get a django ORM query set for this tag.

The query set contains the DigitalObjectRelation instances that make a DigitalObject tagged by this tag.

requires_type

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

property requires_type_display

Displayable version of :prop:`requires_type`.

Tag might be for specific type or any type. This property can be used in an HTML template.

requires_type_id
property rgb_color

Same as html_color but returns a tuple of values up to 255.

set_on(obj: DigitalObject)

Tag obj with this tag. See also DigitalObject.add_tag().

tag_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

unset_on(obj: DigitalObject)

Remove tag from obj. See also DigitalObject.remove_tag().

update_usage_date()

Set last used to now.

value

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

value_id
class heliport.core.models.Vocabulary

Bases: object

To get a digital object use Vocabulary.<name>.obj or Vocabulary().<name>.

Class

Get a digital object by special_heliport_role.

This is a python descriptor used in Vocabulary. It hanldes getting objects lazily (need to call :prop:`obj` later) when attribute is accessed on class and get object directly when attribute is accessed on instance.

HELIPORT

Get a digital object by special_heliport_role.

This is a python descriptor used in Vocabulary. It hanldes getting objects lazily (need to call :prop:`obj` later) when attribute is accessed on class and get object directly when attribute is accessed on instance.

Namespace

Get a digital object by special_heliport_role.

This is a python descriptor used in Vocabulary. It hanldes getting objects lazily (need to call :prop:`obj` later) when attribute is accessed on class and get object directly when attribute is accessed on instance.

Project

Get a digital object by special_heliport_role.

This is a python descriptor used in Vocabulary. It hanldes getting objects lazily (need to call :prop:`obj` later) when attribute is accessed on class and get object directly when attribute is accessed on instance.

Property

Get a digital object by special_heliport_role.

This is a python descriptor used in Vocabulary. It hanldes getting objects lazily (need to call :prop:`obj` later) when attribute is accessed on class and get object directly when attribute is accessed on instance.

described_by_parameter

Get a digital object by special_heliport_role.

This is a python descriptor used in Vocabulary. It hanldes getting objects lazily (need to call :prop:`obj` later) when attribute is accessed on class and get object directly when attribute is accessed on instance.

described_by_process

Get a digital object by special_heliport_role.

This is a python descriptor used in Vocabulary. It hanldes getting objects lazily (need to call :prop:`obj` later) when attribute is accessed on class and get object directly when attribute is accessed on instance.

description

Get a digital object by special_heliport_role.

This is a python descriptor used in Vocabulary. It hanldes getting objects lazily (need to call :prop:`obj` later) when attribute is accessed on class and get object directly when attribute is accessed on instance.

filename

Get a digital object by special_heliport_role.

This is a python descriptor used in Vocabulary. It hanldes getting objects lazily (need to call :prop:`obj` later) when attribute is accessed on class and get object directly when attribute is accessed on instance.

has_identifier

Get a digital object by special_heliport_role.

This is a python descriptor used in Vocabulary. It hanldes getting objects lazily (need to call :prop:`obj` later) when attribute is accessed on class and get object directly when attribute is accessed on instance.

has_input

Get a digital object by special_heliport_role.

This is a python descriptor used in Vocabulary. It hanldes getting objects lazily (need to call :prop:`obj` later) when attribute is accessed on class and get object directly when attribute is accessed on instance.

has_part

Get a digital object by special_heliport_role.

This is a python descriptor used in Vocabulary. It hanldes getting objects lazily (need to call :prop:`obj` later) when attribute is accessed on class and get object directly when attribute is accessed on instance.

has_tag

Get a digital object by special_heliport_role.

This is a python descriptor used in Vocabulary. It hanldes getting objects lazily (need to call :prop:`obj` later) when attribute is accessed on class and get object directly when attribute is accessed on instance.

input_of

Get a digital object by special_heliport_role.

This is a python descriptor used in Vocabulary. It hanldes getting objects lazily (need to call :prop:`obj` later) when attribute is accessed on class and get object directly when attribute is accessed on instance.

is_version_of

Get a digital object by special_heliport_role.

This is a python descriptor used in Vocabulary. It hanldes getting objects lazily (need to call :prop:`obj` later) when attribute is accessed on class and get object directly when attribute is accessed on instance.

label

Get a digital object by special_heliport_role.

This is a python descriptor used in Vocabulary. It hanldes getting objects lazily (need to call :prop:`obj` later) when attribute is accessed on class and get object directly when attribute is accessed on instance.

primary_topic

Get a digital object by special_heliport_role.

This is a python descriptor used in Vocabulary. It hanldes getting objects lazily (need to call :prop:`obj` later) when attribute is accessed on class and get object directly when attribute is accessed on instance.

status

Get a digital object by special_heliport_role.

This is a python descriptor used in Vocabulary. It hanldes getting objects lazily (need to call :prop:`obj` later) when attribute is accessed on class and get object directly when attribute is accessed on instance.

sub_property_of

Get a digital object by special_heliport_role.

This is a python descriptor used in Vocabulary. It hanldes getting objects lazily (need to call :prop:`obj` later) when attribute is accessed on class and get object directly when attribute is accessed on instance.

subclass_of

Get a digital object by special_heliport_role.

This is a python descriptor used in Vocabulary. It hanldes getting objects lazily (need to call :prop:`obj` later) when attribute is accessed on class and get object directly when attribute is accessed on instance.

subnamespace_of

Get a digital object by special_heliport_role.

This is a python descriptor used in Vocabulary. It hanldes getting objects lazily (need to call :prop:`obj` later) when attribute is accessed on class and get object directly when attribute is accessed on instance.

suggested_property

Get a digital object by special_heliport_role.

This is a python descriptor used in Vocabulary. It hanldes getting objects lazily (need to call :prop:`obj` later) when attribute is accessed on class and get object directly when attribute is accessed on instance.

type

Get a digital object by special_heliport_role.

This is a python descriptor used in Vocabulary. It hanldes getting objects lazily (need to call :prop:`obj` later) when attribute is accessed on class and get object directly when attribute is accessed on instance.

heliport.core.models.assert_not_relation(subj: DigitalObject, pred: DigitalObject, obj: DigitalObject)

Opposite of assert_relation().

Means that the statement is no longer assumed to be true.

heliport.core.models.assert_relation(subj: DigitalObject, pred: DigitalObject, obj: DigitalObject)

Insert the triple (subj, pred, obj) into DigitalObjectRelation table.

Semantically this makes the statement considered true in HELIPORT. Another way to view this is to set the key-value-pair “pred: obj” in the metadata of subj.

Consider the example, where HELIPORT, uses and Django are DigitalObject instances:

assert_relation(HELIPORT, uses, Django)

This means that the statement “HELIPORT uses Django” is assumed to be true or that the metadata of HELIPORT includes the key-value-pair “uses: Django”.

heliport.core.models.assert_relation_truth(subj: DigitalObject, pred: DigitalObject, obj: DigitalObject, truth: bool)

Assert the truthiness of a relation based on a boolean.

Same as assert_relation() and assert_not_relation() but which one is decided by truth.

heliport.core.models.digital_object_form_label_and_pk(label, pk) DigitalObject | None

Resolve a DigitalObject from pk.

If pk is not truthy, label is used if it uniquely identifies a DigitalObject. This is useful for getting a digital object from an autocomplete. if pk is not an integer or a string representing an integer and label is not truthy, this function returns None.

heliport.core.models.get_or_create_with_relation(label, category, pred, obj)

Get or create a digital object that has a specific relation.

The returned digital object (that might be newly created) is the subject in the relation. The subject must have the label. When the subject is newly created also the category is set on it along with the label. The relation has subject (the digital object of interest), pred and obj which form a triple of digital objects. See also DigitalObjectRelation.

heliport.core.models.get_special_object(special_heliport_role: str, allow_create_with: dict | None = None)

Get a digital object by special_heliport_role.

The special_heliport_role is a string to identify a digital object in the database inside the source code itself. If the object does not exist None is returned.

If allow_create_with is set to a dict the object is created with the default values specified in the dict.

This function only exists for special cases. The normal approach is to use heliport.core.vocabulary_core to define what objects should exist and with which parameters. (These are created when migrating the database) And then use Vocabulary to get the objects in code.

heliport.core.negotiation module

Custom content negotiation.

class heliport.core.negotiation.HeliportContentNegotiation

Bases: DefaultContentNegotiation

Custom content negotiation for the HELIPORT API.

This class reuses most functionality of Django REST Framework’s DefaultContentNegotiation but for requests made with HTMX, it selects the heliport.core.renderers.HeliportPartialRenderer when appropriate.

More info on custom content negotiation can be found in the Django REST Framework docs.

select_renderer(request, renderers, format_suffix=None)

Select the appropriate renderer for the response to request.

The implementation reuses logic from DefaultContentNegotiation but explicitly asks it to return a renderer with format_suffix="partial" if appropriate and supported by the view. We consider it appropriate to use a partial renderer for requests made with HTMX that either accept all media types (*/*, the HTMX default) or specifically ask for text/html.

heliport.core.permissions module

class heliport.core.permissions.HeliportObjectPermission

Bases: BasePermission

Permission class to be used in django rest framework views.

has_object_permission(request, view, obj)

Permission is granted if user has_permission_for() the digital object.

class heliport.core.permissions.HeliportProjectPermission

Bases: BasePermission

Permission class to be used in django rest framework views.

has_object_permission(request, view, obj)

Permission is granted if user is member of the project.

class heliport.core.permissions.PermissionChecker(obj: DigitalObject | None, context: Context)

Bases: object

Class that checks permission given an object and a context (which may provide a current user and current project). This is used for return value of heliport.core.digital_object_interface.GeneralDigitalObject.access(). It might be necessary to implement a subclass that overwrites some methods if you want to use permission with objects that are not heliport.core.models.DigitalObject instances.

assert_permission()

Raises heliport.core.utils.exceptions.AccessDenied if no permission.

assert_read_permission()

Raises heliport.core.utils.exceptions.AccessDenied if no permission.

check_permission() bool

Check if current user (from context) has read and write permissions for this digital object.

check_read_permission() bool

Check if current user (from context) has permission to read this digital object.

class heliport.core.permissions.StaffOrReadOnly

Bases: BasePermission

Permission class to be used in django rest framework views.

has_object_permission(request, view, obj)

Only admins can edit; everybody can read.

heliport.core.permissions.allowed_objects(heliport_user, obj_type=<class 'heliport.core.models.DigitalObject'>)

QuerySet of all objects a user is allowed to access. This is the same as objects_of() but also includes all public projects.

heliport.core.permissions.direct_objects_of(heliport_user, obj_type=<class 'heliport.core.models.DigitalObject'>)

QuerySet of heliport.core.models.DigitalObject instances of type obj_type where user is a member.

heliport.core.permissions.has_permission_for(user: HeliportUser, obj: DigitalObject)

Check if a user is allowed to access non-public attributes of obj.

Currently, this is implemented by checking if the user is a member of a project that contains obj. This might change in the future.

See also object_of().

heliport.core.permissions.has_read_permission(user: HeliportUser | None, obj: DigitalObject)

Check if user has read permission to non-public attributes of obj. This is currently the same as has_permission_for() but might change in the future.

heliport.core.permissions.has_write_permission(user: HeliportUser | None, obj: DigitalObject)

Check if user has write permission for obj. This is currently the same as has_permission_for().

heliport.core.permissions.is_object_member(heliport_user)

Query that can be used to construct filters on objects. This filters the same objects as objects_of().

heliport.core.permissions.is_public()

Query that can be used to construct filters on objects. This filters objects that are public and is used in allowed_objects(). Currently, a DigitalObject is public if it has no owner. Because most objects have no owner, most objects are public. This is subject to change.

heliport.core.permissions.objects_of(heliport_user, obj_type=<class 'heliport.core.models.DigitalObject'>)

QuerySet of objects where heliport_user has access to. Currently, a user has_permission_for() an object if the object is in a project where the user is member of. This might change in the future.

heliport.core.permissions.projects_of(heliport_user)

QuerySet of projects where user is a member.

heliport.core.renderers module

Renderers for the HELIPORT API.

class heliport.core.renderers.HeliportPartialRenderer

Bases: TemplateHTMLRenderer

A TemplateHTMLRenderer that can be used to specifically ask for partials.

format = 'partial'

heliport.core.serializers module

This module is for serialization into Datacite, RDF and JSON.

The JSON format is used for API endpoints via Django rest framework. Using this, it is typical to put the serializer classes into a “serializers.py” file.

For the serialization into RDF, attributes are described. See heliport.core.attribute_description.BaseAttribute for more detail.

This particular serializer module of the HELIPORT core app also contains renderer classes for rendering the RDF into a particular representation as well as other helper functionality for serialization.

class heliport.core.serializers.AttrObjRDFSerializer

Bases: RDFSerializer

triples(the_object, user)
class heliport.core.serializers.ContributionRDFSerializer

Bases: RDFSerializer

triples(contribution, user)
static type2role()
class heliport.core.serializers.ContributionSerializer(*args, **kwargs)

Bases: ModelSerializer

class Meta

Bases: object

fields = ['contribution_id', 'type', 'contributor', 'contribution_to']
model

alias of Contribution

class heliport.core.serializers.DATACITESerializer

Bases: object

abstract as_dict(object_to_serialize, user)
as_json(object_to_serialize, user)
abstract related_identifiers(object_to_serialize, user)
abstract resource_type(object_to_serialize)
resource_type_dict(object_to_serialize)
class heliport.core.serializers.DataCiteJSONRenderer

Bases: object

name = 'Datacite JSON'
static render(obj, user)
class heliport.core.serializers.DataCiteRenderer

Bases: object

name = 'Datacite XML'
static render(obj, user)
class heliport.core.serializers.DigitalObjectAPISerializer(*args, **kwargs)

Bases: ModelSerializer

class ID_KEY

Bases: object

in_json = '@id'
in_obj = 'identifier_link'
class Meta

Bases: object

fields = ['digital_object_id']
list_serializer_class

alias of DigitalObjectListSerializer

model

alias of DigitalObject

create(validated_data)
set_values(instance, validated_data)
update(instance, validated_data)
property user
validate(data)
class heliport.core.serializers.DigitalObjectDATACITESerializer

Bases: DATACITESerializer

https://github.com/datacite/schema/blob/master/source/json/kernel-4.3/datacite_4.3_schema.json.

as_dict(digital_object, user)
related_identifiers(object_to_serialize, user)
resource_type(object_to_serialize)
class heliport.core.serializers.DigitalObjectListSerializer(*args, **kwargs)

Bases: ListSerializer

create(validated_data)
to_representation(digital_objects)
update(instance, validated_data)
class heliport.core.serializers.DigitalObjectRDFSerializer

Bases: RDFSerializer

static dynamic_triples(digital_object, user)
static static_triples(digital_object, user)
triples(digital_object, user)
class heliport.core.serializers.GroupSerializer(*args, **kwargs)

Bases: ModelSerializer

class Meta

Bases: object

fields = ['display_name']
model

alias of HeliportGroup

class heliport.core.serializers.HtmlRenderer

Bases: object

name = 'Specific Landing Page'
classmethod render(obj, user)
class heliport.core.serializers.ImageDATACITESerializer

Bases: DigitalObjectDATACITESerializer

resource_type(image)
class heliport.core.serializers.ImageUrlAttribute(**kwargs)

Bases: BaseAttribute

getattr(image)
class heliport.core.serializers.JsonLdRenderer

Bases: object

static filter_prefixes(graph, prefixes)
classmethod find_id_usages(item, parent, id_usages)
classmethod inline(graph)
static len_sum(d: dict)
name = 'JSON-LD'
classmethod render(obj, user)
class heliport.core.serializers.LandingPageRenderer

Bases: object

name = 'Default Landing Page'
classmethod render(obj, user)
class heliport.core.serializers.MetadataBoundField(field, value, error, instance)

Bases: BoundField

as_form_field()
render_form_inputs()
class heliport.core.serializers.MetadataRestField(*args, **kwargs)

Bases: Field

get_attribute(instance)
get_or_generate_predicate_obj()
get_value(dictionary)
property read_only_attrs
render_new_input()
set_values(instance, validated_value_list)
property source_attrs
split_value_list(value_list)
to_internal_value(data)
to_representation(value)
property writable_attrs
property writable_list_attrs
property writable_single_attrs
class heliport.core.serializers.ProjectDATACITESerializer

Bases: DigitalObjectDATACITESerializer

related_identifiers(object_to_serialize, user)
resource_type(object_to_serialize)
class heliport.core.serializers.ProjectSerializer(*args, **kwargs)

Bases: ModelSerializer

class Meta

Bases: object

fields = ['project_id', 'label', 'created', 'deleted', 'description', 'group', 'owner', 'co_owners', 'persistent_id']
model

alias of Project

class heliport.core.serializers.RDFSerializer

Bases: object

abstract triples(the_object, user)
class heliport.core.serializers.RdfXmlRenderer

Bases: object

name = 'RDF XML'
static render(obj, user)
class heliport.core.serializers.TemplateField(*args, **kwargs)

Bases: Field

get_attribute(instance)
to_internal_value(data)
to_representation(value)
class heliport.core.serializers.TokenSerializer(*args, **kwargs)

Bases: ModelSerializer

class Meta

Bases: object

fields = ['login_info_id', 'name', 'token']
model

alias of LoginInfo

class heliport.core.serializers.TripleRenderer

Bases: object

name = 'N-Triples'
static render(obj, user)
class heliport.core.serializers.TurtleRenderer

Bases: object

name = 'Turtle'
static render(obj, user)
class heliport.core.serializers.UserRDFSerializer

Bases: RDFSerializer

triples(user, user_that_wants_to_know)
class heliport.core.serializers.UserSerializer(*args, **kwargs)

Bases: ModelSerializer

class Meta

Bases: object

fields = ['user_id', 'authentication_backend_id', 'display_name', 'orcid', 'affiliation']
model

alias of HeliportUser

heliport.core.serializers.digital_object_attributes() List[BaseAttribute]
heliport.core.serializers.get_all_attributes(obj)
heliport.core.serializers.get_all_attributes_bound(obj)
heliport.core.serializers.get_attributes_as(user, obj)
heliport.core.serializers.get_attributes_by_category(obj, user)
heliport.core.serializers.get_bound_attributes_as(user, obj)
heliport.core.serializers.get_dynamic_attributes(obj)
heliport.core.serializers.get_static_attributes(cls)
heliport.core.serializers.get_unique_renderers()
heliport.core.serializers.image_attributes()
heliport.core.serializers.project_attributes()
heliport.core.serializers.register_digital_object_attributes(cls)
heliport.core.serializers.select_renderer(format_code, accept_header)
heliport.core.serializers.static_attributes = {<class 'heliport.archive.models.Archive'>: <function register_digital_object_attributes.<locals>.decorator.<locals>.attributes>, <class 'heliport.core.models.DigitalObject'>: <function digital_object_attributes>, <class 'heliport.core.models.Image'>: <function register_digital_object_attributes.<locals>.decorator.<locals>.attributes>, <class 'heliport.core.models.Project'>: <function register_digital_object_attributes.<locals>.decorator.<locals>.attributes>}

collection of all metadata descriptions

heliport.core.serializers.to_datacite(obj, user)
heliport.core.serializers.to_rdf(digital_object, user, max_depth=100)
heliport.core.serializers.types(obj, bound_attributes=False)

heliport.core.tests module

Test the behaviour of this app.

This follows the Writing tests guide in Django.

class heliport.core.tests.APITest(methodName='runTest')

Bases: WithHeliportUser

static getattr_path(obj, name_path, default=None)
subclasses_recursive(the_class)
test_deletion()
test_digital_object_api()
test_projects()
test_token_auth()
test_users()
class heliport.core.tests.CoreVocabularyTest(methodName='runTest')

Bases: TestCase

test_query_by_type()
test_vocabularies_exist_and_are_property_or_class()
class heliport.core.tests.DigitalObjectInterfaceTest(methodName='runTest')

Bases: WithHeliportUser

test_actions()
test_file()
test_resolution()
class heliport.core.tests.DummyAction(obj: ObjType = None, project: Project = None, user: HeliportUser = None)

Bases: Action

applicable = True
icon = 'fa-kiwi-bird'
name = 'dummy'
class heliport.core.tests.DummyContext

Bases: object

generate(unused_context)
class heliport.core.tests.DummyFile

Bases: File

close()
get_file_info() Dict[str, str]
mimetype = 'text/text'
open()
read(number_of_bytes=None) bytes
size() int | None
class heliport.core.tests.DummyResolvable

Bases: GeneralDigitalObject

as_digital_object(context: Context) DigitalObject
as_html() str
as_rdf() RootedRDFGraph
as_text() str
get_identifying_params() Dict[str, str]
classmethod resolve(params: Dict[str, str], context: Context) GeneralDigitalObject | None
static type_id() str
class heliport.core.tests.FormTest(methodName='runTest')

Bases: TestCase

Tests for form validation.

test_orcid_validation_only_id()

A valid ORCID without the full URL does not pass validation.

test_orcid_validation_valid_orcid()

A valid ORCID with full URL passes validation.

test_orcid_validation_wrong_checksum()

An ORCID with an invalid checksum does not pass validation.

test_orcid_validation_x_check_digit()

An ORCID with an X as the check digit passes validation.

class heliport.core.tests.HELIPORTTest(methodName='runTest')

Bases: WithHeliportUser

setUp()
test_as_digital_object()
test_copy_digital_object()
test_icons_exist_landing_page()
test_icons_exist_main_page()
test_importing_digital_objects()
test_maintenance_message_api()

On maintenance level > 0, the correct level and message should be returned.

test_maintenance_message_no_partial_on_media_type()

HTMX requests asking for non-html media type should not receive partials.

test_maintenance_message_partial()

On maintenance level > 0, HTMX requests should receive a partial containing the message. The div should have alert classes.

test_no_maintenance_message_api()

On maintenance level 0, the message in the response should be null.

test_no_maintenance_message_partial()

On maintenance message level 0, HTMX requests should receive a partial without any code.

test_project_graph()
test_project_independent_tag_autocomplete()
test_simple_api_docu()

Mirroring the way it is described in projects api view.

test_tag_autocomplete()
test_tag_is_added_when_tagging_project()
test_tag_json_view()
test_tag_view()
class heliport.core.tests.HandleServerInteractionTest(methodName='runTest')

Bases: TestCase

class HandleServerMock(response_list)

Bases: HandleServer

do_request(**kwargs)
class ResponseObj(status=None, json_data=None, ok=True)

Bases: object

json()
auth_cert = ('/etc/ssl/certs/heliport_handle_admin.crt', '/etc/ssl/private/heliport_handle_admin.key')
auth_header = {'Authorization': 'Handle clientCert="true"', 'Content-Type': 'application/json'}
json_header = {'Content-Type': 'application/json'}
test_extract_handle()
test_get_key_values()
test_handle_registering()
test_handle_registering_handle_already_exists()
test_url_not_in_key_values()
class heliport.core.tests.IconsParser(*args, **kwargs)

Bases: HTMLParser

handle_startendtag(tag, attrs)
class heliport.core.tests.LdJsonContextTest(methodName='runTest')

Bases: TestCase

test_add_to_end_of_chain()
test_basic_set()
test_chained_renaming()
test_match_context()
test_rename_keys()
test_reverse_compatible_with_generation()
test_unique_keys()
class heliport.core.tests.ModelsTest(methodName='runTest')

Bases: WithHeliportUser

test_digital_object()
test_project()
test_tag()
test_user()
class heliport.core.tests.QueryTest(methodName='runTest')

Bases: WithHeliportUser

test_create_project()
test_deletion()
test_group()
test_tags()
class heliport.core.tests.SearchTest(methodName='runTest')

Bases: WithHeliportUser

assertEqualNoOrder(list_goal, list_actual)
test_digital_object_autocomplete()
test_group_findable()
test_heliport_user_and_project_findable()
test_landing_page_by_persistent_id()
test_search_valid_redirect_urls()
class heliport.core.tests.TemplateRenderingTest(methodName='runTest')

Bases: TestCase

test_isinstance()
test_query_params()
test_repr()
test_type()
test_zip()
class heliport.core.tests.UtilsTest(methodName='runTest')

Bases: TestCase

test_context()
test_digital_object_breadcrumb()
test_exceptions()
test_first()
test_format_byte_count()
test_format_time()
test_manually_closing_context()
test_merge_iterables()
test_parse_date_time()
test_remove_prefix()
class heliport.core.tests.WithHeliportUser(methodName='runTest')

Bases: TestCase

setUp()

Set up logged-in heliport user.

class heliport.core.tests.WithProject(methodName='runTest')

Bases: WithHeliportUser

setUp()

Set up project and logged-in heliport user.

heliport.core.tests.build_action(obj, project, user)

heliport.core.urls module

Map django views to urls.

See this Example including explanation from the Django documentation.

heliport.core.vocabulary module

class heliport.core.vocabulary.DATACITE

Bases: DefinedNamespace

DataCite2RDF http://dx.doi.org/10.6084/m9.figshare.2075356.

AgentIdentifier: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/AgentIdentifier')
AgentIdentifierScheme: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/AgentIdentifierScheme')
AlternateResourceIdentifier: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/AlternateResourceIdentifier')
DescriptionType: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/DescriptionType')
FunderIdentifier: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/FunderIdentifier')
FunderIdentifierScheme: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/FunderIdentifierScheme')
Identifier: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/Identifier')
IdentifierScheme: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/IdentifierScheme')
MetadataScheme: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/MetadataScheme')
OrganizationIdentifier: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/OrganizationIdentifier')
OrganizationIdentifierScheme: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/OrganizationIdentifierScheme')
PersonalIdentifier: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/PersonalIdentifier')
PersonalIdentifierScheme: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/PersonalIdentifierScheme')
PrimaryResourceIdentifier: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/PrimaryResourceIdentifier')
ResourceIdentifier: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/ResourceIdentifier')
ResourceIdentifierScheme: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/ResourceIdentifierScheme')
abstract: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/abstract')
acm: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/acm')
ark: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/ark')
arxiv: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/arxiv')
bibcode: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/bibcode')
crossref: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/crossref')
dblp: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/dblp')
dia: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/dia')
dnb: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/dnb')
doi: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/doi')
ean13: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/ean13')
eissn: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/eissn')
fundref: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/fundref')
gepris: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/gepris')
github: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/github')
gnd: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/gnd')
handle: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/handle')
hasCreatorList: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/hasCreatorList')
hasDescription: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/hasDescription')
hasDescriptionType: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/hasDescriptionType')
hasGeneralResourceType: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/hasGeneralResourceType')
hasIdentifier: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/hasIdentifier')
ieee: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/ieee')
infouri: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/infouri')
isbn: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/isbn')
isni: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/isni')
issn: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/issn')
istc: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/istc')
jst: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/jst')
lattes: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/lattes')
linkedin: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/linkedin')
lissn: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/lissn')
loc: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/loc')
lsid: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/lsid')
methods: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/methods')
nihmsid: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/nihmsid')
nii: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/nii')
oci: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/oci')
oclc: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/oclc')
openid: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/openid')
orcid: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/orcid')
other: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/other')
pii: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/pii')
pmcid: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/pmcid')
pmid: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/pmid')
purl: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/purl')
repec: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/repec')
researcherid: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/researcherid')
ror: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/ror')
sici: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/sici')
spar: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/spar')
twitter: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/twitter')
upc: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/upc')
uri: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/uri')
url: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/url')
urn: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/urn')
usesIdentifierScheme: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/usesIdentifierScheme')
usesMetadataScheme: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/usesMetadataScheme')
viaf: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/viaf')
wikidata: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/wikidata')
wikipedia: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/wikipedia')
zbmath: URIRef = rdflib.term.URIRef('http://purl.org/spar/datacite/zbmath')
class heliport.core.vocabulary.FABIO

Bases: DefinedNamespace

ArchivalDocument: URIRef = rdflib.term.URIRef('http://purl.org/spar/fabio/ArchivalDocument')
DataMangementPlan: URIRef = rdflib.term.URIRef('http://purl.org/spar/fabio/DataMangementPlan')
Manuscript: URIRef = rdflib.term.URIRef('http://purl.org/spar/fabio/Manuscript')
PersonalCommunication: URIRef = rdflib.term.URIRef('http://purl.org/spar/fabio/PersonalCommunication')
Repository: URIRef = rdflib.term.URIRef('http://purl.org/spar/fabio/Repository')
Workflow: URIRef = rdflib.term.URIRef('http://purl.org/spar/fabio/Workflow')
class heliport.core.vocabulary.PRO

Bases: DefinedNamespace

PRO, the Publishing Roles Ontology.

RoleInTime: URIRef = rdflib.term.URIRef('http://purl.org/spar/pro/RoleInTime')
distributor: URIRef = rdflib.term.URIRef('http://purl.org/spar/pro/distributor')
editor: URIRef = rdflib.term.URIRef('http://purl.org/spar/pro/editor')
holdsRoleInTime: URIRef = rdflib.term.URIRef('http://purl.org/spar/pro/holdsRoleInTime')
producer: URIRef = rdflib.term.URIRef('http://purl.org/spar/pro/producer')
relatesToDocument: URIRef = rdflib.term.URIRef('http://purl.org/spar/pro/relatesToDocument')
relatesToOrganization: URIRef = rdflib.term.URIRef('http://purl.org/spar/pro/relatesToOrganization')
withRole: URIRef = rdflib.term.URIRef('http://purl.org/spar/pro/withRole')
class heliport.core.vocabulary.SemanticDesktop

Bases: object

NEPOMUK Ontology.

class NFO

Bases: DefinedNamespace

Image: URIRef = rdflib.term.URIRef('https://www.semanticdesktop.org/ontologies/2007/03/22/nfo/#Image')
fileName: URIRef = rdflib.term.URIRef('https://www.semanticdesktop.org/ontologies/2007/03/22/nfo/#fileName')
class NIE

Bases: DefinedNamespace

mimeType: URIRef = rdflib.term.URIRef('https://www.semanticdesktop.org/ontologies/2007/01/19/nie/#mimeType')
class heliport.core.vocabulary.WIKIDATA

Bases: object

prefix = rdflib.term.URIRef('http://www.wikidata.org/wiki/Q23585486')

heliport.core.vocabulary_core module

heliport.core.vocabulary_core.insert_core_vocabulary()

To be called in post migration signal handler.

heliport.core.vocabulary_core.set_attribs(role_name_in_db, label, persistent_id=None, append_to=None)
heliport.core.vocabulary_core.set_property(obj, predicate, value)

heliport.core.vocabulary_descriptor module

class heliport.core.vocabulary_descriptor.LiteralTriple(subj, pred, literal, recursive=True)

Bases: TripleDescription

add_to_graph(graph)
objects()
class heliport.core.vocabulary_descriptor.PropertyList(subj, pred, key_values, intermediate=None, recursive=True)

Bases: TripleDescription

add_to_graph(graph)
objects()
class heliport.core.vocabulary_descriptor.RelationTriple(subj, pred, obj, recursive=True)

Bases: TripleDescription

add_to_graph(graph)
objects()
class heliport.core.vocabulary_descriptor.TripleDescription(recursive=True)

Bases: object

abstract add_to_graph(graph)
static filter_nodes(digital_objects)
abstract objects()
static to_node(the_object)

Module contents

This is the core HELIPORT django app that contains all general functionality.

The interface module is imported to the top level of the package for HELIPORT app interface discovery (see heliport.core.app_interaction.get_heliport_apps()).