From f28ead6ca33d70ba5bb6232cc0fdd111c3d17188 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Tue, 25 Jan 2022 14:59:32 -0800 Subject: [PATCH 01/10] Mark quoted statements as such. --- .github/workflows/ci.yml | 2 +- lib/json/ld/to_rdf.rb | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9827680..1da320a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: ruby: - 2.6 - 2.7 - - 3.0 + - "3.0" - 3.1 - ruby-head - jruby diff --git a/lib/json/ld/to_rdf.rb b/lib/json/ld/to_rdf.rb index fb4967f..76209ca 100644 --- a/lib/json/ld/to_rdf.rb +++ b/lib/json/ld/to_rdf.rb @@ -11,10 +11,11 @@ module ToRDF ## # @param [Hash{String => Object}] item # @param [RDF::Resource] graph_name + # @param [Boolean] emitted triples are quoted triples. # @yield statement # @yieldparam [RDF::Statement] statement # @return RDF::Resource the subject of this item - def item_to_rdf(item, graph_name: nil, &block) + def item_to_rdf(item, graph_name: nil, quoted: false, &block) # Just return value object as Term return unless item @@ -82,9 +83,9 @@ def item_to_rdf(item, graph_name: nil, &block) when nil then node when String then as_resource(item['@id']) when Object - # Embedded statement + # Embedded/quoted statement # (No error checking, as this is done in expansion) - to_enum(:item_to_rdf, item['@id']).to_a.first + to_enum(:item_to_rdf, item['@id'], quoted: true).to_a.first end #log_debug("item_to_rdf") {"subject: #{subject.to_ntriples rescue 'malformed rdf'}"} @@ -95,12 +96,12 @@ def item_to_rdf(item, graph_name: nil, &block) values.each do |v| object = as_resource(v) #log_debug("item_to_rdf") {"type: #{object.to_ntriples rescue 'malformed rdf'}"} - yield RDF::Statement(subject, RDF.type, object, graph_name: graph_name) + yield RDF::Statement(subject, RDF.type, object, graph_name: graph_name, quoted: quoted) end when '@graph' values = [values].compact unless values.is_a?(Array) values.each do |nd| - item_to_rdf(nd, graph_name: subject, &block) + item_to_rdf(nd, graph_name: subject, quoted: quoted, &block) end when '@reverse' raise "Huh?" unless values.is_a?(Hash) @@ -113,7 +114,7 @@ def item_to_rdf(item, graph_name: nil, &block) object = item_to_rdf(v, graph_name: graph_name, &block) #log_debug("item_to_rdf") {"subject: #{object.to_ntriples rescue 'malformed rdf'}"} # yield subject, prediate, and literal to results. - yield RDF::Statement(object, predicate, subject, graph_name: graph_name) + yield RDF::Statement(object, predicate, subject, graph_name: graph_name, quoted: quoted) end end when '@included' @@ -136,13 +137,13 @@ def item_to_rdf(item, graph_name: nil, &block) object = parse_list(v['@list'], graph_name: graph_name, &block) # Append a triple composed of subject, prediate, and object to results and add all triples from list_results to results. - yield RDF::Statement(subject, predicate, object, graph_name: graph_name) + yield RDF::Statement(subject, predicate, object, graph_name: graph_name, quoted: quoted) else # Otherwise, item is a value object or a node definition. Generate object as the result of the Object Converstion algorithm passing item. object = item_to_rdf(v, graph_name: graph_name, &block) #log_debug("item_to_rdf") {"object: #{object.to_ntriples rescue 'malformed rdf'}"} # yield subject, prediate, and literal to results. - yield RDF::Statement(subject, predicate, object, graph_name: graph_name) + yield RDF::Statement(subject, predicate, object, graph_name: graph_name, quoted: quoted) end end end From dfc1f965c52595767dbb45953a8b205debaca140 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Thu, 27 Jan 2022 15:41:50 -0800 Subject: [PATCH 02/10] 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 | 2 +- example-files/shex-expanded.jsonld | 2 +- example-files/shex-framed.jsonld | 56 ++++++++++++++--------------- example-files/shex-short.jsonld | 2 +- json-ld.gemspec | 7 ++++ lib/json/ld/reader.rb | 2 +- lib/json/ld/writer.rb | 2 +- 8 files changed, 67 insertions(+), 33 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 4cfcc23..fe2de61 100755 --- a/README.md +++ b/README.md @@ -565,7 +565,7 @@ The {JSON::LD::ContentNegotiation#call} method looks for a result which includes See [Rack::LinkedData][] to do the same thing with an RDF Graph or Dataset as the source, rather than Ruby objects. ## Documentation -Full documentation available on [RubyDoc](https://rubydoc.info/gems/json-ld/file/README.md) +Full documentation available on [RubyDoc](https://ruby-rdf.github.io/json-ld/file/README.md) ## Differences from [JSON-LD API][] The specified JSON-LD API is based on a WebIDL definition implementing [Promises][] intended for use within a browser. diff --git a/example-files/shex-expanded.jsonld b/example-files/shex-expanded.jsonld index 0b62b7a..83fb367 100644 --- a/example-files/shex-expanded.jsonld +++ b/example-files/shex-expanded.jsonld @@ -118015,7 +118015,7 @@ ], "http://usefulinc.com/ns/doap#homepage": [ { - "@id": "http://ruby-rdf.github.com/shex" + "@id": "https://ruby-rdf.github.io/shex" } ], "http://usefulinc.com/ns/doap#name": [ diff --git a/example-files/shex-framed.jsonld b/example-files/shex-framed.jsonld index fefd5da..a0e0514 100644 --- a/example-files/shex-framed.jsonld +++ b/example-files/shex-framed.jsonld @@ -40258,7 +40258,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -40334,7 +40334,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -40823,7 +40823,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -40899,7 +40899,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -41265,7 +41265,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -41341,7 +41341,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -55884,7 +55884,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -56091,7 +56091,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -63158,7 +63158,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -63319,7 +63319,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -63423,7 +63423,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -63589,7 +63589,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -63693,7 +63693,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -63951,7 +63951,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -64207,7 +64207,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -64365,7 +64365,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -64529,7 +64529,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -64687,7 +64687,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -64845,7 +64845,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -65003,7 +65003,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -65161,7 +65161,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -65368,7 +65368,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -69985,7 +69985,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -70146,7 +70146,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -70304,7 +70304,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -70462,7 +70462,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -70620,7 +70620,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, @@ -71235,7 +71235,7 @@ } ], "doapDesc": "ShEx is an Shape Expression engine for the RDF.rb library suite.", - "homepage": "http://ruby-rdf.github.com/shex", + "homepage": "https://ruby-rdf.github.io/shex", "language": "Ruby", "name": "ShEx" }, diff --git a/example-files/shex-short.jsonld b/example-files/shex-short.jsonld index 48b3007..1be08da 100644 --- a/example-files/shex-short.jsonld +++ b/example-files/shex-short.jsonld @@ -130,7 +130,7 @@ ], "http://usefulinc.com/ns/doap#homepage": [ { - "@id": "http://ruby-rdf.github.com/shex" + "@id": "https://ruby-rdf.github.io/shex" } ], "http://usefulinc.com/ns/doap#developer": [ diff --git a/json-ld.gemspec b/json-ld.gemspec index 296a827..0d8c553 100755 --- a/json-ld.gemspec +++ b/json-ld.gemspec @@ -12,6 +12,13 @@ Gem::Specification.new do |gem| gem.license = 'Unlicense' gem.summary = "JSON-LD reader/writer for Ruby." gem.description = "JSON::LD parses and serializes JSON-LD into RDF and implements expansion, compaction and framing API interfaces for the Ruby RDF.rb library suite." + gem.metadata = { + "documentation_uri" => "https://ruby-rdf.github.io/json-ld", + "bug_tracker_uri" => "https://github.com/ruby-rdf/json-ld/issues", + "homepage_uri" => "https://github.com/ruby-rdf/json-ld", + "mailing_list_uri" => "https://lists.w3.org/Archives/Public/public-rdf-ruby/", + "source_code_uri" => "https://github.com/ruby-rdf/json-ld", + } gem.authors = ['Gregg Kellogg'] gem.email = 'public-linked-json@w3.org' diff --git a/lib/json/ld/reader.rb b/lib/json/ld/reader.rb index f3d1152..92d84e6 100644 --- a/lib/json/ld/reader.rb +++ b/lib/json/ld/reader.rb @@ -12,7 +12,7 @@ class Reader < RDF::Reader ## # JSON-LD 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/json/ld/writer.rb b/lib/json/ld/writer.rb index f879427..04a0c8b 100644 --- a/lib/json/ld/writer.rb +++ b/lib/json/ld/writer.rb @@ -71,7 +71,7 @@ class Writer < RDF::Writer ## # JSON-LD 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( From 8b636d6bb496c536e65e522267416c70da31c44e Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Tue, 29 Mar 2022 13:13:01 -0700 Subject: [PATCH 03/10] Correct some require names. --- README.md | 2 +- lib/json/ld/context.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fe2de61..57fca0f 100755 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ In the first case, the embedded node is not asserted, and only appears as the su #### Serializing a Graph containing embedded statements - require 'json-ld' + require 'json/ld' statement = RDF::Statement(RDF::URI('bob'), RDF::Vocab::FOAF.age, RDF::Literal(23)) graph = RDF::Graph.new << [statement, RDF::URI("ex:certainty"), RDF::Literal(0.9)] graph.dump(:jsonld, validate: false, standard_prefixes: true) diff --git a/lib/json/ld/context.rb b/lib/json/ld/context.rb index 6fdb2b9..634e3ee 100644 --- a/lib/json/ld/context.rb +++ b/lib/json/ld/context.rb @@ -7,7 +7,7 @@ begin # Attempt to load this to avoid unnecessary context fetches - require 'json-ld-preloaded' + require 'json/ld/preloaded' rescue LoadError # Silently allow this to fail end From ea603b8139dd194253ce8103f4b2284b8d780e26 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Tue, 29 Mar 2022 13:13:37 -0700 Subject: [PATCH 04/10] Define the format URI to http://www.w3.org/ns/formats/JSON-LD. --- lib/json/ld/format.rb | 3 ++- spec/format_spec.rb | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/json/ld/format.rb b/lib/json/ld/format.rb index 706c6b5..728b0e1 100644 --- a/lib/json/ld/format.rb +++ b/lib/json/ld/format.rb @@ -23,7 +23,8 @@ module JSON::LD class Format < RDF::Format content_type 'application/ld+json', extension: :jsonld, - alias: 'application/x-ld+json' + alias: 'application/x-ld+json', + uri: 'http://www.w3.org/ns/formats/JSON-LD' content_encoding 'utf-8' reader { JSON::LD::Reader } diff --git a/spec/format_spec.rb b/spec/format_spec.rb index fea4563..32c7874 100644 --- a/spec/format_spec.rb +++ b/spec/format_spec.rb @@ -41,6 +41,10 @@ specify {expect(described_class.to_sym).to eq :jsonld} end + describe "#to_uri" do + specify {expect(described_class.to_uri).to eq RDF::URI('http://www.w3.org/ns/formats/JSON-LD')} + end + describe ".detect" do { jsonld: '{"@context" => "foo"}', From 04675dbb0db113b5bde3f25bcdc5ce8ca479ee0f Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Wed, 30 Mar 2022 16:08:39 -0700 Subject: [PATCH 05/10] Move require 'json/ld/preloaded' until after important class variables have been defined. --- lib/json/ld/context.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/json/ld/context.rb b/lib/json/ld/context.rb index 634e3ee..1743785 100644 --- a/lib/json/ld/context.rb +++ b/lib/json/ld/context.rb @@ -5,13 +5,6 @@ require 'set' require 'rdf/util/cache' -begin - # Attempt to load this to avoid unnecessary context fetches - require 'json/ld/preloaded' -rescue LoadError - # Silently allow this to fail -end - module JSON::LD class Context include Utils @@ -50,6 +43,13 @@ def alias_preloaded(a, url) end end + begin + # Attempt to load this to avoid unnecessary context fetches + require 'json/ld/preloaded' + rescue LoadError + # Silently allow this to fail + end + # The base. # # @return [RDF::URI] Current base IRI, used for expanding relative IRIs. From 3630df4f51422fbb5c9e640956d290832dc8400a Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Wed, 20 Apr 2022 11:27:43 -0700 Subject: [PATCH 06/10] Update nokogiri dependency. --- Gemfile | 2 +- example-files/afs_prefix_flag.jsonld | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 example-files/afs_prefix_flag.jsonld diff --git a/Gemfile b/Gemfile index d5473b9..9017d25 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,5 @@ source "https://rubygems.org" -gem "nokogiri", '~> 1.10' +gem "nokogiri", '~> 1.13', '>= 1.13.4' gemspec gem 'rdf', git: "https://github.com/ruby-rdf/rdf", branch: "develop" diff --git a/example-files/afs_prefix_flag.jsonld b/example-files/afs_prefix_flag.jsonld new file mode 100644 index 0000000..9b47898 --- /dev/null +++ b/example-files/afs_prefix_flag.jsonld @@ -0,0 +1,11 @@ +{ + "@id" : "http://example/collection", + "http://example/p" : [ "book:ZZZ" ], + "book" : [ "book:YYY" ], + "@context" : { + "book" : { + "@id" : "http://onbetween.ch/3ms/cms#", + "@type" : "@id" + } + } +} \ No newline at end of file From 9fd51e0622ebe5c52c736d56f31ddf74b4eb7bb5 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Wed, 20 Apr 2022 11:27:55 -0700 Subject: [PATCH 07/10] CI on Windows. --- .github/workflows/ci.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1da320a..0589f05 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,3 +42,31 @@ jobs: if: "matrix.ruby == '3.0'" with: github-token: ${{ secrets.GITHUB_TOKEN }} + wintests: + name: Win64 Ruby ${{ matrix.ruby }} + if: "contains(github.event.commits[0].message, '[ci skip]') == false" + runs-on: windows-latest + env: + CI: true + ALLOW_FAILURES: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'jruby' }} + strategy: + fail-fast: false + matrix: + ruby: + - 3.1 + steps: + - name: Clone repository + uses: actions/checkout@v2 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + - name: Install dependencies + run: bundle install --jobs 4 --retry 3 + - name: Run tests + run: ruby --version; bundle exec rspec spec || $ALLOW_FAILURES + - name: Coveralls GitHub Action + uses: coverallsapp/github-action@v1.1.2 + if: "matrix.ruby == '3.0'" + with: + github-token: ${{ secrets.GITHUB_TOKEN }} From 58f130dbd375ae6f6bb9791dd04e71bc08d6fa9a Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Tue, 10 May 2022 15:45:47 -0700 Subject: [PATCH 08/10] When expanding, don't delete `@context` from input. Fixes #54. --- lib/json/ld/expand.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/json/ld/expand.rb b/lib/json/ld/expand.rb index 3956349..8805500 100644 --- a/lib/json/ld/expand.rb +++ b/lib/json/ld/expand.rb @@ -88,7 +88,7 @@ def expand(input, active_property, context, # If element contains the key @context, set active context to the result of the Context Processing algorithm, passing active context and the value of the @context key as local context. if input.key?('@context') - context = context.parse(input.delete('@context'), base: @options[:base]) + context = context.parse(input['@context'], base: @options[:base]) log_debug("expand", depth: log_depth.to_i) {"context: #{context.inspect}"} end @@ -99,7 +99,7 @@ def expand(input, active_property, context, # See if keys mapping to @type have terms with a local context type_key = nil - input.keys.sort. + (input.keys - %w(@context)).sort. select {|k| context.expand_iri(k, vocab: true, base: @options[:base]) == '@type'}. each do |tk| From 869a47377a64e40619708460067fc6152f4c0ada Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Tue, 10 May 2022 22:16:29 -0700 Subject: [PATCH 09/10] Skip some tests on Windows. --- spec/format_spec.rb | 2 +- spec/reader_spec.rb | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/spec/format_spec.rb b/spec/format_spec.rb index 32c7874..812f07d 100644 --- a/spec/format_spec.rb +++ b/spec/format_spec.rb @@ -70,7 +70,7 @@ end end - describe ".cli_commands" do + describe ".cli_commands", skip: Gem.win_platform? do require 'rdf/cli' let(:ttl) {File.expand_path("../test-files/test-1-rdf.ttl", __FILE__)} let(:json) {File.expand_path("../test-files/test-1-input.json", __FILE__)} diff --git a/spec/reader_spec.rb b/spec/reader_spec.rb index 2bf45de..d2832b0 100644 --- a/spec/reader_spec.rb +++ b/spec/reader_spec.rb @@ -131,7 +131,7 @@ { "@context": {"@base": "http://a/bb/ccc/d;p?q", "urn:ex:p": {"@type": "@id"}}, "@graph": [ - {"@id": "urn:ex:s001", "urn:ex:p": "g:h"}, + {"@id": "urn:ex:s001", "urn:ex:p": "gg:h"}, {"@id": "urn:ex:s002", "urn:ex:p": "g"}, {"@id": "urn:ex:s003", "urn:ex:p": "./g"}, {"@id": "urn:ex:s004", "urn:ex:p": "g/"}, @@ -183,7 +183,7 @@ { "@context": {"@base": "http://a/bb/ccc/d/", "urn:ex:p": {"@type": "@id"}}, "@graph": [ - {"@id": "urn:ex:s043", "urn:ex:p": "g:h"}, + {"@id": "urn:ex:s043", "urn:ex:p": "gg:h"}, {"@id": "urn:ex:s044", "urn:ex:p": "g"}, {"@id": "urn:ex:s045", "urn:ex:p": "./g"}, {"@id": "urn:ex:s046", "urn:ex:p": "g/"}, @@ -235,7 +235,7 @@ { "@context": {"@base": "http://a/bb/ccc/./d;p?q", "urn:ex:p": {"@type": "@id"}}, "@graph": [ - {"@id": "urn:ex:s085", "urn:ex:p": "g:h"}, + {"@id": "urn:ex:s085", "urn:ex:p": "gg:h"}, {"@id": "urn:ex:s086", "urn:ex:p": "g"}, {"@id": "urn:ex:s087", "urn:ex:p": "./g"}, {"@id": "urn:ex:s088", "urn:ex:p": "g/"}, @@ -287,7 +287,7 @@ { "@context": {"@base": "http://a/bb/ccc/../d;p?q", "urn:ex:p": {"@type": "@id"}}, "@graph": [ - {"@id": "urn:ex:s127", "urn:ex:p": "g:h"}, + {"@id": "urn:ex:s127", "urn:ex:p": "gg:h"}, {"@id": "urn:ex:s128", "urn:ex:p": "g"}, {"@id": "urn:ex:s129", "urn:ex:p": "./g"}, {"@id": "urn:ex:s130", "urn:ex:p": "g/"}, @@ -339,7 +339,7 @@ { "@context": {"@base": "http://a/bb/ccc/.", "urn:ex:p": {"@type": "@id"}}, "@graph": [ - {"@id": "urn:ex:s169", "urn:ex:p": "g:h"}, + {"@id": "urn:ex:s169", "urn:ex:p": "gg:h"}, {"@id": "urn:ex:s170", "urn:ex:p": "g"}, {"@id": "urn:ex:s171", "urn:ex:p": "./g"}, {"@id": "urn:ex:s172", "urn:ex:p": "g/"}, @@ -391,7 +391,7 @@ { "@context": {"@base": "http://a/bb/ccc/..", "urn:ex:p": {"@type": "@id"}}, "@graph": [ - {"@id": "urn:ex:s211", "urn:ex:p": "g:h"}, + {"@id": "urn:ex:s211", "urn:ex:p": "gg:h"}, {"@id": "urn:ex:s212", "urn:ex:p": "g"}, {"@id": "urn:ex:s213", "urn:ex:p": "./g"}, {"@id": "urn:ex:s214", "urn:ex:p": "g/"}, @@ -443,7 +443,7 @@ { "@context": {"@base": "file:///a/bb/ccc/d;p?q", "urn:ex:p": {"@type": "@id"}}, "@graph": [ - {"@id": "urn:ex:s253", "urn:ex:p": "g:h"}, + {"@id": "urn:ex:s253", "urn:ex:p": "gg:h"}, {"@id": "urn:ex:s254", "urn:ex:p": "g"}, {"@id": "urn:ex:s255", "urn:ex:p": "./g"}, {"@id": "urn:ex:s256", "urn:ex:p": "g/"}, @@ -523,7 +523,7 @@ let(:nt) {%q{ # RFC3986 normal examples - . + . . . . @@ -571,7 +571,7 @@ # RFC3986 normal examples with trailing slash in base IRI - . + . . . . @@ -619,7 +619,7 @@ # RFC3986 normal examples with /. in the base IRI - . + . . . . @@ -667,7 +667,7 @@ # RFC3986 normal examples with /.. in the base IRI - . + . . . . @@ -715,7 +715,7 @@ # RFC3986 normal examples with trailing /. in the base IRI - . + . . . . @@ -763,7 +763,7 @@ # RFC3986 normal examples with trailing /.. in the base IRI - . + . . . . @@ -811,7 +811,7 @@ # RFC3986 normal examples with file path - . + . . . . From 1536d8a75e09c6f4a0ac38f639686e9b4e3a0d81 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Wed, 11 May 2022 13:45:09 -0700 Subject: [PATCH 10/10] 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