Skip to content

Commit 3bd4a44

Browse files
committed
Finish 3.1.3
2 parents 4cdea02 + 29de9ea commit 3bd4a44

File tree

18 files changed

+500
-160
lines changed

18 files changed

+500
-160
lines changed

.github/workflows/ci.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
- 3.0
27+
- ruby-head
28+
- jruby
29+
steps:
30+
- name: Clone repository
31+
uses: actions/checkout@v2
32+
- name: Set up Ruby
33+
uses: ruby/setup-ruby@v1
34+
with:
35+
ruby-version: ${{ matrix.ruby }}
36+
- name: Install dependencies
37+
run: bundle install --jobs 4 --retry 3
38+
- name: Run tests
39+
run: bundle exec rspec spec
40+

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ rvm:
77
- 2.5
88
- 2.6
99
- 2.7
10+
- ruby-head
1011
- jruby
1112
cache: bundler
1213
sudo: false
1314
matrix:
1415
allow_failures:
1516
- rvm: jruby
17+
- rvm: ruby-head
1618
dist: trusty

CONTRIBUTING.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

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

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ gem 'ebnf', git: "https://github.com/dryruby/ebnf", branch: "develop"
77

88
group :development do
99
gem "byebug", platforms: :mri
10-
gem 'psych', platforms: [:mri, :rbx]
1110
end
1211

1312
group :development, :test do

README.md

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
[Turtle][] reader/writer for [RDF.rb][RDF.rb] .
44

55
[![Gem Version](https://badge.fury.io/rb/rdf-turtle.png)](https://badge.fury.io/rb/rdf-turtle)
6-
[![Build Status](https://travis-ci.org/ruby-rdf/rdf-turtle.png?branch=master)](https://travis-ci.org/ruby-rdf/rdf-turtle)
7-
[![Coverage Status](https://coveralls.io/repos/ruby-rdf/rdf-turtle/badge.svg)](https://coveralls.io/r/ruby-rdf/rdf-turtle)
6+
[![Build Status](https://github.com/ruby-rdf/rdf-turtle/workflows/CI/badge.svg?branch=develop)](https://github.com/ruby-rdf/rdf-turtle/actions?query=workflow%3ACI)
7+
[![Coverage Status](https://coveralls.io/repos/ruby-rdf/rdf-turtle/badge.svg)](https://coveralls.io/github/ruby-rdf/rdf-turtle)
8+
[![Gitter chat](https://badges.gitter.im/ruby-rdf/rdf.png)](https://gitter.im/ruby-rdf/rdf)
89

910
## Description
1011
This is a [Ruby][] implementation of a [Turtle][] parser for [RDF.rb][].
@@ -65,19 +66,29 @@ By default, the Turtle reader will reject a document containing a subject resour
6566
end
6667
# => RDF::ReaderError
6768

68-
Readers support a `rdfstar` option with either `:PG` (Property Graph) or `:SA` (Separate Assertions) modes. In `:PG` mode, statements that are used in the subject or object positions are also implicitly added to the graph:
69+
Readers support a boolean valued `rdfstar` option; only one statement is asserted, although the reified statement is contained within the graph.
6970

7071
graph = RDF::Graph.new do |graph|
71-
RDF::Turtle::Reader.new(ttl, rdfstar: :PG) {|reader| graph << reader}
72+
RDF::Turtle::Reader.new(ttl, rdfstar: true) {|reader| graph << reader}
7273
end
73-
graph.count #=> 2
74+
graph.count #=> 1
75+
76+
### Reading a Graph containing statement annotations
7477

75-
When using the `:SA` mode, only one statement is asserted, although the reified statement is contained within the graph.
78+
Annotations are introduced using the `{| ... |}` syntax, which is treated like a `blankNodePropertyList`,
79+
where the subject is the the triple ending with that annotation.
7680

81+
ttl = %(
82+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
83+
@prefix ex: <http://example.com/> .
84+
<bob> foaf:age 23 {| ex:certainty 9.0e-1 |} .
85+
)
7786
graph = RDF::Graph.new do |graph|
78-
RDF::Turtle::Reader.new(ttl, rdfstar: :SA) {|reader| graph << reader}
87+
RDF::Turtle::Reader.new(ttl) {|reader| graph << reader}
7988
end
80-
graph.count #=> 1
89+
# => RDF::ReaderError
90+
91+
Note that this requires the `rdfstar` option to be se.
8192

8293
## Documentation
8394
Full documentation available on [Rubydoc.info][Turtle doc]
@@ -159,7 +170,9 @@ This repository uses [Git Flow](https://github.com/nvie/gitflow) to mange develo
159170
list in the the `README`. Alphabetical order applies.
160171
* Do note that in order for us to merge any non-trivial changes (as a rule
161172
of thumb, additions larger than about 15 lines of code), we need an
162-
explicit [public domain dedication][PDD] on record from you.
173+
explicit [public domain dedication][PDD] on record from you,
174+
which you will be asked to agree to on the first commit to a repo within the organization.
175+
Note that the agreement applies to all repos in the [Ruby RDF](https://github.com/ruby-rdf/) organization.
163176

164177
## License
165178
This is free and unencumbered public domain software. For more information,
@@ -171,13 +184,13 @@ A copy of the [Turtle EBNF][] and derived parser files are included in the repos
171184
[RDF]: https://www.w3.org/RDF/
172185
[YARD]: https://yardoc.org/
173186
[YARD-GS]: https://rubydoc.info/docs/yard/file/docs/GettingStarted.md
174-
[PDD]: https://lists.w3.org/Archives/Public/public-rdf-ruby/2010May/0013.html
187+
[PDD]: https://unlicense.org/#unlicensing-contributions
175188
[RDF.rb]: https://rubydoc.info/github/ruby-rdf/rdf
176189
[EBNF]: https://rubygems.org/gems/ebnf
177190
[Backports]: https://rubygems.org/gems/backports
178191
[N-Triples]: https://www.w3.org/TR/rdf-testcases/#ntriples
179192
[Turtle]: https://www.w3.org/TR/2012/WD-turtle-20120710/
180-
[RDF*]: https://lists.w3.org/Archives/Public/public-rdf-star/
193+
[RDF*]: https://w3c.github.io/rdf-star/rdf-star-cg-spec.html
181194
[Turtle doc]: https://rubydoc.info/github/ruby-rdf/rdf-turtle/master/file/README.md
182195
[Turtle EBNF]: https://dvcs.w3.org/hg/rdf/file/default/rdf-turtle/turtle.bnf
183196
[Freebase Dumps]: https://developers.google.com/freebase/data

Rakefile

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,3 @@ namespace :gem do
1212
sh "gem push pkg/rdf-turtle-#{File.read('VERSION').chomp}.gem"
1313
end
1414
end
15-
16-
desc 'Default: run specs.'
17-
task default: :spec
18-
task specs: :spec
19-
20-
require 'rspec/core/rake_task'
21-
desc 'Run specifications'
22-
RSpec::Core::RakeTask.new do |spec|
23-
spec.rspec_opts = %w(--options spec/spec.opts) if File.exists?('spec/spec.opts')
24-
end
25-
26-
desc "Run specs through RCov"
27-
RSpec::Core::RakeTask.new("spec:rcov") do |spec|
28-
spec.rcov = true
29-
spec.rcov_opts = %q[--exclude "spec"]
30-
end
31-
32-
desc "Generate HTML report specs"
33-
RSpec::Core::RakeTask.new("doc:spec") do |spec|
34-
spec.rspec_opts = ["--format", "html", "-o", "doc/spec.html"]
35-
end
36-
37-
require 'yard'
38-
namespace :doc do
39-
YARD::Rake::YardocTask.new
40-
end

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.1.2
1+
3.1.3

etc/turtle.bnf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@
55
[5] base ::= BASE IRIREF "."?
66
[6] triples ::= subject predicateObjectList | blankNodePropertyList predicateObjectList?
77
[7] predicateObjectList ::= verb objectList ( ";" ( verb objectList)? )*
8-
[8] objectList ::= object ( "," object )*
8+
[8] objectList ::= object annotation? ( "," object annotation? )*
99
[9] verb ::= predicate | "a"
1010
[10] subject ::= iri | BlankNode | collection | embTriple
1111
[11] predicate ::= iri
12-
[12] object ::= iri | BlankNode | collection | blankNodePropertyList| literal | embTriple
12+
[12] object ::= iri | BlankNode | collection | blankNodePropertyList | literal | embTriple
1313
[13] literal ::= RDFLiteral | NumericLiteral | BooleanLiteral
1414
[14] blankNodePropertyList ::= "[" predicateObjectList "]"
1515
[15] collection ::= "(" object* ")"
16-
[xx] embTriple ::= "<<" subject predicate object ">>"
1716
[16] NumericLiteral ::= INTEGER | DECIMAL | DOUBLE
1817
[128s] RDFLiteral ::= String ( LANGTAG | ( "^^" iri ) )?
1918
[133s] BooleanLiteral ::= "true" | "false"
@@ -22,6 +21,10 @@
2221
[135s] iri ::= IRIREF | PrefixedName
2322
[136s] PrefixedName ::= PNAME_LN | PNAME_NS
2423
[137s] BlankNode ::= BLANK_NODE_LABEL | ANON
24+
[27] embTriple ::= "<<" embSubject predicate embObject ">>"
25+
[28] embSubject ::= iri | BlankNode | embTriple
26+
[29] embObject ::= iri | BlankNode | literal | embTriple
27+
[30] annotation ::= '{|' predicateObjectList '|}'
2528

2629
@terminals
2730

0 commit comments

Comments
 (0)