Skip to content

Commit 497731c

Browse files
committed
Finish 3.1.1
2 parents ece596a + d3474c8 commit 497731c

27 files changed

+1180
-272
lines changed

.coveralls.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
repo_token: jbAeDjB6ZRytcnGAw1TRPcEjzGiUq0zNx

.github/workflows/ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This workflow runs continuous CI across different versions of ruby on all branches and pull requests to develop.
2+
3+
name: CI
4+
on:
5+
push:
6+
branches: [ '**' ]
7+
pull_request:
8+
branches: [ develop ]
9+
workflow_dispatch:
10+
11+
jobs:
12+
tests:
13+
name: Ruby ${{ matrix.ruby }}
14+
if: "contains(github.event.commits[0].message, '[ci skip]') == false"
15+
runs-on: ubuntu-latest
16+
env:
17+
CI: true
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
ruby:
22+
- 2.4
23+
- 2.5
24+
- 2.6
25+
- 2.7
26+
- ruby-head
27+
#- jruby
28+
steps:
29+
- name: Clone repository
30+
uses: actions/checkout@v2
31+
- name: Set up Ruby
32+
uses: ruby/setup-ruby@v1
33+
with:
34+
ruby-version: ${{ matrix.ruby }}
35+
- name: Install dependencies
36+
run: bundle install --jobs 4 --retry 3
37+
- name: Run tests
38+
run: bundle exec rspec spec
39+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ Gemfile.lock
1010
/doc/
1111
/pkg/
1212
/.byebug_history
13+
coverage

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
* Arto Bendiken <[email protected]>
2+
* Gregg Kellogg <[email protected]>

CONTRIBUTING.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Community contributions are essential for keeping Ruby RDF great. We want to kee
66

77
This repository uses [Git Flow](https://github.com/nvie/gitflow) to manage development and release activity. All submissions _must_ be on a feature branch based on the _develop_ branch to ease staging and integration.
88

9-
* create or respond to an issue on the [Github Repository](http://github.com/ruby-rdf/rdf-trix/issues)
9+
* create or respond to an issue on the [Github Repository](https://github.com/ruby-rdf/rdf-trix/issues)
1010
* Fork and clone the repo:
1111
`git clone [email protected]:your-username/rdf-trix.git`
1212
* Install bundle:
@@ -28,9 +28,11 @@ This repository uses [Git Flow](https://github.com/nvie/gitflow) to manage devel
2828
enough, be assured we will eventually add you in there.
2929
* Do note that in order for us to merge any non-trivial changes (as a rule
3030
of thumb, additions larger than about 15 lines of code), we need an
31-
explicit [public domain dedication][PDD] on record from you.
31+
explicit [public domain dedication][PDD] on record from you,
32+
which you will be asked to agree to on the first commit to a repo within the organization.
33+
Note that the agreement applies to all repos in the [Ruby RDF](https://github.com/ruby-rdf/) organization.
3234

33-
[YARD]: http://yardoc.org/
34-
[YARD-GS]: http://rubydoc.info/docs/yard/file/docs/GettingStarted.md
35-
[PDD]: http://lists.w3.org/Archives/Public/public-rdf-ruby/2010May/0013.html
36-
[pr]: https://github.com/ruby-rdf/rdf-trix/compare/
35+
[YARD]: https://yardoc.org/
36+
[YARD-GS]: https://rubydoc.info/docs/yard/file/docs/GettingStarted.md
37+
[PDD]: https://unlicense.org/#unlicensing-contributions
38+
[pr]: https://github.com/ruby-rdf/rdf/compare/

Gemfile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@ gem 'rdf', git: "https://github.com/ruby-rdf/rdf", branch: "develop"
66
gem "nokogiri"
77

88
group :development do
9-
gem 'ebnf', git: "https://github.com/dryruby/ebnf", branch: "develop"
10-
gem 'json-ld', git: "https://github.com/ruby-rdf/json-ld", branch: "develop"
11-
gem 'rdf-isomorphic', git: "https://github.com/ruby-rdf/rdf-isomorphic", branch: "develop"
12-
gem 'rdf-spec', git: "https://github.com/ruby-rdf/rdf-spec", branch: "develop"
13-
gem 'rdf-turtle', git: "https://github.com/ruby-rdf/rdf-turtle", branch: "develop"
14-
gem 'sxp', git: "https://github.com/dryruby/sxp.rb", branch: "develop"
9+
gem 'ebnf', git: "https://github.com/dryruby/ebnf", branch: "develop"
10+
gem 'json-ld', git: "https://github.com/ruby-rdf/json-ld", branch: "develop"
11+
gem 'rdf-isomorphic', git: "https://github.com/ruby-rdf/rdf-isomorphic", branch: "develop"
12+
gem 'rdf-spec', git: "https://github.com/ruby-rdf/rdf-spec", branch: "develop"
13+
gem 'rdf-turtle', git: "https://github.com/ruby-rdf/rdf-turtle", branch: "develop"
14+
gem 'rdf-ordered-repo', git: "https://github.com/ruby-rdf/rdf-ordered-repo", branch: "develop"
15+
gem 'sxp', git: "https://github.com/dryruby/sxp.rb", branch: "develop"
1516
gem "syntax"
1617
gem "byebug", platform: :mri
1718
end
19+
20+
group :test do
21+
gem 'simplecov', platforms: :mri
22+
gem 'coveralls', '~> 0.8', platforms: :mri
23+
end

README.md

Lines changed: 116 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,121 @@
1-
TriX Support for RDF.rb
2-
=======================
1+
# TriX Support for RDF.rb
32

4-
This is an [RDF.rb][] extension that adds support for parsing/serializing
5-
[TriX][], an XML-based RDF serialization format developed by HP Labs and
6-
Nokia.
3+
[TriX][] reader/writer for [RDF.rb][RDF.rb] .
74

8-
* <http://github.com/ruby-rdf/rdf-trix>
9-
* <http://blog.datagraph.org/2010/04/parsing-rdf-with-ruby>
5+
[![Gem Version](https://badge.fury.io/rb/rdf-trix.png)](https://badge.fury.io/rb/rdf-trix)
6+
[![Build Status](https://github.com/ruby-rdf/rdf-trix/workflows/CI/badge.svg?branch=develop)](https://github.com/ruby-rdf/rdf-trix/actions?query=workflow%3ACI)
7+
[![Coverage Status](https://coveralls.io/repos/ruby-rdf/rdf-trix/badge.svg?branch=develop)](https://coveralls.io/github/ruby-rdf/rdf-trix?branch=develop)
8+
[![Gitter chat](https://badges.gitter.im/ruby-rdf/rdf.png)](https://gitter.im/ruby-rdf/rdf)
109

11-
[![Gem Version](https://badge.fury.io/rb/rdf-trix.png)](http://badge.fury.io/rb/rdf-trix)
12-
[![Build Status](https://travis-ci.org/ruby-rdf/rdf-trix.png?branch=master)](http://travis-ci.org/ruby-rdf/rdf-trix)
10+
## Description
11+
This is a [Ruby][] implementation of a [TriX][] reader and writer for [RDF.rb][]. TriX is an XML-based RDF serialization format developed by HP Labs and Nokia.
1312

14-
Documentation
15-
-------------
13+
## Features
14+
RDF::TriX parses [TriX][] into statements or quads. It also serializes to TriX.
15+
16+
Install with `gem install rdf-trix`
17+
18+
* 100% free and unencumbered [public domain](https://unlicense.org/) software.
19+
* Implements a complete parser and serializer for [TriX][].
20+
* Compatible with Ruby >= 2.4, and JRuby 1.7+.
21+
22+
### Support for xml:base
23+
24+
The TriX reader natively supports `xml:base` in the top-level element without the need for an XSLT. This allows values of a `uri` element to be relative URIs and resolved against that base. The base can also be specified as an option to the reader.
25+
26+
For example:
27+
28+
<TriX xmlns="http://www.w3.org/2004/03/trix/trix-1/"
29+
xml:base="http://example.org/">
30+
<graph>
31+
<uri>graph1</uri>
32+
<triple>
33+
<uri>Bob</uri>
34+
<uri>wife</uri>
35+
<uri>Mary</uri>
36+
</triple>
37+
<triple>
38+
<uri>Bob</uri>
39+
<uri>name</uri>
40+
<plainLiteral>Bob</plainLiteral>
41+
</triple>
42+
<triple>
43+
<uri>Mary</uri>
44+
<uri>age</uri>
45+
<typedLiteral datatype="http://www.w3.org/2001/XMLSchema#integer">32</typedLiteral>
46+
</triple>
47+
</graph>
48+
</TriX>
49+
50+
### RDF-star
51+
52+
Both reader and writer include provisional support for [RDF-star][].
53+
54+
Internally, an `RDF::Statement` is treated as another resource, along with `RDF::URI` and `RDF::Node`, which allows an `RDF::Statement` to have a `#subject` or `#object` which is also an `RDF::Statement`.
55+
56+
RDF-star is supported by allowing a `triple` element to contain another `triple` as either or both the _subject_ or _object_.
57+
58+
Note that this requires the `rdfstar` option to be se.
59+
60+
**Note: This feature is subject to change or elimination as the standards process progresses.**
61+
62+
For example:
63+
64+
<TriX xmlns="http://www.w3.org/2004/03/trix/trix-1/">
65+
<graph>
66+
<triple>
67+
<triple>
68+
<uri>http://example/s1</uri>
69+
<uri>http://example/p1</uri>
70+
<uri>http://example/o1</uri>
71+
</triple>
72+
<uri>http://example/p</uri>
73+
<uri>http://example/o</uri>
74+
</triple>
75+
</graph>
76+
</TriX>
77+
78+
## Usage
79+
Instantiate a reader from a local file:
80+
81+
repo = RDF::Repository.load("etc/doap.trix", :format => :trix)
82+
83+
Define `@base` and `@prefix` definitions, and use for serialization using `:base_uri` an `:prefixes` options.
84+
85+
Canonicalize and validate using `:canonicalize` and `:validate` options.
86+
87+
Write a repository to a file:
88+
89+
RDF::TriX::Writer.open("etc/test.trix") do |writer|
90+
writer << repo
91+
end
92+
93+
## Dependencies
94+
* [RDF.rb](https://rubygems.org/gems/rdf) (~> 3.1)
95+
* Soft dependency on [Nokogiri](https://rubygems.org/gems/nokogiri) (>= 1.10)
96+
* Soft dependency on [Libxml-Ruby](https://rubygems.org/gems/libxml-ruby) (>= 3.0)
97+
98+
## Documentation
1699

17100
* {RDF::TriX}
18101
* {RDF::TriX::Format}
19102
* {RDF::TriX::Reader}
20103
* {RDF::TriX::Writer}
21104

22-
Dependencies
23-
------------
105+
## Dependencies
24106

25-
* [RDF.rb](http://rubygems.org/gems/rdf) (~> 3.1)
26-
[Nokogiri](http://rubygems.org/gems/nokogiri) (>= 1.10.0)
107+
* [RDF.rb](https://rubygems.org/gems/rdf) (~> 3.1)
108+
[Nokogiri](https://rubygems.org/gems/nokogiri) (~> 1.10)
109+
[LibXML](https://rubygems.org/gems/libxml) (>= 3.0)
27110

28-
Installation
29-
------------
111+
## Installation
30112

31-
The recommended installation method is via [RubyGems](http://rubygems.org/).
113+
The recommended installation method is via [RubyGems](https://rubygems.org/).
32114
To install the latest official release of the `RDF::TriX` gem, do:
33115

34116
% [sudo] gem install rdf-trix
35117

36-
Download
37-
--------
118+
## Download
38119

39120
To get a local working copy of the development repository, do:
40121

@@ -43,20 +124,18 @@ To get a local working copy of the development repository, do:
43124
Alternatively, download the latest development version as a tarball as
44125
follows:
45126

46-
% wget http://github.com/ruby-rdf/rdf-trix/tarball/master
127+
% wget https://github.com/ruby-rdf/rdf-trix/tarball/master
47128

48-
Mailing List
49-
------------
129+
## Mailing List
50130

51-
* <http://lists.w3.org/Archives/Public/public-rdf-ruby/>
131+
* <https://lists.w3.org/Archives/Public/public-rdf-ruby/>
52132

53-
Author
54-
------
133+
## Authors
55134

56-
* [Arto Bendiken](http://github.com/bendiken) - <http://ar.to/>
135+
* [Arto Bendiken](https://github.com/artob) - <https://ar.to/>
136+
* [Gregg Kellogg](https://github.com/gkellogg) - <https://greggkellogg.net/>
57137

58-
Contributors
59-
------------
138+
# Contributors
60139

61140
Refer to the accompanying {file:CREDITS} file.
62141

@@ -77,12 +156,16 @@ This repository uses [Git Flow](https://github.com/nvie/gitflow) to mange develo
77156
enough, be assured we will eventually add you in there.
78157
* Do note that in order for us to merge any non-trivial changes (as a rule
79158
of thumb, additions larger than about 15 lines of code), we need an
80-
explicit [public domain dedication][PDD] on record from you.
159+
explicit [public domain dedication][PDD] on record from you,
160+
which you will be asked to agree to on the first commit to a repo within the organization.
161+
Note that the agreement applies to all repos in the [Ruby RDF](https://github.com/ruby-rdf/) organization.
81162

82163
## License
83164

84165
This is free and unencumbered public domain software. For more information,
85-
see <http://unlicense.org/> or the accompanying {file:UNLICENSE} file.
166+
see <https://unlicense.org/> or the accompanying {file:UNLICENSE} file.
86167

87-
[RDF.rb]: http://rdf.rubyforge.org/
88-
[TriX]: http://www.w3.org/2004/03/trix/
168+
[RDF.rb]: https://rubygems.org/gems/rdf/
169+
[TriX]: https://www.hpl.hp.com/techreports/2004/HPL-2004-56.html
170+
[PDD]: https://unlicense.org/#unlicensing-contributions
171+
[RDF-star]: https://w3c.github.io/rdf-star/rdf-star-cg-spec.html

Rakefile

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
#!/usr/bin/env ruby
2+
require "bundler/setup"
3+
require 'rdf/trix'
4+
require 'rdf/turtle'
5+
require 'rdf/ntriples'
26

37
namespace :gem do
48
desc "Build the rdf-trix-#{File.read('VERSION').chomp}.gem file"
@@ -12,16 +16,21 @@ namespace :gem do
1216
end
1317
end
1418

15-
desc "Generate etc/doap.xml from etc/doap.ttl."
16-
task :doap do
17-
$:.unshift(File.expand_path("../lib", __FILE__))
18-
require "bundler/setup"
19-
require 'rubygems'
20-
require 'rdf/turtle'
21-
require 'rdf/trix'
19+
desc "Generate etc/doap.nt from etc/doap.ttl."
20+
task :doap => %w(etc/doap.xml etc/doap.nt)
21+
22+
file "etc/doap.xml" => "etc/doap.ttl" do
2223
RDF::TriX::Writer.open("etc/doap.xml") do |writer|
2324
RDF::Turtle::Reader.open("etc/doap.ttl") do |reader|
2425
reader.each_statement { |statement| writer << statement }
2526
end
2627
end
2728
end
29+
30+
file "etc/doap.nt" => "etc/doap.ttl" do
31+
RDF::NTriples::Writer.open("etc/doap.nt") do |writer|
32+
RDF::Turtle::Reader.open("etc/doap.ttl") do |reader|
33+
reader.each_statement { |statement| writer << statement }
34+
end
35+
end
36+
end

UNLICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2121
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2222
OTHER DEALINGS IN THE SOFTWARE.
2323

24-
For more information, please refer to <http://unlicense.org/>
24+
For more information, please refer to <https://unlicense.org/>

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.1.0
1+
3.1.1

0 commit comments

Comments
 (0)