Defined Type: graphdb::data

Defined in:
manifests/data.pp

Summary

This define allows you to import data from given source(incl. zip archive)

Overview

default: null

Parameters:

  • archive (Optional[String]) (defaults to: undef)

    Local zip archive that you want to load into GraphDB repository.

  • context (String) (defaults to: 'null')

    The context you want to load your data into.

  • data (Optional[String]) (defaults to: undef)

    The data you want to load into GraphDB repository. Supported formats: String: ‘data’ Array: [‘data#1’,‘data#2’] Array of Hashes: [=> ‘data#1’, ‘context’ => ‘context_of_data#1’, ‘format’ => ‘format_of_data1’, => ‘data#2’, ‘context’ => ‘context_of_data#2’, ‘format’ => ‘format_of_data2’] Mixed Array: [=> ‘data#1’, ‘context’ => ‘context_of_data#1’, ‘format’ => ‘format_of_data1’, ‘data#2’] note#1: if context for data not provided data_context is used note#2: if format for data not provided data_format is used

  • data_format (Optional[String]) (defaults to: undef)

    The data format. example: turtle

  • endpoint (Stdlib::HTTPUrl)

    GraphDB endpoint. example: localhost:8080

  • exists_expected_response (Boolean) (defaults to: true)

    The expected response from exists_query default: true

  • exists_query (String)

    The ask query to check whether data is already loaded. You can use the following syntax: ask ?p ?o

  • overwrite (Boolean) (defaults to: false)

    Wheather to overwrite any existing data. default: false

  • repository (String)

    GraphDB repository.

  • source (Optional[String]) (defaults to: undef)

    The source of data you want to load into GraphDB repository. Supported formats: String: ‘path_to_file’ String: ‘path_to_directory’ Array: [‘path_to_file#1’,‘path_to_file#2’] Array of Hashes: [=> ‘path_to_file#1’, ‘context’ => ‘context_of_file#1’, ‘format’ => ‘format_of_file#1’, => ‘path_to_file#2’, ‘context’ => ‘context_of_file#2’, ‘format’ => ‘format_of_file#2’] Mixed Array: [=> ‘path_to_file#1’, ‘context’ => ‘context_of_file#1’, ‘format’ => ‘format_of_file#1’, ‘path_to_file#2’] note#1: if context for file not provided data_context is used note#2: if format for file not provided trying to resolve format from file if fails data_format is used

  • timeout (Integer) (defaults to: 200)

    The max number of seconds that the loading process should wait before giving up. default: 200



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'manifests/data.pp', line 61

define graphdb::data (
  Stdlib::HTTPUrl   $endpoint,
  String            $exists_query,
  String            $repository,
  Optional[String]  $archive                  = undef,
  String            $context                  = 'null',
  Optional[String]  $data                     = undef,
  Optional[String]  $data_format              = undef,
  Boolean           $exists_expected_response = true,
  Boolean           $overwrite                = false,
  Optional[String]  $source                   = undef,
  Integer           $timeout                  = 200,
) {
  require graphdb

  File {
    owner => $graphdb::graphdb_user,
    group => $graphdb::graphdb_group,
  }

  Exec {
    path => ['/bin', '/usr/bin', '/usr/local/bin'],
    cwd  => '/',
    user => $graphdb::graphdb_user,
  }

  if $archive {
    $archive_name = basename($archive)
    $archive_base = "${graphdb::tmp_dir}/${title}"
    $archive_destination = "${archive_base}/${archive_name}"
    $data_source_final = "${archive_base}/unpacked"

    file { $archive_base:
      ensure => directory,
    }

    file { $archive_destination:
      ensure  => file,
      source  => $archive,
      require => File[$archive_base],
      notify  => Exec["unpack-archive-source-${title}"],
    }

    exec { "unpack-archive-source-${title}":
      command     => "rm -rf ${data_source_final} && unzip ${archive_destination} -d ${data_source_final}",
      refreshonly => true,
      require     => [Package['unzip'], File[$archive_base]],
      notify      => Graphdb_data[$title],
    }
  } else {
    $data_source_final = $source
  }

  graphdb_data { $title:
    endpoint                 => $endpoint,
    repository_id            => $repository,
    exists_query             => $exists_query,
    data_source              => $data_source_final,
    data                     => $data,
    data_format              => $data_format,
    data_context             => $context,
    data_overwrite           => $overwrite,
    exists_expected_response => $exists_expected_response,
    timeout                  => $timeout,
  }
}