Skip to content

Commit

Permalink
Finish 2.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Dec 8, 2019
2 parents e4b3377 + cd6e065 commit 8ea4095
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 37 deletions.
11 changes: 9 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
language: ruby
bundler_args: --without debug
script: "bundle exec rspec spec"
before_install:
- 'gem update --system --conservative || (gem i "rubygems-update:~>2.7" --no-document && update_rubygems)'
- 'gem update bundler --conservative'
env:
- CI=true
global:
- CI=true
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
rvm:
- 2.2
- 2.2.2
- 2.3
- 2.4
- 2.5
- 2.6
- jruby-9
- rbx-3
cache: bundler
Expand Down
9 changes: 2 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ gem 'rdf', github: "ruby-rdf/rdf", branch: "develop"
gem 'rdf-xsd', github: "ruby-rdf/rdf-xsd", branch: "develop"

group :development do
#gem 'linkeddata', github: "ruby-rdf/linkeddata", branch: "develop"
gem 'ebnf', github: "gkellogg/ebnf", branch: "develop"
gem 'linkeddata', github: "ruby-rdf/linkeddata", branch: "develop"
gem 'ebnf', github: "dryruby/ebnf", branch: "develop"
gem 'json-ld', github: "ruby-rdf/json-ld", branch: "develop"
gem 'rdf-aggregate-repo', github: "ruby-rdf/rdf-aggregate-repo", branch: "develop"
gem 'rdf-isomorphic', github: "ruby-rdf/rdf-isomorphic", branch: "develop"
Expand All @@ -27,8 +27,3 @@ group :development, :test do
gem 'coveralls', require: false
gem 'psych', platforms: [:mri, :rbx]
end

platforms :rbx do
gem 'rubysl', '~> 2.0'
gem 'rubinius', '~> 2.0'
end
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ Example usage:
rdf serialize https://raw.githubusercontent.com/ruby-rdf/rdf-tabular/develop/etc/doap.csv \
--output-format ttl
rdf tabular-json --input-format tabular https://raw.githubusercontent.com/ruby-rdf/rdf-tabular/develop/etc/doap.csv
rdf validate https://raw.githubusercontent.com/ruby-rdf/rdf-tabular/develop/etc/doap.csv
rdf validate https://raw.githubusercontent.com/ruby-rdf/rdf-tabular/develop/etc/doap.csv --validate

Note that the `--validate` option must be used with the `validate` (or other) command to detect parse-time errors in addition to validating any resulting RDF triples.

## RDF Reader
RDF::Tabular also acts as a normal RDF reader, using the standard RDF.rb Reader interface:
Expand All @@ -266,8 +268,8 @@ Full documentation available on [RubyDoc](http://rubydoc.info/gems/rdf-tabular/f

## Dependencies
* [Ruby](http://ruby-lang.org/) (>= 2.2.2)
* [RDF.rb](http://rubygems.org/gems/rdf) (>= 2.0)
* [JSON](https://rubygems.org/gems/json) (>= 1.5)
* [RDF.rb](http://rubygems.org/gems/rdf) (~> 3.0)
* [JSON](https://rubygems.org/gems/json) (>= 2.0)

## Installation
The recommended installation method is via [RubyGems](http://rubygems.org/).
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.1
2.2.2
3 changes: 3 additions & 0 deletions examples/issue-9/all_contents.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MS_ID,item
111,222
888,999
39 changes: 39 additions & 0 deletions examples/issue-9/all_contents.csv-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"@context": "http://www.w3.org/ns/csvw",
"tables": [
{
"url": "all_contents.csv",
"tableSchema": {
"aboutUrl": "{_row}",
"primaryKey": [
"MS_ID",
"item"
],
"columns": [
{"name": "MS_ID", "titles": "MS_ID"},
{"name": "item", "titles": "item"}
],
"foreignKeys": [
{
"columnReference": "MS_ID",
"reference": {
"resource": "all_manuscripts.csv",
"columnReference": "MS_ID"
}
}
]
}
},
{
"url": "all_manuscripts.csv",
"tableSchema": {
"aboutUrl": "{_row}",
"primaryKey": "MS_ID",
"columns": [
{"name": "MS_ID", "titles": "MS_ID"},
{"name": "man", "titles": "man"}
]
}
}
]
}
3 changes: 3 additions & 0 deletions examples/issue-9/all_manuscripts.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MS_ID,man
111,333
555,666
14 changes: 7 additions & 7 deletions lib/rdf/tabular/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ def validate!
end

##
# Validate metadata, raising an error containing all errors detected during validation
# Validate metadata and content, raising an error containing all errors detected during validation
# @raise [Error] Raise error if metadata has any unexpected properties
# @return [self]
def validate
Expand Down Expand Up @@ -1042,7 +1042,7 @@ def verify_compatible!(other)
if !ca.object.has_key?(:name) && !cb.object.has_key?(:name) && ta.empty? && tb.empty?
true
elsif ca.object.has_key?(:name) && cb.object.has_key?(:name)
raise Error, "Columns don't match on name: #{ca.name}, #{cb.name}" unless ca.name == cb.name
raise Error, "Column #{index + 1} doesn't match on name: #{ca.name || 'no name'}, #{cb.name || 'no name'}" unless ca.name == cb.name
elsif @options[:validate] || !ta.empty? && !tb.empty?
# If validating, column compatibility requires strict match between titles
titles_match = case
Expand All @@ -1066,10 +1066,10 @@ def verify_compatible!(other)
true
elsif !@options[:validate]
# If not validating, columns don't match, but processing continues
log_warn "Columns don't match on titles: #{ca.titles.inspect} vs #{cb.titles.inspect}"
log_warn "Column #{index + 1} doesn't match on titles: #{Array(ta['und']).join(',').inspect} vs #{Array(tb['und']).join(',').inspect}"
true
else
raise Error, "Columns don't match on titles: #{ca.titles.inspect} vs #{cb.titles.inspect}"
raise Error, "Column #{index + 1} doesn't match on titles: #{Array(ta['und']).join(',').inspect} vs #{Array(tb['und']).join(',').inspect}"
end
end
index += 1
Expand Down Expand Up @@ -1826,7 +1826,7 @@ def embedded_metadata(input, metadata, options = {})
row.xpath('th').map(&:content).each_with_index do |value, index|
# Skip columns
skipCols = skipColumns.to_i
next if index < skipCols
next if index < skipCols || value.to_s.empty?

# Trim value
value.lstrip! if %w(true start).include?(trim.to_s)
Expand All @@ -1837,7 +1837,7 @@ def embedded_metadata(input, metadata, options = {})
column = columns[index - skipCols] ||= {
"titles" => {lang => []},
}
column["titles"][lang] << value
column["titles"][lang] << value if value
end
end
else
Expand All @@ -1858,7 +1858,7 @@ def embedded_metadata(input, metadata, options = {})
Array(row_data).each_with_index do |value, index|
# Skip columns
skipCols = skipColumns.to_i
next if index < skipCols
next if index < skipCols || value.to_s.empty?

# Trim value
value.lstrip! if %w(true start).include?(trim.to_s)
Expand Down
26 changes: 9 additions & 17 deletions rdf-tabular.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,25 @@ Gem::Specification.new do |gem|
gem.require_paths = %w(lib)
gem.extensions = %w()
gem.test_files = Dir.glob('spec/*.rb') + Dir.glob('spec/data/**')
gem.has_rdoc = false

gem.required_ruby_version = '>= 2.2.2'
gem.requirements = []
gem.add_runtime_dependency 'bcp47', '~> 0.3', '>= 0.3.3'
#gem.add_runtime_dependency 'rdf', '~> 3.0'
#gem.add_runtime_dependency 'rdf-vocab', '~> 3.0'
#gem.add_runtime_dependency 'rdf-xsd', '~> 3.0'
gem.add_runtime_dependency 'rdf', '~> 3.0'
gem.add_runtime_dependency 'rdf-vocab', '~> 3.0'
gem.add_runtime_dependency 'rdf-xsd', '~> 3.0'
#gem.add_runtime_dependency 'json-ld', '~> 3.0'
gem.add_runtime_dependency 'rdf', '>= 2.2', '< 4.0'
gem.add_runtime_dependency 'rdf-vocab', '>= 2.2', '< 4.0'
gem.add_runtime_dependency 'rdf-xsd', '>= 2.2', '< 4.0'
gem.add_runtime_dependency 'json-ld', '>= 2.1', '< 4.0'
gem.add_runtime_dependency 'addressable', '~> 2.3'
gem.add_development_dependency 'nokogiri', '~> 1.6'
gem.add_development_dependency 'nokogiri', '~> 1.8'
gem.add_development_dependency 'rspec', '~> 3.7'
gem.add_development_dependency 'rspec-its', '~> 1.2'
#gem.add_development_dependency 'rdf-isomorphic', '~> 3.0'
#gem.add_development_dependency 'rdf-spec', '~> 3.0'
#gem.add_development_dependency 'rdf-turtle', '~> 3.0'
#gem.add_development_dependency 'sparql', '~> 3.0'
gem.add_development_dependency 'rdf-isomorphic', '>= 2.2', '< 4.0'
gem.add_development_dependency 'rdf-spec', '>= 2.2', '< 4.0'
gem.add_development_dependency 'rdf-turtle', '>= 2.2', '< 4.0'
gem.add_development_dependency 'sparql', '>= 2.2', '< 4.0'
gem.add_development_dependency 'rdf-isomorphic', '~> 3.0'
gem.add_development_dependency 'rdf-spec', '~> 3.0'
gem.add_development_dependency 'rdf-turtle', '~> 3.0'
gem.add_development_dependency 'sparql', '~> 3.0'
gem.add_development_dependency 'webmock', '~> 3.0'
gem.add_development_dependency 'yard' , '~> 0.9'
gem.add_development_dependency 'yard' , '~> 0.9.12'

gem.post_install_message = nil
end

0 comments on commit 8ea4095

Please sign in to comment.