Skip to content

Commit

Permalink
Finish 3.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Feb 8, 2022
2 parents ad71b66 + c0805e0 commit 28c9831
Show file tree
Hide file tree
Showing 32 changed files with 1,255 additions and 1,096 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/generate-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build & deploy documentation
on:
push:
branches:
- master
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
name: Update gh-pages with docs
steps:
- name: Clone repository
uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1"
- name: Install required gem dependencies
run: gem install yard --no-document
- name: Build YARD Ruby Documentation
run: yardoc
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./doc/yard
publish_branch: gh-pages
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Release 2.0.0

* Enumerables vs. Enumerators

- `RDF::Queryable#query` and `RDF::Query#execute` not return an enumerable, which may be an enumerator. Most internal uses return an Array now, which aides performance for small result sets, but potentially causes problems for large result sets. Implementations may still return an Enumerator, and Enumerators may be passed as arguments.
- `RDF::Queryable#query` and `RDF::Query#execute` did not return an enumerable, which may be an enumerator. Most internal uses return an Array now, which aides performance for small result sets, but potentially causes problems for large result sets. Implementations may still return an Enumerator, and Enumerators may be passed as arguments.
- `RDF::Enumerable#statements`, `#quads`, `#triples`, `#subjects`, `#predicates`, `#objects`, and `#contexts` now return an array rather than an Enumerator.

* The following vocabularies are deprecated and have been moved to the rdf-vocab gem.
Expand Down
74 changes: 37 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This is a pure-Ruby library for working with [Resource Description Framework
(RDF)][RDF] data.

* <https://ruby-rdf.github.com/rdf>
* <https://ruby-rdf.github.io/rdf>

[![Gem Version](https://badge.fury.io/rb/rdf.png)](https://badge.fury.io/rb/rdf)
[![Build Status](https://github.com/ruby-rdf/rdf/workflows/CI/badge.svg?branch=develop)](https://github.com/ruby-rdf/rdf/actions?query=workflow%3ACI)
Expand Down Expand Up @@ -141,11 +141,11 @@ or
### Reading RDF data in the [N-Triples][] format

require 'rdf/ntriples'
graph = RDF::Graph.load("https://ruby-rdf.github.com/rdf/etc/doap.nt")
graph = RDF::Graph.load("https://ruby-rdf.github.io/rdf/etc/doap.nt")

or

RDF::Reader.open("https://ruby-rdf.github.com/rdf/etc/doap.nt") do |reader|
RDF::Reader.open("https://ruby-rdf.github.io/rdf/etc/doap.nt") do |reader|
reader.each_statement do |statement|
puts statement.inspect
end
Expand All @@ -160,13 +160,13 @@ MimeType or file extension, where available.

require 'rdf/nquads'

graph = RDF::Graph.load("https://ruby-rdf.github.com/rdf/etc/doap.nq", format: :nquads)
graph = RDF::Graph.load("https://ruby-rdf.github.io/rdf/etc/doap.nq", format: :nquads)

A specific sub-type of Reader can also be invoked directly:

require 'rdf/nquads'

RDF::NQuads::Reader.open("https://ruby-rdf.github.com/rdf/etc/doap.nq") do |reader|
RDF::NQuads::Reader.open("https://ruby-rdf.github.io/rdf/etc/doap.nq") do |reader|
reader.each_statement do |statement|
puts statement.inspect
end
Expand Down Expand Up @@ -220,7 +220,7 @@ Note that no prefixes are loaded automatically, however they can be provided as

require 'rdf/ntriples'

graph = RDF::Graph.load("https://ruby-rdf.github.com/rdf/etc/doap.nt")
graph = RDF::Graph.load("https://ruby-rdf.github.io/rdf/etc/doap.nt")
query = RDF::Query.new({
person: {
RDF.type => FOAF.Person,
Expand Down Expand Up @@ -295,7 +295,7 @@ Readers support a boolean valued `rdfstar` option.

## Documentation

<https://rubydoc.info/github/ruby-rdf/rdf>
<https://ruby-rdf.github.io/rdf>

### RDF Object Model

Expand All @@ -309,7 +309,7 @@ Readers support a boolean valued `rdfstar` option.
* {RDF::Literal::Double}
* {RDF::Literal::Integer}
* {RDF::Literal::Time}
* [RDF::XSD](https://rubydoc.info/github/gkellogg/rdf-xsd) (extension)
* [RDF::XSD](https://ruby-rdf.github.io/rdf-xsd) (extension)
* {RDF::Resource}
* {RDF::Node}
* {RDF::URI}
Expand Down Expand Up @@ -371,10 +371,10 @@ from BNode identity (i.e., they each entail the other)
* {RDF::Mutable}
* {RDF::Durable}
* {RDF::Transaction}
* [RDF::AllegroGraph](https://rubydoc.info/github/ruby-rdf/rdf-agraph) (extension)
* [RDF::Mongo](https://rubydoc.info/github/ruby-rdf/rdf-mongo) (extension)
* [RDF::DataObjects](https://rubydoc.info/github/ruby-rdf/rdf-do) (extension)
* [RDF::Sesame](https://rubydoc.info/github/ruby-rdf/rdf-sesame) (extension)
* [RDF::AllegroGraph](https://ruby-rdf.github.io/rdf-agraph) (extension)
* [RDF::Mongo](https://ruby-rdf.github.io/rdf-mongo) (extension)
* [RDF::DataObjects](https://ruby-rdf.github.io/rdf-do) (extension)
* [RDF::Sesame](https://ruby-rdf.github.io/rdf-sesame) (extension)

### RDF Querying

Expand All @@ -384,7 +384,7 @@ from BNode identity (i.e., they each entail the other)
* {RDF::Query::Solution}
* {RDF::Query::Solutions}
* {RDF::Query::Variable}
* [SPARQL](https://rubydoc.info/github/ruby-rdf/sparql) (extension)
* [SPARQL](https://ruby-rdf.github.io/sparql) (extension)


### RDF Vocabularies
Expand Down Expand Up @@ -422,7 +422,7 @@ follows:

## Resources

* <https://rubydoc.info/github/ruby-rdf/rdf>
* <https://ruby-rdf.github.io/rdf>
* <https://github.com/ruby-rdf/rdf>
* <https://rubygems.org/gems/rdf>
* <https://www.ohloh.net/p/rdf>
Expand Down Expand Up @@ -486,33 +486,33 @@ see <https://unlicense.org/> or the accompanying {file:UNLICENSE} file.
[YARD]: https://yardoc.org/
[YARD-GS]: https://rubydoc.info/docs/yard/file/docs/GettingStarted.md
[PDD]: https://unlicense.org/#unlicensing-contributions
[JSONLD doc]: https://rubydoc.info/github/ruby-rdf/json-ld
[LinkedData doc]: https://rubydoc.info/github/ruby-rdf/linkeddata
[Microdata doc]: https://rubydoc.info/github/ruby-rdf/rdf-microdata
[N3 doc]: https://rubydoc.info/github/ruby-rdf/rdf-n3
[RDFa doc]: https://rubydoc.info/github/ruby-rdf/rdf-rdfa
[RDFXML doc]: https://rubydoc.info/github/ruby-rdf/rdf-rdfxml
[Turtle doc]: https://rubydoc.info/github/ruby-rdf/rdf-turtle
[SPARQL doc]: https://rubydoc.info/github/ruby-rdf/sparql
[JSONLD doc]: https://ruby-rdf.github.io/json-ld
[LinkedData doc]: https://ruby-rdf.github.io/linkeddata
[Microdata doc]: https://ruby-rdf.github.io/rdf-microdata
[N3 doc]: https://ruby-rdf.github.io/rdf-n3
[RDFa doc]: https://ruby-rdf.github.io/rdf-rdfa
[RDFXML doc]: https://ruby-rdf.github.io/rdf-rdfxml
[Turtle doc]: https://ruby-rdf.github.io/rdf-turtle
[SPARQL doc]: https://ruby-rdf.github.io/sparql
[RDF 1.0]: https://www.w3.org/TR/2004/REC-rdf-concepts-20040210/
[RDF 1.1]: https://www.w3.org/TR/rdf11-concepts/
[SPARQL 1.1]: https://www.w3.org/TR/sparql11-query/
[RDF.rb]: https://ruby-rdf.github.com/
[RDF::DO]: https://ruby-rdf.github.com/rdf-do
[RDF::Mongo]: https://ruby-rdf.github.com/rdf-mongo
[RDF::Sesame]: https://ruby-rdf.github.com/rdf-sesame
[RDF::JSON]: https://ruby-rdf.github.com/rdf-json
[RDF::Microdata]: https://ruby-rdf.github.com/rdf-microdata
[RDF::N3]: https://ruby-rdf.github.com/rdf-n3
[RDF::RDFa]: https://ruby-rdf.github.com/rdf-rdfa
[RDF::RDFXML]: https://ruby-rdf.github.com/rdf-rdfxml
[RDF::TriG]: https://ruby-rdf.github.com/rdf-trig
[RDF::TriX]: https://ruby-rdf.github.com/rdf-trix
[RDF::Turtle]: https://ruby-rdf.github.com/rdf-turtle
[RDF::Raptor]: https://ruby-rdf.github.com/rdf-raptor
[RDF.rb]: https://ruby-rdf.github.io/
[RDF::DO]: https://ruby-rdf.github.io/rdf-do
[RDF::Mongo]: https://ruby-rdf.github.io/rdf-mongo
[RDF::Sesame]: https://ruby-rdf.github.io/rdf-sesame
[RDF::JSON]: https://ruby-rdf.github.io/rdf-json
[RDF::Microdata]: https://ruby-rdf.github.io/rdf-microdata
[RDF::N3]: https://ruby-rdf.github.io/rdf-n3
[RDF::RDFa]: https://ruby-rdf.github.io/rdf-rdfa
[RDF::RDFXML]: https://ruby-rdf.github.io/rdf-rdfxml
[RDF::TriG]: https://ruby-rdf.github.io/rdf-trig
[RDF::TriX]: https://ruby-rdf.github.io/rdf-trix
[RDF::Turtle]: https://ruby-rdf.github.io/rdf-turtle
[RDF::Raptor]: https://ruby-rdf.github.io/rdf-raptor
[RDF*]: https://w3c.github.io/rdf-star/rdf-star-cg-spec.html
[LinkedData]: https://ruby-rdf.github.com/linkeddata
[JSON::LD]: https://ruby-rdf.github.com/json-ld
[LinkedData]: https://ruby-rdf.github.io/linkeddata
[JSON::LD]: https://ruby-rdf.github.io/json-ld
[RestClient]: https://rubygems.org/gems/rest-client
[RestClient Components]: https://rubygems.org/gems/rest-client-components
[Rack::Cache]: https://rtomayko.github.io/rack-cache/
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.3
3.2.4
9 changes: 9 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"
require "rdf"

require "irb"
require 'amazing_print'
IRB.start(__FILE__)
8 changes: 8 additions & 0 deletions examples/issue433/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

#ruby '2.7.5'

gem 'rdf', path: '../..'
gem 'byebug'
gem 'amazing_print'
7 changes: 7 additions & 0 deletions examples/issue433/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# rdf-issue

```
bundle install
bundle exec ruby test.rb
```
4 changes: 4 additions & 0 deletions examples/issue433/something/enumerator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Something
module Enumerator
end
end
7 changes: 7 additions & 0 deletions examples/issue433/test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'rdf'
require 'rdf/mixin/enumerable'
require 'rdf/model/list'
require './something/enumerator'
require 'enumerator'

puts "All OK!"
3 changes: 0 additions & 3 deletions lib/rdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
require 'rdf/version'
require 'rdf/extensions'

# When loading, issue deprecation warning on forthcoming unsupported versions of Ruby
warn "[DEPRECATION] Ruby 2.4+ required in next version 3.1 of RDF.rb" if RUBY_VERSION < "2.4"

module RDF
# RDF mixins
autoload :Countable, 'rdf/mixin/countable'
Expand Down
6 changes: 5 additions & 1 deletion lib/rdf/mixin/countable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ module RDF
##
# @since 0.2.0
module Countable
autoload :Enumerator, 'rdf/mixin/enumerator'
extend RDF::Util::Aliasing::LateBound

# Extends Enumerator with {Countable}, which is used by {Countable#enum_for}
class Enumerator < ::Enumerator
include RDF::Countable
end

##
# Returns `true` if `self` contains no RDF statements.
#
Expand Down
14 changes: 13 additions & 1 deletion lib/rdf/mixin/enumerable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,23 @@ module RDF
# @see RDF::Graph
# @see RDF::Repository
module Enumerable
autoload :Enumerator, 'rdf/mixin/enumerator'
extend RDF::Util::Aliasing::LateBound
include ::Enumerable
include RDF::Countable # NOTE: must come after ::Enumerable

# Extends Enumerator with {Queryable} and {Enumerable}, which is used by {Enumerable#each_statement} and {Queryable#enum_for}
class Enumerator < ::Enumerator
include RDF::Queryable
include RDF::Enumerable

##
# @return [Array]
# @note Make sure returned arrays are also queryable
def to_a
return super.to_a.extend(RDF::Queryable, RDF::Enumerable)
end
end

##
# Returns `true` if this enumerable supports the given `feature`.
#
Expand Down
40 changes: 0 additions & 40 deletions lib/rdf/mixin/enumerator.rb

This file was deleted.

14 changes: 13 additions & 1 deletion lib/rdf/mixin/queryable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,21 @@ module RDF
# @see RDF::Graph
# @see RDF::Repository
module Queryable
autoload :Enumerator, 'rdf/mixin/enumerator'
include ::Enumerable

# Extends Enumerator with {Queryable} and {Enumerable}, which is used by {Enumerable#each_statement} and {Queryable#enum_for}
class Enumerator < ::Enumerator
include RDF::Queryable
include RDF::Enumerable

##
# @return [Array]
# @note Make sure returned arrays are also queryable
def to_a
return super.to_a.extend(RDF::Queryable, RDF::Enumerable)
end
end

##
# Queries `self` for RDF statements matching the given `pattern`.
#
Expand Down
2 changes: 1 addition & 1 deletion lib/rdf/model/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ def <<(value)
# @return [Integer]
# @see http://ruby-doc.org/core-2.2.2/Array.html#method-i-3C-3D-3E
def eql?(other)
to_a.eql? other.to_a # TODO: optimize this
to_a.eql? Array(other)
end

##
Expand Down
4 changes: 3 additions & 1 deletion lib/rdf/model/statement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def self.from(statement, graph_name: nil, **options)
# @option options [RDF::Term] :graph_name (nil)
# Note, in RDF 1.1, a graph name MUST be an {Resource}.
# @option options [Boolean] :inferred used as a marker to record that this statement was inferred based on semantic relationships (T-Box).
# @option options [Boolean] :quoted used as a marker to record that this statement quoted and appears as the subject or object of another RDF::Statement.
# @return [RDF::Statement]
#
# @overload initialize(subject, predicate, object, **options)
Expand All @@ -83,6 +84,7 @@ def self.from(statement, graph_name: nil, **options)
# @option options [RDF::Term] :graph_name (nil)
# Note, in RDF 1.1, a graph name MUST be an {Resource}.
# @option options [Boolean] :inferred used as a marker to record that this statement was inferred based on semantic relationships (T-Box).
# @option options [Boolean] :quoted used as a marker to record that this statement quoted and appears as the subject or object of another RDF::Statement.
# @return [RDF::Statement]
def initialize(subject = nil, predicate = nil, object = nil, options = {})
if subject.is_a?(Hash)
Expand Down Expand Up @@ -209,7 +211,7 @@ def asserted?
##
# @return [Boolean]
def quoted?
false
!!@options[:quoted]
end

##
Expand Down
5 changes: 3 additions & 2 deletions lib/rdf/model/uri.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ class URI
).freeze

# Characters in a PName which must be escaped
PN_ESCAPE_CHARS = /[~\.\-!\$&'\(\)\*\+,;=\/\?\#@%_]/.freeze
PN_ESCAPES = /\\#{PN_ESCAPE_CHARS}/.freeze
# Note: not all reserved characters need to be escaped in SPARQL/Turtle, but they must be unescaped when encountered
PN_ESCAPE_CHARS = /[~\.!\$&'\(\)\*\+,;=\/\?\#@%]/.freeze
PN_ESCAPES = /\\#{Regexp.union(PN_ESCAPE_CHARS, /[\-_]/)}/.freeze

##
# Cache size may be set through {RDF.config} using `uri_cache_size`.
Expand Down
Loading

0 comments on commit 28c9831

Please sign in to comment.