Skip to content

Commit

Permalink
Finish 3.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Dec 25, 2020
2 parents 4cdea02 + 29de9ea commit 3bd4a44
Show file tree
Hide file tree
Showing 18 changed files with 500 additions and 160 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow runs continuous CI across different versions of ruby on all branches and pull requests to develop.

name: CI
on:
push:
branches: [ '**' ]
pull_request:
branches: [ develop ]
workflow_dispatch:

jobs:
tests:
name: Ruby ${{ matrix.ruby }}
if: "contains(github.event.commits[0].message, '[ci skip]') == false"
runs-on: ubuntu-latest
env:
CI: true
strategy:
fail-fast: false
matrix:
ruby:
- 2.4
- 2.5
- 2.6
- 2.7
- 3.0
- ruby-head
- jruby
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: bundle exec rspec spec

2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ rvm:
- 2.5
- 2.6
- 2.7
- ruby-head
- jruby
cache: bundler
sudo: false
matrix:
allow_failures:
- rvm: jruby
- rvm: ruby-head
dist: trusty
6 changes: 4 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ This repository uses [Git Flow](https://github.com/nvie/gitflow) to manage devel
enough, be assured we will eventually add you in there.
* Do note that in order for us to merge any non-trivial changes (as a rule
of thumb, additions larger than about 15 lines of code), we need an
explicit [public domain dedication][PDD] on record from you.
explicit [public domain dedication][PDD] on record from you,
which you will be asked to agree to on the first commit to a repo within the organization.
Note that the agreement applies to all repos in the [Ruby RDF](https://github.com/ruby-rdf/) organization.

[YARD]: https://yardoc.org/
[YARD-GS]: https://rubydoc.info/docs/yard/file/docs/GettingStarted.md
[PDD]: https://lists.w3.org/Archives/Public/public-rdf-ruby/2010May/0013.html
[PDD]: https://unlicense.org/#unlicensing-contributions
[pr]: https://github.com/ruby-rdf/rdf-turtle/compare/
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ gem 'ebnf', git: "https://github.com/dryruby/ebnf", branch: "develop"

group :development do
gem "byebug", platforms: :mri
gem 'psych', platforms: [:mri, :rbx]
end

group :development, :test do
Expand Down
35 changes: 24 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
[Turtle][] reader/writer for [RDF.rb][RDF.rb] .

[![Gem Version](https://badge.fury.io/rb/rdf-turtle.png)](https://badge.fury.io/rb/rdf-turtle)
[![Build Status](https://travis-ci.org/ruby-rdf/rdf-turtle.png?branch=master)](https://travis-ci.org/ruby-rdf/rdf-turtle)
[![Coverage Status](https://coveralls.io/repos/ruby-rdf/rdf-turtle/badge.svg)](https://coveralls.io/r/ruby-rdf/rdf-turtle)
[![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)
[![Coverage Status](https://coveralls.io/repos/ruby-rdf/rdf-turtle/badge.svg)](https://coveralls.io/github/ruby-rdf/rdf-turtle)
[![Gitter chat](https://badges.gitter.im/ruby-rdf/rdf.png)](https://gitter.im/ruby-rdf/rdf)

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

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:
Readers support a boolean valued `rdfstar` option; only one statement is asserted, although the reified statement is contained within the graph.

graph = RDF::Graph.new do |graph|
RDF::Turtle::Reader.new(ttl, rdfstar: :PG) {|reader| graph << reader}
RDF::Turtle::Reader.new(ttl, rdfstar: true) {|reader| graph << reader}
end
graph.count #=> 2
graph.count #=> 1

### Reading a Graph containing statement annotations

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

ttl = %(
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix ex: <http://example.com/> .
<bob> foaf:age 23 {| ex:certainty 9.0e-1 |} .
)
graph = RDF::Graph.new do |graph|
RDF::Turtle::Reader.new(ttl, rdfstar: :SA) {|reader| graph << reader}
RDF::Turtle::Reader.new(ttl) {|reader| graph << reader}
end
graph.count #=> 1
# => RDF::ReaderError

Note that this requires the `rdfstar` option to be se.

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

## License
This is free and unencumbered public domain software. For more information,
Expand All @@ -171,13 +184,13 @@ A copy of the [Turtle EBNF][] and derived parser files are included in the repos
[RDF]: https://www.w3.org/RDF/
[YARD]: https://yardoc.org/
[YARD-GS]: https://rubydoc.info/docs/yard/file/docs/GettingStarted.md
[PDD]: https://lists.w3.org/Archives/Public/public-rdf-ruby/2010May/0013.html
[PDD]: https://unlicense.org/#unlicensing-contributions
[RDF.rb]: https://rubydoc.info/github/ruby-rdf/rdf
[EBNF]: https://rubygems.org/gems/ebnf
[Backports]: https://rubygems.org/gems/backports
[N-Triples]: https://www.w3.org/TR/rdf-testcases/#ntriples
[Turtle]: https://www.w3.org/TR/2012/WD-turtle-20120710/
[RDF*]: https://lists.w3.org/Archives/Public/public-rdf-star/
[RDF*]: https://w3c.github.io/rdf-star/rdf-star-cg-spec.html
[Turtle doc]: https://rubydoc.info/github/ruby-rdf/rdf-turtle/master/file/README.md
[Turtle EBNF]: https://dvcs.w3.org/hg/rdf/file/default/rdf-turtle/turtle.bnf
[Freebase Dumps]: https://developers.google.com/freebase/data
26 changes: 0 additions & 26 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,3 @@ namespace :gem do
sh "gem push pkg/rdf-turtle-#{File.read('VERSION').chomp}.gem"
end
end

desc 'Default: run specs.'
task default: :spec
task specs: :spec

require 'rspec/core/rake_task'
desc 'Run specifications'
RSpec::Core::RakeTask.new do |spec|
spec.rspec_opts = %w(--options spec/spec.opts) if File.exists?('spec/spec.opts')
end

desc "Run specs through RCov"
RSpec::Core::RakeTask.new("spec:rcov") do |spec|
spec.rcov = true
spec.rcov_opts = %q[--exclude "spec"]
end

desc "Generate HTML report specs"
RSpec::Core::RakeTask.new("doc:spec") do |spec|
spec.rspec_opts = ["--format", "html", "-o", "doc/spec.html"]
end

require 'yard'
namespace :doc do
YARD::Rake::YardocTask.new
end
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.2
3.1.3
9 changes: 6 additions & 3 deletions etc/turtle.bnf
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
[5] base ::= BASE IRIREF "."?
[6] triples ::= subject predicateObjectList | blankNodePropertyList predicateObjectList?
[7] predicateObjectList ::= verb objectList ( ";" ( verb objectList)? )*
[8] objectList ::= object ( "," object )*
[8] objectList ::= object annotation? ( "," object annotation? )*
[9] verb ::= predicate | "a"
[10] subject ::= iri | BlankNode | collection | embTriple
[11] predicate ::= iri
[12] object ::= iri | BlankNode | collection | blankNodePropertyList| literal | embTriple
[12] object ::= iri | BlankNode | collection | blankNodePropertyList | literal | embTriple
[13] literal ::= RDFLiteral | NumericLiteral | BooleanLiteral
[14] blankNodePropertyList ::= "[" predicateObjectList "]"
[15] collection ::= "(" object* ")"
[xx] embTriple ::= "<<" subject predicate object ">>"
[16] NumericLiteral ::= INTEGER | DECIMAL | DOUBLE
[128s] RDFLiteral ::= String ( LANGTAG | ( "^^" iri ) )?
[133s] BooleanLiteral ::= "true" | "false"
Expand All @@ -22,6 +21,10 @@
[135s] iri ::= IRIREF | PrefixedName
[136s] PrefixedName ::= PNAME_LN | PNAME_NS
[137s] BlankNode ::= BLANK_NODE_LABEL | ANON
[27] embTriple ::= "<<" embSubject predicate embObject ">>"
[28] embSubject ::= iri | BlankNode | embTriple
[29] embObject ::= iri | BlankNode | literal | embTriple
[30] annotation ::= '{|' predicateObjectList '|}'

@terminals

Expand Down
Loading

0 comments on commit 3bd4a44

Please sign in to comment.