Extension Relationship


Extension Basics

Title
Relationship
Name
ckanext-relationship
Type
Public extension
Description
Erstellt und verwaltet Beziehungen zwischen CKAN-Entities (Packages, Organizations, Groups) in Form von Triples mit bidirektionalen Relation-Types (related_to, child_of, parent_of).
CKAN versions

~2.9, ~2.10, ~2.11

Show details
Download-Url (zip)
Download-Url commit date
2024-11-01
Url to repo
Category
Data Management & Quality


Background Infos

Description (long)
Show details

ckanext-relationship

Diese Extension fügt eine zusätzliche Datenbanktabelle hinzu, die Beziehungen zwischen Entities in Form von Triples speichert (subject_id, object_id, relation_type).

Features:

  • Bidirektionale Relationstypen:
    • peer-to-peer: related_to <=> related_to
    • subordinate: child_of <=> parent_of
  • Autocomplete-Interface für Entity-Auswahl
  • Integration mit ckanext-scheming für Schema-Definitionen
  • Automatische Solr-Index-Updates bei Relationship-Änderungen
  • Form Snippets und Display Snippets
  • Konfigurierbare Views ohne Relationships (Performance-Optimierung)
  • Async Package-Index-Rebuild Support
  • Actions: relation_create, relation_delete, relations_list, relations_ids_list
  • Extras-Feld für zusätzliche Metadaten
  • Created_at Timestamps

Schema-Beispiel:

- field_name: related_projects
  label: Related Projects
  preset: related_entity
  current_entity: package
  current_entity_type: dataset
  related_entity: package
  related_entity_type: project
  relation_type: related_to
  multiple: true
  updatable_only: false
  required: false

Konfigurierbare Optionen:

  • owned_only: Nur Entities des aktuellen Users
  • updatable_only: Nur update-berechtigte Entities
  • check_sysadmin: Sysadmin-Check aktivieren
  • format_autocomplete_helper: Custom Formatter

Lizenz: AGPL-3.0

Version
0.2.10
Version release date
2023-01-17
Contact name
DataShades
Contakt email
(not set)
Contact Url
(not set)


Installation Guide

Configuration hints

Installation

pip install ckanext-relationship

Configuration

ckan.plugins = … relationship …

DB Migration

ckan db upgrade -p relationship

Optionale Konfiguration:

Views ohne Relationships in package_show (Performance)

ckanext.relationship.views_without_relationships_in_package_show = search read

Async Package-Index-Rebuild

ckanext.relationship.async_package_index_rebuild = true

Redis Queue Name

ckanext.relationship.redis_queue_name = default

Schema-Integration (ckanext-scheming erforderlich):

In scheming YAML:

fields: - field_name: related_datasets label: Related Datasets preset: related_entity current_entity: package current_entity_type: dataset related_entity: package related_entity_type: dataset relation_type: related_to multiple: true form_snippet: related_entity_with_autocomplete.html display_snippet: related_entity.html validators: relationship_related_entity

Custom Autocomplete Format Helper (optional):

In plugin.py:

def get_helpers(self): return { ‘my_custom_formatter’: my_formatter_func }

API Usage:

tk.get_action(‘relationship_relation_create’)( context, { ‘subject_id’: ‘pkg-1’, ‘object_id’: ‘pkg-2’, ‘relation_type’: ‘related_to’, ‘extras’: {‘custom_field’: ‘value’} } )

Plugins to configure (ckan.ini)
relationship
CKAN Settings (ckan.ini)
# ckanext.relationship.views_without_relationships_in_package_show = search read # ckanext.relationship.async_package_index_rebuild = true # ckanext.relationship.redis_queue_name = default
DB migration to be executed
relationship
<< back to Extensions