Module: DataKitten::PublishingFormats::RDFa
- Included in:
- LinkedData
- Defined in:
- lib/data_kitten/publishing_formats/rdfa.rb
Instance Method Summary collapse
-
#contributors ⇒ Object
A list of contributors.
-
#data_title ⇒ Object
The human-readable title of the dataset.
-
#description ⇒ Object
A brief description of the dataset.
-
#distributions ⇒ Object
A list of distributions, referred to as
resources
by Datapackage. - #issued ⇒ Object
-
#keywords ⇒ Object
Keywords for the dataset.
-
#licenses ⇒ Object
A list of licenses.
-
#maintainers ⇒ Object
A list of maintainers.
- #modified ⇒ Object
-
#publishers ⇒ Object
A list of publishers.
-
#publishing_format ⇒ Symbol
The publishing format for the dataset.
-
#rights ⇒ Object
The rights statment for the data.
-
#sources ⇒ Object
Where the data is sourced from.
-
#update_frequency ⇒ Object
How frequently the data is updated.
Instance Method Details
#contributors ⇒ Object
A list of contributors.
104 105 106 |
# File 'lib/data_kitten/publishing_formats/rdfa.rb', line 104 def contributors [] end |
#data_title ⇒ Object
The human-readable title of the dataset.
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 |
#description ⇒ Object
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 |
#distributions ⇒ Object
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 |
#issued ⇒ Object
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 |
#keywords ⇒ Object
Keywords for the dataset
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 |
#licenses ⇒ Object
A list of licenses.
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 |
#maintainers ⇒ Object
A list of maintainers.
35 36 37 |
# File 'lib/data_kitten/publishing_formats/rdfa.rb', line 35 def maintainers [] end |
#modified ⇒ Object
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 |
#publishers ⇒ Object
A list of publishers.
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_format ⇒ Symbol
The publishing format for the dataset.
28 29 30 |
# File 'lib/data_kitten/publishing_formats/rdfa.rb', line 28 def publishing_format :rdfa end |
#rights ⇒ Object
The rights statment for the data
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 |
#sources ⇒ Object
Where the data is sourced from
155 156 157 |
# File 'lib/data_kitten/publishing_formats/rdfa.rb', line 155 def sources [] end |
#update_frequency ⇒ Object
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 |