Class: DataKitten::Dataset
- Inherits:
-
Object
- Object
- DataKitten::Dataset
- Includes:
- Hosts, Origins, PublishingFormats
- Defined in:
- lib/data_kitten/dataset.rb
Overview
Represents a single dataset from some origin (see dcat:Dataset for relevant vocabulary).
Designed to be created with a URI to the dataset, and then to work out metadata from there.
Currently supports Datasets hosted in Git (and optionally on GitHub), and which use the Datapackage metadata format.
Instance Attribute Summary collapse
-
#access_url ⇒ String
The URL that gives access to the dataset.
-
#identifier ⇒ String
A unique identifier of the dataset.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
- #source ⇒ Object
Instance Method Summary collapse
-
#change_history ⇒ Array
A history of changes to the Dataset.
-
#contributor_agreement_url ⇒ String
The URL of the contributor license agreement.
-
#contributors ⇒ Array<Agent>
A list of contributors.
-
#crowdsourced? ⇒ Boolean
Has the data been crowdsourced?.
-
#data_title ⇒ String
The human-readable title of the dataset.
-
#description ⇒ String
A brief description of the dataset.
-
#distributions ⇒ Array<Distribution>
(also: #files, #resources)
A list of distributions.
-
#documentation_url ⇒ String
Human-readable documentation for the dataset.
-
#host ⇒ Symbol
Where the dataset is hosted.
-
#initialize(url_or_options) ⇒ Dataset
constructor
Create a new Dataset object.
-
#issued ⇒ Date
(also: #release_date)
Date the dataset was released.
-
#keywords ⇒ Array<string>
Keywords for the dataset.
-
#landing_page ⇒ String
A web page that can be used to gain access to the dataset, its distributions and/or additional information.
-
#language ⇒ String
The language of the dataset.
-
#licenses ⇒ Array<License>
A list of licenses.
-
#maintainers ⇒ Array<Agent>
A list of maintainers.
-
#modified ⇒ Date
Date the dataset was last modified.
-
#origin ⇒ Symbol
The origin type of the dataset.
-
#publishers ⇒ Array<Agent>
A list of publishers.
-
#publishing_format ⇒ Symbol
The publishing format for the dataset.
-
#release_type ⇒ Symbol
What type of dataset is this? Options are:
:web_servicefor API-accessible data, or:one_offfor downloadable data dumps. -
#rights ⇒ Object<Rights>
The rights statment for the data.
-
#sources ⇒ Array<Source>
Where the data is sourced from.
-
#spatial ⇒ GeoJSON Geometry
Spatial coverage of the dataset.
-
#supported? ⇒ Boolean
Can metadata be loaded for this Dataset?.
-
#temporal ⇒ Object<Temporal>
The temporal coverage of the dataset.
-
#theme ⇒ String
The main category the dataset belongs to.
-
#time_sensitive? ⇒ Boolean
Is the information time-sensitive?.
-
#update_frequency ⇒ String
How frequently the data is updated.
- #uri ⇒ Object
- #url ⇒ Object
Constructor Details
#new(url) ⇒ Dataset #new(options) ⇒ Dataset
Create a new Dataset object
The class will attempt to auto-load metadata from this URL.
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/data_kitten/dataset.rb', line 43 def initialize() url = case when Hash [:access_url] else end @access_url = DataKitten::Fetcher.wrap(url) detect_origin detect_host detect_publishing_format end |
Instance Attribute Details
#access_url ⇒ String
Returns the URL that gives access to the dataset.
30 31 32 |
# File 'lib/data_kitten/dataset.rb', line 30 def access_url @access_url end |
#identifier ⇒ String
A unique identifier of the dataset.
101 102 103 |
# File 'lib/data_kitten/dataset.rb', line 101 def identifier @identifier end |
#metadata ⇒ Object
Returns the value of attribute metadata.
284 285 286 |
# File 'lib/data_kitten/dataset.rb', line 284 def end |
#source ⇒ Object
65 66 67 |
# File 'lib/data_kitten/dataset.rb', line 65 def source @source ||= @access_url.as_json if @access_url.ok? end |
Instance Method Details
#change_history ⇒ Array
A history of changes to the Dataset
273 274 275 |
# File 'lib/data_kitten/dataset.rb', line 273 def change_history [] end |
#contributor_agreement_url ⇒ String
The URL of the contributor license agreement
250 251 252 |
# File 'lib/data_kitten/dataset.rb', line 250 def contributor_agreement_url nil end |
#contributors ⇒ Array<Agent>
A list of contributors
222 223 224 |
# File 'lib/data_kitten/dataset.rb', line 222 def contributors [] end |
#crowdsourced? ⇒ Boolean
Has the data been crowdsourced?
243 244 245 |
# File 'lib/data_kitten/dataset.rb', line 243 def crowdsourced? false end |
#data_title ⇒ String
The human-readable title of the dataset.
106 107 108 |
# File 'lib/data_kitten/dataset.rb', line 106 def data_title nil end |
#description ⇒ String
A brief description of the dataset
113 114 115 |
# File 'lib/data_kitten/dataset.rb', line 113 def description nil end |
#distributions ⇒ Array<Distribution> Also known as: files, resources
A list of distributions. Has aliases for popular alternative vocabularies.
257 258 259 |
# File 'lib/data_kitten/dataset.rb', line 257 def distributions [] end |
#documentation_url ⇒ String
Human-readable documentation for the dataset.
127 128 129 |
# File 'lib/data_kitten/dataset.rb', line 127 def documentation_url nil end |
#host ⇒ Symbol
Where the dataset is hosted.
93 94 95 |
# File 'lib/data_kitten/dataset.rb', line 93 def host nil end |
#issued ⇒ Date Also known as: release_date
Date the dataset was released
142 143 144 |
# File 'lib/data_kitten/dataset.rb', line 142 def issued nil end |
#keywords ⇒ Array<string>
Keywords for the dataset
120 121 122 |
# File 'lib/data_kitten/dataset.rb', line 120 def keywords [] end |
#landing_page ⇒ String
A web page that can be used to gain access to the dataset, its distributions and/or additional information.
157 158 159 |
# File 'lib/data_kitten/dataset.rb', line 157 def landing_page nil end |
#language ⇒ String
The language of the dataset.
229 230 231 |
# File 'lib/data_kitten/dataset.rb', line 229 def language nil end |
#licenses ⇒ Array<License>
A list of licenses
208 209 210 |
# File 'lib/data_kitten/dataset.rb', line 208 def licenses [] end |
#maintainers ⇒ Array<Agent>
A list of maintainers
194 195 196 |
# File 'lib/data_kitten/dataset.rb', line 194 def maintainers [] end |
#modified ⇒ Date
Date the dataset was last modified
150 151 152 |
# File 'lib/data_kitten/dataset.rb', line 150 def modified nil end |
#origin ⇒ Symbol
The origin type of the dataset.
84 85 86 |
# File 'lib/data_kitten/dataset.rb', line 84 def origin nil end |
#publishers ⇒ Array<Agent>
A list of publishers
201 202 203 |
# File 'lib/data_kitten/dataset.rb', line 201 def publishers [] end |
#publishing_format ⇒ Symbol
The publishing format for the dataset.
187 188 189 |
# File 'lib/data_kitten/dataset.rb', line 187 def publishing_format nil end |
#release_type ⇒ Symbol
What type of dataset is this? Options are: :web_service for API-accessible data, or :one_off for downloadable data dumps.
135 136 137 |
# File 'lib/data_kitten/dataset.rb', line 135 def release_type false end |
#rights ⇒ Object<Rights>
The rights statment for the data
215 216 217 |
# File 'lib/data_kitten/dataset.rb', line 215 def rights nil end |
#sources ⇒ Array<Source>
Where the data is sourced from
171 172 173 |
# File 'lib/data_kitten/dataset.rb', line 171 def sources [] end |
#spatial ⇒ GeoJSON Geometry
Spatial coverage of the dataset
280 281 282 |
# File 'lib/data_kitten/dataset.rb', line 280 def spatial nil end |
#supported? ⇒ Boolean
Can metadata be loaded for this Dataset?
75 76 77 |
# File 'lib/data_kitten/dataset.rb', line 75 def supported? !(origin.nil? || publishing_format.nil?) end |
#temporal ⇒ Object<Temporal>
The temporal coverage of the dataset
164 165 166 |
# File 'lib/data_kitten/dataset.rb', line 164 def temporal nil end |
#theme ⇒ String
The main category the dataset belongs to.
236 237 238 |
# File 'lib/data_kitten/dataset.rb', line 236 def theme nil end |
#time_sensitive? ⇒ Boolean
Is the information time-sensitive?
178 179 180 |
# File 'lib/data_kitten/dataset.rb', line 178 def time_sensitive? false end |
#update_frequency ⇒ String
How frequently the data is updated.
266 267 268 |
# File 'lib/data_kitten/dataset.rb', line 266 def update_frequency nil end |
#uri ⇒ Object
57 58 59 |
# File 'lib/data_kitten/dataset.rb', line 57 def uri URI(@access_url.to_s) end |
#url ⇒ Object
61 62 63 |
# File 'lib/data_kitten/dataset.rb', line 61 def url @access_url.to_s end |