Skip to content

Commit 9727d5d

Browse files
committed
Finish 3.2.2
2 parents 5a34e19 + e7c7433 commit 9727d5d

13 files changed

Lines changed: 1847 additions & 791 deletions

File tree

README.md

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ will limit the vocabularies which are returned from `RDF::Vocabulary.each`, whic
3838
* RDF::Vocab::DISCO - [DDI-RDF Discovery Vocabulary](http://rdf-vocabulary.ddialliance.org/discovery#) (DDI)
3939
* RDF::Vocab::DOAP - [Description of a Project (DOAP) vocabulary](https://github.com/edumbill/doap/wiki)
4040
* RDF::Vocab::DWC - [Darwin Core](http://rs.tdwg.org/dwc/terms/)
41-
* RDF::Vocab::EARL - [Evaluation and Report Language (EARL) 1.0 Schema](<http://www.w3.org/ns/earl#) (W3C)
41+
* RDF::Vocab::EARL - [Evaluation and Report Language (EARL) 1.0 Schema](http://www.w3.org/ns/earl#) (W3C)
4242
* RDF::Vocab::EBUCore - [EBUCore](http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#)
4343
* RDF::Vocab::EDM - [Europeana Data Model (EDM)](https://pro.europeana.eu/page/edm-documentation)
4444
* RDF::Vocab::EXIF - [Exif vocabulary workspace](http://www.w3.org/2003/12/exif/) (W3C)
@@ -119,14 +119,71 @@ Also adds the `gen-vocab` command to the `rdf` command-line executable to genera
119119

120120
## Adding new vocabularies
121121

122-
* First, add an entry to `lib/rdf/vocab.rb`, the key names contained within
123-
for guidance. For more information, see the documentation on
122+
Vocabularies should only be added to this gem if they are widely used. An equivalent process can be used to add a vocabulary to an arbitrary Ruby application or gem if it is more application specific.
123+
124+
New vocabularies should be generated via a pull request after cloning from GitHub. Be sure to use a custom branch name before creating the PR.
125+
126+
* First, add an entry to `lib/rdf/vocab.rb`, the key is used to identify the vocabulary, and as the default basis for the prefix label to use for the vocabulary. The key names of the object value come from the following:
127+
<dl>
128+
<dt>uri (required)</dt>
129+
<dd>The namespace URI for the vocabulary.</dd>
130+
<dt>module_name (default RDF::Vocab)</dt>
131+
<dd>The Ruby module in which the vocabulary class is created.</dd>
132+
<dt>class_name (default from uppercase of the vocabulary identity)</dt>
133+
<dd>The class name of the vocabulary</dd>
134+
<dt>source (default from uri)</dt>
135+
<dd>The source used to fetch the RDF vocabulary definition (most formats supported). Defaults to the vocabulary uri.</dd>
136+
<dt>strict (default false)</dt>
137+
<dd>Creates a _strict_ vocabulary, so that attempts to use undefined terms in the vocabulary namespace become errors.</dd>
138+
<dt>alias (Internal only)</dt>
139+
<dd>Indicates that this is an alias for a vocabulary defined directly in the RDF namespace.</dd>
140+
<dt>skip</dt>
141+
<dd>Do not process this vocabulary, typically when the vocabulary source is inaccessible.</dd>
142+
<dt>patch</dt>
143+
<dd>The value is taken as a string formatted as an <a href="http://www.w3.org/TR/ldpatch/">LD Patch</a> used to correct issues in the vocabulary source that may show up when the vocabulary is validated.</dd>
144+
<dt>extra</dt>
145+
<dd>Value is a JSON Object which is added to the resulting vocabulary definition.</dd>
146+
</dl>
147+
148+
For more information, see the documentation on
124149
[RDF::Vocabulary](https://ruby-rdf.github.io/rdf/RDF/Vocabulary).
125150
* Next, create an empty file in `lib/rdf/vocab` based on the key name for
126151
your vocabulary. For example, if you've added the vocabulary `:foo`, create a
127152
new empty file at `lib/rdf/vocab/foo.rb`.
153+
* Create an entry in the README to document the availability of the library within this gem.
128154
* Run `rake gen_vocabs`.
129155

156+
After the PR is merged, it will be available in the `develop` branch until the next library release.
157+
158+
### Example vocabulary definition
159+
160+
The following definition is for the EARL vocabulary, which uses the `patch` capability to address inherent problems in the vocabulary definition.
161+
162+
earl: {
163+
uri: "http://www.w3.org/ns/earl#",
164+
source: "http://www.w3.org/ns/earl",
165+
patch: %{
166+
@prefix earl: <http://www.w3.org/ns/earl#>.
167+
@prefix owl: <http://www.w3.org/2002/07/owl#>.
168+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
169+
170+
AddNew {
171+
# Extends EARL to talk about collections of assertions
172+
earl:Report a rdfs:Class, owl:Class ;
173+
rdfs:label "Report" ;
174+
rdfs:comment "A collection of earl:Assertion" .
175+
earl:assertion a owl:ObjectProperty, rdfs:Property ;
176+
rdfs:label "assertion" ;
177+
rdfs:comment "Test Assertions associated with an earl:Report or earl:TestCase" ;
178+
rdfs:domain [
179+
a owl:Class ;
180+
owl:unionOf (earl:Report earl:TestCase)
181+
] ;
182+
rdfs:range earl:Assertion .
183+
} .
184+
}
185+
}
186+
130187
## Authors
131188

132189
* [David Chandek-Stark](https://github.com/dchandekstark)
@@ -161,3 +218,4 @@ see <https://unlicense.org/> or the accompanying {file:LICENSE} file.
161218
[YARD]: https://yardoc.org/
162219
[YARD-GS]: https://rubydoc.info/docs/yard/file/docs/GettingStarted.md
163220
[PDD]: https://unlicense.org/#unlicensing-contributions
221+
[LD Patch]: http://www.w3.org/TR/ldpatch/

Rakefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ RDF::Vocab::VOCABS.each do |id, v|
4343
next if v[:alias] || v[:skip]
4444
file "lib/rdf/vocab/#{id}.rb" => :do_build do
4545
puts "Generate lib/rdf/vocab/#{id}.rb"
46-
%x{touch lib/rdf/vocab/#{id}.rb}
46+
touch "lib/rdf/vocab/#{id}.rb"
4747
cmd = "bundle exec rdf"
4848
if v[:patch]
4949
File.open("lib/rdf/vocab/#{id}.rb_p", "w") {|f| f.write v[:patch]}
@@ -59,11 +59,11 @@ RDF::Vocab::VOCABS.each do |id, v|
5959
cmd += " '" + v.fetch(:source, v[:uri]) + "'"
6060
puts " #{cmd}"
6161
begin
62-
%x{#{cmd} && sed 's/\r//g' lib/rdf/vocab/#{id}.rb_t > lib/rdf/vocab/#{id}.rb}
62+
%x{#{cmd} && ruby -pe 'gsub(/\r/,"")' lib/rdf/vocab/#{id}.rb_t > lib/rdf/vocab/#{id}.rb}
6363
rescue
6464
puts "Failed to load #{id}: #{$!.message}"
6565
ensure
66-
%x{rm -f lib/rdf/vocab/#{id}.rb_t lib/rdf/vocab/#{id}.rb_p}
66+
rm_f ["lib/rdf/vocab/#{id}.rb_t", "lib/rdf/vocab/#{id}.rb_p"]
6767
end
6868
end
6969
end

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.2.1
1+
3.2.2

lib/rdf/vocab/dbo.rb

Lines changed: 440 additions & 70 deletions
Large diffs are not rendered by default.

lib/rdf/vocab/identifiers.rb

Lines changed: 337 additions & 65 deletions
Large diffs are not rendered by default.

lib/rdf/vocab/marcrelators.rb

Lines changed: 28 additions & 8 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)