From b8db418fa0e05db506754f457935bae73ce55a94 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Wed, 19 Jan 2022 11:16:01 -0800 Subject: [PATCH 1/4] If `Refinement#import_methods` is defined, use it in refinements instead of `#include`. --- .github/workflows/ci.yml | 2 +- lib/rdf/n3/refinements.rb | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e589480..9991f94 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: ruby: - 2.6 - 2.7 - - 3.0 + - "3.0" - 3.1 - ruby-head - jruby diff --git a/lib/rdf/n3/refinements.rb b/lib/rdf/n3/refinements.rb index c8d6112..a2d2338 100644 --- a/lib/rdf/n3/refinements.rb +++ b/lib/rdf/n3/refinements.rb @@ -173,6 +173,11 @@ def evaluate(bindings, formulae:, **options) refine ::RDF::Graph do # Allow a graph to be treated as a term in a statement. - include ::RDF::Term + if respond_to?(:import_methods) + # Refinement#include deprecated in Ruby 3.2 + import_methods ::RDF::Term + else + include ::RDF::Term + end end end From 35beed9f3dbc7caba43a718002d84beb7e79d653 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Wed, 19 Jan 2022 11:32:38 -0800 Subject: [PATCH 2/4] Instead of trying to use `#import_methods`, just define a couple of methods from `RDF::Term`. --- lib/rdf/n3/refinements.rb | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/lib/rdf/n3/refinements.rb b/lib/rdf/n3/refinements.rb index a2d2338..6602b5b 100644 --- a/lib/rdf/n3/refinements.rb +++ b/lib/rdf/n3/refinements.rb @@ -173,11 +173,32 @@ def evaluate(bindings, formulae:, **options) refine ::RDF::Graph do # Allow a graph to be treated as a term in a statement. - if respond_to?(:import_methods) - # Refinement#include deprecated in Ruby 3.2 - import_methods ::RDF::Term - else - include ::RDF::Term + + ## + # @overload term? + # Returns `true` if `self` is a {RDF::Term}. + # + # @return [Boolean] + # @overload term?(name) + # Returns `true` if `self` contains the given RDF subject term. + # + # @param [RDF::Resource] value + # @return [Boolean] + def term?(*args) + case args.length + when 0 then true + when 1 then false + else raise ArgumentError("wrong number of arguments (given #{args.length}, expected 0 or 1)") + end + end + + ## + # Returns itself. + # + # @return [RDF::Value] + def to_term + statements.map(&:terms) + self end end end From 6fd79d0df88b2ea99a6d85146b60d2589f002ea8 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Thu, 27 Jan 2022 15:50:13 -0800 Subject: [PATCH 3/4] Update documentation links to use gh-pages, and add action to publish gh-pages from Yard docs. --- .github/workflows/generate-docs.yml | 27 +++++++++++++++++++++++++ README.md | 14 ++++++------- lib/rdf/n3.rb | 2 +- lib/rdf/n3/algebra/str/concatenation.rb | 2 +- lib/rdf/n3/reader.rb | 2 +- lib/rdf/n3/writer.rb | 2 +- rdf-n3.gemspec | 9 ++++++++- 7 files changed, 46 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/generate-docs.yml diff --git a/.github/workflows/generate-docs.yml b/.github/workflows/generate-docs.yml new file mode 100644 index 0000000..b8d16ed --- /dev/null +++ b/.github/workflows/generate-docs.yml @@ -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 diff --git a/README.md b/README.md index cf45097..e117b32 100644 --- a/README.md +++ b/README.md @@ -200,7 +200,7 @@ Blank nodes associated with rdf:List statements used as part of a built-in are m * [SXP][SXP gem] (~> 1.2) ## Documentation -Full documentation available on [RubyDoc.info](https://rubydoc.info/github/ruby-rdf/rdf-n3) +Full documentation available on [RubyDoc.info](https://ruby-rdf.github.io/rdf-n3) ### Principle Classes * {RDF::N3} @@ -220,7 +220,7 @@ Full documentation available on [RubyDoc.info](https://rubydoc.info/github/ruby- ## Resources * [RDF.rb][RDF.rb] * [Distiller](http://rdf.greggkellogg.net/distiller) -* [Documentation](https://rubydoc.info/github/ruby-rdf/rdf-n3/) +* [Documentation](https://ruby-rdf.github.io/rdf-n3/) * [History](file:file.History.html) * [Notation-3][N3] * [Team Submission][] @@ -262,7 +262,7 @@ see or the accompanying {file:UNLICENSE} file. * * -[RDF::Turtle]: https://ruby-rdf.github.com/rdf-turtle/ +[RDF::Turtle]: https://ruby-rdf.github.io/rdf-turtle/ [Design Issues]: https://www.w3.org/DesignIssues/Notation3.html "Notation-3 Design Issues" [Team Submission]: https://www.w3.org/TeamSubmission/n3/ [Turtle]: https://www.w3.org/TR/turtle/ @@ -274,7 +274,7 @@ see or the accompanying {file:UNLICENSE} file. [W3C N3 Community Group]: https://www.w3.org/community/n3-dev/ [N3]: https://w3c.github.io/N3/spec/ [PEG]: https://en.wikipedia.org/wiki/Parsing_expression_grammar -[RDF.rb]: https://ruby-rdf.github.com/rdf -[EBNF gem]: https://ruby-rdf.github.com/ebnf -[SPARQL gem]: https://ruby-rdf.github.com/sparql -[SXP gem]: https://ruby-rdf.github.com/sxp +[RDF.rb]: https://ruby-rdf.github.io/rdf +[EBNF gem]: https://ruby-rdf.github.io/ebnf +[SPARQL gem]: https://ruby-rdf.github.io/sparql +[SXP gem]: https://ruby-rdf.github.io/sxp diff --git a/lib/rdf/n3.rb b/lib/rdf/n3.rb index b8ccbe4..7a07f43 100644 --- a/lib/rdf/n3.rb +++ b/lib/rdf/n3.rb @@ -14,7 +14,7 @@ module RDF # end # end # - # @see http://www.rubydoc.info/github/ruby-rdf/rdf/ + # @see https://ruby-rdf.github.io/rdf/ # @see https://www.w3.org/TR/REC-rdf-syntax/ # # @author [Gregg Kellogg](http://greggkellogg.net/) diff --git a/lib/rdf/n3/algebra/str/concatenation.rb b/lib/rdf/n3/algebra/str/concatenation.rb index 8f37f91..52f1da0 100644 --- a/lib/rdf/n3/algebra/str/concatenation.rb +++ b/lib/rdf/n3/algebra/str/concatenation.rb @@ -11,7 +11,7 @@ class Concatenation < RDF::N3::Algebra::ListOperator ## # The string:concatenation operator takes a list of terms cast to strings and either binds the result of concatenating them to the output variable, removes a solution that does equal the literal object. # - # List entries are stringified using {SPARQL::Algebra::Expression.cast}. + # List entries are stringified using [SPARQL::Algebra::Expression.cast](https://ruby-rdf.github.io/sparql/SPARQL/Algebra/Expression#cast-class_method). # # @param [RDF::N3::List] list # @return [RDF::Term] diff --git a/lib/rdf/n3/reader.rb b/lib/rdf/n3/reader.rb index 483a3a0..ddd3d48 100644 --- a/lib/rdf/n3/reader.rb +++ b/lib/rdf/n3/reader.rb @@ -46,7 +46,7 @@ class Reader < RDF::Reader ## # N3 Reader options - # @see http://www.rubydoc.info/github/ruby-rdf/rdf/RDF/Reader#options-class_method + # @see https://ruby-rdf.github.io/rdf/RDF/Reader#options-class_method def self.options super + [ RDF::CLI::Option.new( diff --git a/lib/rdf/n3/writer.rb b/lib/rdf/n3/writer.rb index 94a7132..ea56912 100644 --- a/lib/rdf/n3/writer.rb +++ b/lib/rdf/n3/writer.rb @@ -63,7 +63,7 @@ class Writer < RDF::Writer ## # N3 Writer options - # @see http://www.rubydoc.info/github/ruby-rdf/rdf/RDF/Writer#options-class_method + # @see https://ruby-rdf.github.io/rdf/RDF/Writer#options-class_method def self.options super + [ RDF::CLI::Option.new( diff --git a/rdf-n3.gemspec b/rdf-n3.gemspec index bc8feb7..5eb93d8 100755 --- a/rdf-n3.gemspec +++ b/rdf-n3.gemspec @@ -6,10 +6,17 @@ Gem::Specification.new do |gem| gem.date = File.mtime('VERSION').strftime('%Y-%m-%d') gem.name = %q{rdf-n3} - gem.homepage = %q{https://ruby-rdf.github.com/rdf-n3} + gem.homepage = %q{https://ruby-rdf.github.io/rdf-n3} gem.license = 'Unlicense' gem.summary = %q{Notation3 reader/writer and reasoner for RDF.rb.} gem.description = %q{RDF::N3 is an Notation-3 reader/writer and reasoner for the RDF.rb library suite.} + gem.metadata = { + "documentation_uri" => "https://ruby-rdf.github.io/rdf-n3", + "bug_tracker_uri" => "https://github.com/ruby-rdf/rdf-n3/issues", + "homepage_uri" => "https://github.com/ruby-rdf/rdf-n3", + "mailing_list_uri" => "https://lists.w3.org/Archives/Public/public-rdf-ruby/", + "source_code_uri" => "https://github.com/ruby-rdf/rdf-n3", + } gem.authors = %w(Gregg Kellogg) gem.email = 'public-rdf-ruby@w3.org' From f6dca67a1054cacd9ccba040588fead60b94d266 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Fri, 28 Jan 2022 16:52:11 -0800 Subject: [PATCH 4/4] Version 3.2.1. --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 944880f..e4604e3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.2.0 +3.2.1