Module: DataKitten::PublishingFormats::RDFa

Included in:
LinkedData
Defined in:
lib/data_kitten/publishing_formats/rdfa.rb

Instance Method Summary collapse

Instance Method Details

#contributorsObject

A list of contributors.



104
105
106
# File 'lib/data_kitten/publishing_formats/rdfa.rb', line 104

def contributors
  []
end

#data_titleObject

The human-readable title of the dataset.

See Also:



129
130
131
# File 'lib/data_kitten/publishing_formats/rdfa.rb', line 129

def data_title
  [dataset_uri][dct.title.to_s][0] rescue nil
end

#descriptionObject

A brief description of the dataset



136
137
138
# File 'lib/data_kitten/publishing_formats/rdfa.rb', line 136

def description
  [dataset_uri][dct.description.to_s][0] rescue nil
end

#distributionsObject

A list of distributions, referred to as resources by Datapackage.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/data_kitten/publishing_formats/rdfa.rb', line 111

def distributions
  distributions = []
  uris = [dataset_uri][dcat.distribution.to_s]
  uris.each do |distribution_uri|
    distribution = {
      :title => first_value( distribution_uri, RDF::DC.title ),
      :accessURL => first_value( distribution_uri, dcat.accessURL )
    }
    distributions << Distribution.new(self, dcat_resource: distribution)
  end
  return distributions
rescue
  []
end

#issuedObject



166
167
168
169
170
171
172
173
# File 'lib/data_kitten/publishing_formats/rdfa.rb', line 166

def issued
  date = first_value(dataset_uri, RDF::DC.issued) || 
         first_value(dataset_uri, RDF::DC.created)
  if date
      return Date.parse( date )
  end
  return nil
end

#keywordsObject

Keywords for the dataset

See Also:



143
144
145
146
147
148
149
150
# File 'lib/data_kitten/publishing_formats/rdfa.rb', line 143

def keywords
  keywords = []
  [dataset_uri][dcat.keyword.to_s].each do |k|
    keywords << k
  end
rescue
  []
end

#licensesObject

A list of licenses.

See Also:



86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/data_kitten/publishing_formats/rdfa.rb', line 86

def licenses
  licenses = []
  uris = [dataset_uri][RDF::DC.license.to_s]
  if uris.nil?
    []
  else
    uris.each do |license_uri|
      licenses << License.new(:uri => license_uri, :name => first_value( license_uri, RDF::DC.title ))
    end
    return licenses
  end
rescue => e
  []
end

#maintainersObject

A list of maintainers.



35
36
37
# File 'lib/data_kitten/publishing_formats/rdfa.rb', line 35

def maintainers
  []
end

#modifiedObject



175
176
177
178
179
180
181
# File 'lib/data_kitten/publishing_formats/rdfa.rb', line 175

def modified
  date = first_value(dataset_uri, RDF::DC.modified)
  if date
      return Date.parse( date )
  end
  return nil
end

#publishersObject

A list of publishers.

See Also:



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/data_kitten/publishing_formats/rdfa.rb', line 42

def publishers
  publishers = []
  uris = [dataset_uri][RDF::DC.publisher.to_s]
  uris.each do |publisher_uri|
    publishers << Agent.new(:name => first_value( publisher_uri, RDF::FOAF.name ), 
                            :homepage => first_value( publisher_uri, RDF::FOAF.homepage ), 
                            :mbox => first_value( publisher_uri, RDF::FOAF.mbox ))
  end
  return publishers
rescue
  []    
end

#publishing_formatSymbol

The publishing format for the dataset.

Returns:

  • (Symbol)

    :rdfa

See Also:



28
29
30
# File 'lib/data_kitten/publishing_formats/rdfa.rb', line 28

def publishing_format
  :rdfa
end

#rightsObject

The rights statment for the data

See Also:



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/data_kitten/publishing_formats/rdfa.rb', line 58

def rights
  rights_uri = [dataset_uri][RDF::DC.rights.to_s][0]
  if ![rights_uri]
      return Rights.new(:uri => rights_uri)
  else
    return Rights.new(:uri => uri, 
                        :dataLicense => first_value( rights_uri, odrs.dataLicense ), 
                        :contentLicense => first_value( rights_uri, odrs.contentLicense ), 
                        :copyrightNotice => first_value( rights_uri, odrs.copyrightNotice ), 
                        :attributionURL => first_value( rights_uri, odrs.attributionURL ),
                        :attributionText => first_value( rights_uri, odrs.attributionText ),
                        :copyrightHolder => first_value( rights_uri, odrs.copyrightHolder ),
                        :databaseRightHolder => first_value( rights_uri, odrs.databaseRightHolder ),
                        :copyrightYear => first_value( rights_uri, odrs.copyrightYear ),
                        :databaseRightYear => first_value( rights_uri, odrs.databaseRightYear ),
                        :copyrightStatement => first_value( rights_uri, odrs.copyrightStatement ),
                        :databaseRightStatement => first_value( rights_uri, odrs.databaseRightStatement )
                        )
  end
rescue => e
  #puts e
  #puts e.backtrace
  nil
end

#sourcesObject

Where the data is sourced from

See Also:



155
156
157
# File 'lib/data_kitten/publishing_formats/rdfa.rb', line 155

def sources
  []
end

#update_frequencyObject

How frequently the data is updated.



162
163
164
# File 'lib/data_kitten/publishing_formats/rdfa.rb', line 162

def update_frequency
  first_value( dataset_uri, dcat.accrualPeriodicity )
end