Module: Sumi::Graphics::Mixtures::RDF
- Defined in:
- graphics/lib/sumi/graphics/mixtures/rdf.rb
Overview
DSL helpers for RDF and license metadata.
Instance Method Summary collapse
-
#License(**kwargs) { ... } ⇒ Sumi::Graphics::Element
Adds RDF license metadata inside a metadata element.
-
#License_CC0(**kwargs) { ... } ⇒ Sumi::Graphics::Element
Adds Creative Commons Zero metadata.
-
#License_CC_BY(**kwargs) { ... } ⇒ Sumi::Graphics::Element
Adds Creative Commons BY license metadata.
-
#License_CC_BY_NC(**kwargs) { ... } ⇒ Sumi::Graphics::Element
Adds Creative Commons BY-NC license metadata.
-
#License_CC_BY_NC_ND(**kwargs) { ... } ⇒ Sumi::Graphics::Element
Adds Creative Commons BY-NC-ND license metadata.
-
#License_CC_BY_NC_SA(**kwargs) { ... } ⇒ Sumi::Graphics::Element
Adds Creative Commons BY-NC-SA license metadata.
-
#License_CC_BY_ND(**kwargs) { ... } ⇒ Sumi::Graphics::Element
Adds Creative Commons BY-ND license metadata.
-
#License_CC_BY_SA(**kwargs) { ... } ⇒ Sumi::Graphics::Element
Adds Creative Commons BY-SA license metadata.
-
#License_LAL(**kwargs) { ... } ⇒ Sumi::Graphics::Element
Adds Free Art License metadata.
-
#RDF(**kwargs) { ... } ⇒ Sumi::Graphics::Element
Builds an RDF root element.
-
#RDFWork(**kwargs) { ... } ⇒ Sumi::Graphics::Element
Builds a Creative Commons RDF Work element.
Instance Method Details
#License(**kwargs) { ... } ⇒ Sumi::Graphics::Element
Adds RDF license metadata inside a metadata element.
52 53 54 55 56 |
# File 'graphics/lib/sumi/graphics/mixtures/rdf.rb', line 52 def License(**kwargs, &block) Work.validate!(kwargs, label: "license") { RDFWork(**kwargs, &block) } end |
#License_CC0(**kwargs) { ... } ⇒ Sumi::Graphics::Element
Adds Creative Commons Zero metadata.
131 132 133 |
# File 'graphics/lib/sumi/graphics/mixtures/rdf.rb', line 131 def License_CC0(**kwargs, &block) License(**kwargs, license: "https://creativecommons.org/publicdomain/zero/1.0/", &block) end |
#License_CC_BY(**kwargs) { ... } ⇒ Sumi::Graphics::Element
Adds Creative Commons BY license metadata.
65 66 67 |
# File 'graphics/lib/sumi/graphics/mixtures/rdf.rb', line 65 def License_CC_BY(**kwargs, &block) License(**kwargs, license: "https://creativecommons.org/licenses/by/4.0/", &block) end |
#License_CC_BY_NC(**kwargs) { ... } ⇒ Sumi::Graphics::Element
Adds Creative Commons BY-NC license metadata.
87 88 89 |
# File 'graphics/lib/sumi/graphics/mixtures/rdf.rb', line 87 def License_CC_BY_NC(**kwargs, &block) License(**kwargs, license: "https://creativecommons.org/licenses/by-nc/4.0/", &block) end |
#License_CC_BY_NC_ND(**kwargs) { ... } ⇒ Sumi::Graphics::Element
Adds Creative Commons BY-NC-ND license metadata.
120 121 122 |
# File 'graphics/lib/sumi/graphics/mixtures/rdf.rb', line 120 def License_CC_BY_NC_ND(**kwargs, &block) License(**kwargs, license: "https://creativecommons.org/licenses/by-nc-nd/4.0/", &block) end |
#License_CC_BY_NC_SA(**kwargs) { ... } ⇒ Sumi::Graphics::Element
Adds Creative Commons BY-NC-SA license metadata.
98 99 100 |
# File 'graphics/lib/sumi/graphics/mixtures/rdf.rb', line 98 def License_CC_BY_NC_SA(**kwargs, &block) License(**kwargs, license: "https://creativecommons.org/licenses/by-nc-sa/4.0/", &block) end |
#License_CC_BY_ND(**kwargs) { ... } ⇒ Sumi::Graphics::Element
Adds Creative Commons BY-ND license metadata.
109 110 111 |
# File 'graphics/lib/sumi/graphics/mixtures/rdf.rb', line 109 def License_CC_BY_ND(**kwargs, &block) License(**kwargs, license: "https://creativecommons.org/licenses/by-nd/4.0/", &block) end |
#License_CC_BY_SA(**kwargs) { ... } ⇒ Sumi::Graphics::Element
Adds Creative Commons BY-SA license metadata.
76 77 78 |
# File 'graphics/lib/sumi/graphics/mixtures/rdf.rb', line 76 def License_CC_BY_SA(**kwargs, &block) License(**kwargs, license: "https://creativecommons.org/licenses/by-sa/4.0/", &block) end |
#License_LAL(**kwargs) { ... } ⇒ Sumi::Graphics::Element
Adds Free Art License metadata.
142 |
# File 'graphics/lib/sumi/graphics/mixtures/rdf.rb', line 142 def License_LAL(**kwargs, &block) = License(**kwargs, license: "https://artlibre.org/licence/lal/en/", &block) |
#RDF(**kwargs) { ... } ⇒ Sumi::Graphics::Element
Builds an RDF root element.
151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'graphics/lib/sumi/graphics/mixtures/rdf.rb', line 151 def RDF(**kwargs, &block) ArgumentError.("Unknown RDF options: #{kwargs.keys.join(", ")}") unless kwargs.empty? ArgumentError.("Block required") unless block Element( :"rdf:RDF", "xmlns:rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "xmlns:dc": "http://purl.org/dc/elements/1.1/", "xmlns:cc": "http://creativecommons.org/ns#" ) do Within(&block) end end |
#RDFWork(**kwargs) { ... } ⇒ Sumi::Graphics::Element
Builds a Creative Commons RDF Work element.
| Option | RDF element |
|---|---|
title |
dc:title |
description |
dc:description |
creator |
dc:creator |
publisher |
dc:publisher |
date |
dc:date |
language |
dc:language |
license |
cc:license resource |
rights |
dc:rights |
190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'graphics/lib/sumi/graphics/mixtures/rdf.rb', line 190 def RDFWork(**kwargs, &block) Work.validate!(kwargs, label: "RDF work") RDF do Element(:"cc:Work", "rdf:about": "") do Element(:"dc:format", "image/svg+xml") Element(:"dc:type", "rdf:resource": "http://purl.org/dc/dcmitype/StillImage") Work.populate(self, kwargs) Within(&block) if block end end end |