Skip to content

Commit babb6fc

Browse files
committed
Finish 3.1.1
2 parents 0d06bb3 + 03545a8 commit babb6fc

File tree

17 files changed

+1182
-800
lines changed

17 files changed

+1182
-800
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ group :development, :test do
1515
gem 'rdf-spec', git: "https://github.com/ruby-rdf/rdf-spec", branch: "develop"
1616
gem 'rdf-isomorphic', git: "https://github.com/ruby-rdf/rdf-isomorphic", branch: "develop"
1717
gem 'rdf-vocab', git: "https://github.com/ruby-rdf/rdf-vocab", branch: "develop"
18+
gem 'rdf-xsd', git: "https://github.com/ruby-rdf/rdf-xsd", branch: "develop"
1819
gem 'sxp', git: "https://github.com/dryruby/sxp.rb", branch: "develop"
1920
gem "redcarpet", platforms: :ruby
2021
gem 'simplecov', platforms: :mri

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Install with `gem install rdf-turtle`
1919
* Implements a complete parser for [Turtle][].
2020
* Compatible with Ruby >= 2.2.2.
2121
* Optional streaming writer, to serialize large graphs
22+
* Provisional support for [Turtle*][RDF*].
2223

2324
## Usage
2425
Instantiate a reader from a local file:
@@ -35,6 +36,50 @@ Write a graph to a file:
3536
writer << graph
3637
end
3738

39+
## Turtle* (RDFStar)
40+
41+
Both reader and writer include provisional support for [Turtle*][RDF*].
42+
43+
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`.
44+
45+
**Note: This feature is subject to change or elimination as the standards process progresses.**
46+
47+
### Serializing a Graph containing embedded statements
48+
49+
require 'rdf/turtle'
50+
statement = RDF::Statement(RDF::URI('bob'), RDF::Vocab::FOAF.age, RDF::Literal(23))
51+
graph = RDF::Graph.new << [statement, RDF::URI("ex:certainty"), RDF::Literal(0.9)]
52+
graph.dump(:ttl, validate: false, standard_prefixes: true)
53+
# => '<<<bob> foaf:age 23>> <ex:certainty> 9.0e-1 .'
54+
55+
### Reading a Graph containing embedded statements
56+
57+
By default, the Turtle reader will reject a document containing a subject resource.
58+
59+
ttl = %(
60+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
61+
@prefix ex: <http://example.com/> .
62+
<<<bob> foaf:age 23>> ex:certainty 9.0e-1 .
63+
)
64+
graph = RDF::Graph.new do |graph|
65+
RDF::Turtle::Reader.new(ttl) {|reader| graph << reader}
66+
end
67+
# => RDF::ReaderError
68+
69+
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:
70+
71+
graph = RDF::Graph.new do |graph|
72+
RDF::Turtle::Reader.new(ttl, rdfstar: :PG) {|reader| graph << reader}
73+
end
74+
graph.count #=> 2
75+
76+
When using the `:SA` mode, only one statement is asserted, although the reified statement is contained within the graph.
77+
78+
graph = RDF::Graph.new do |graph|
79+
RDF::Turtle::Reader.new(ttl, rdfstar: :SA) {|reader| graph << reader}
80+
end
81+
graph.count #=> 1
82+
3883
## Documentation
3984
Full documentation available on [Rubydoc.info][Turtle doc]
4085

@@ -133,6 +178,7 @@ A copy of the [Turtle EBNF][] and derived parser files are included in the repos
133178
[Backports]: https://rubygems.org/gems/backports
134179
[N-Triples]: https://www.w3.org/TR/rdf-testcases/#ntriples
135180
[Turtle]: https://www.w3.org/TR/2012/WD-turtle-20120710/
181+
[RDF*]: https://lists.w3.org/Archives/Public/public-rdf-star/
136182
[Turtle doc]: https://rubydoc.info/github/ruby-rdf/rdf-turtle/master/file/README.md
137183
[Turtle EBNF]: https://dvcs.w3.org/hg/rdf/file/default/rdf-turtle/turtle.bnf
138184
[Freebase Dumps]: https://developers.google.com/freebase/data

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

etc/doap-ntriples.ttl

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,28 @@
1+
@base <https://rubygems.org/gems/rdf> .
12
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
23
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
34
@prefix dc: <http://purl.org/dc/terms/> .
4-
@prefix earl: <http://www.w3.org/ns/earl#> .
55
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
66
@prefix doap: <http://usefulinc.com/ns/doap#> .
7-
@prefix ex: <http://example.org/> .
8-
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
97

10-
<https://rubygems.org/gems/rdf> a doap:Project ;
8+
<> a doap:Project ;
119
doap:name "RDF.rb" ;
1210
doap:homepage <https://rubygems.org/gems/rdf> ;
13-
doap:license <http://creativecommons.org/licenses/publicdomain/> ;
11+
doap:license <https://unlicense.org/1.0/> ;
1412
doap:shortdesc "A Ruby library for working with Resource Description Framework (RDF) data."@en ;
1513
doap:description "RDF.rb is a pure-Ruby library for working with Resource Description Framework (RDF) data."@en ;
1614
doap:created "2007-10-23" ;
17-
doap:platform "Ruby" ;
15+
doap:programming-language "Ruby" ;
1816
doap:category <http://dbpedia.org/resource/Resource_Description_Framework>,
1917
<http://dbpedia.org/resource/Ruby_(programming_language)> ;
20-
doap:implements <https://www.w3.org/TR/rdf11-concepts/>,
21-
<https://www.w3.org/TR/n-quads/>,
22-
<https://www.w3.org/TR/n-triples/> ;
18+
doap:implements <http://www.w3.org/TR/rdf11-concepts/>,
19+
<http://www.w3.org/TR/n-quads/>,
20+
<http://www.w3.org/TR/n-triples/> ;
2321
doap:download-page <https://rubygems.org/gems/rdf/> ;
2422
doap:bug-database <https://github.com/ruby-rdf/rdf/issues> ;
25-
doap:blog <https://ar.to/>, <http://blog.datagraph.org/> ;
26-
doap:vendor <http://datagraph.org/> ;
23+
doap:blog <https://ar.to/>, <https://greggkellogg.net/> ;
2724
doap:developer <https://ar.to/#self>, <https://bhuga.net/#ben>, <https://greggkellogg.net/foaf#me> ;
28-
doap:maintainer <https://ar.to/#self>, <https://bhuga.net/#ben>, <https://greggkellogg.net/foaf#me> ;
25+
doap:maintainer <https://greggkellogg.net/foaf#me> ;
2926
doap:documenter <https://ar.to/#self>, <https://bhuga.net/#ben>, <https://greggkellogg.net/foaf#me> ;
3027
doap:helper [a foaf:Person ;
3128
foaf:name "Călin Ardelean" ;
@@ -63,19 +60,17 @@
6360
foaf:mbox_sha1sum "a033f652c84a4d73b8c26d318c2395699dd2bdfb",
6461
"d0737cceb55eb7d740578d2db1bc0727e3ed49ce" ;
6562
foaf:homepage <https://ar.to/> ;
66-
foaf:made <> ;
67-
rdfs:isDefinedBy <http://datagraph.org/bendiken/foaf> .
63+
foaf:made <> .
6864

6965
<https://bhuga.net/#ben> a foaf:Person ;
7066
foaf:name "Ben Lavender" ;
7167
foaf:mbox <mailto:blavender@gmail.com> ;
7268
foaf:mbox_sha1sum "dbf45f4ffbd27b67aa84f02a6a31c144727d10af" ;
73-
foaf:homepage <https://bhuga.net/> ;
74-
rdfs:isDefinedBy <http://datagraph.org/bhuga/foaf> .
69+
foaf:homepage <https://bhuga.net/> .
7570

7671
<https://greggkellogg.net/foaf#me> a foaf:Person ;
7772
foaf:name "Gregg Kellogg" ;
7873
foaf:mbox <mailto:gregg@greggkellogg.net> ;
7974
foaf:mbox_sha1sum "35bc44e6d0070e5ad50ccbe0d24403c96af2b9bd" ;
8075
foaf:homepage <https://greggkellogg.net/>;
81-
rdfs:isDefinedBy <https://greggkellogg.net/foaf> .
76+
rdfs:isDefinedBy <https://greggkellogg.net/foaf> .

etc/doap.nt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<https://rubygems.org/gems/rdf-turtle> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/ns/earl#Software> .
44
<https://rubygems.org/gems/rdf-turtle> <http://usefulinc.com/ns/doap#name> "RDF::Turtle" .
55
<https://rubygems.org/gems/rdf-turtle> <http://usefulinc.com/ns/doap#homepage> <https://ruby-rdf.github.com/rdf-turtle> .
6-
<https://rubygems.org/gems/rdf-turtle> <http://usefulinc.com/ns/doap#license> <http://creativecommons.org/licenses/publicdomain/> .
6+
<https://rubygems.org/gems/rdf-turtle> <http://usefulinc.com/ns/doap#license> <https://unlicense.org/1.0/> .
77
<https://rubygems.org/gems/rdf-turtle> <http://usefulinc.com/ns/doap#shortdesc> "Turtle reader/writer for Ruby."@en .
88
<https://rubygems.org/gems/rdf-turtle> <http://usefulinc.com/ns/doap#description> "RDF::Turtle is an Turtle reader/writer for the RDF.rb library suite."@en .
99
<https://rubygems.org/gems/rdf-turtle> <http://usefulinc.com/ns/doap#created> "2011-08-29"^^<http://www.w3.org/2001/XMLSchema#date> .

etc/doap.ttl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@base <https://rubygems.org/gems/rdf-turtle> .
12
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
23
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
34
@prefix dc: <http://purl.org/dc/terms/> .
@@ -7,18 +8,18 @@
78
@prefix ex: <http://example.org/> .
89
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
910

10-
<https://rubygems.org/gems/rdf-turtle> a doap:Project, earl:TestSubject, earl:Software ;
11+
<> a doap:Project, earl:TestSubject, earl:Software ;
1112
doap:name "RDF::Turtle" ;
1213
doap:homepage <https://ruby-rdf.github.com/rdf-turtle> ;
13-
doap:license <http://creativecommons.org/licenses/publicdomain/> ;
14+
doap:license <https://unlicense.org/1.0/> ;
1415
doap:shortdesc "Turtle reader/writer for Ruby."@en ;
1516
doap:description "RDF::Turtle is an Turtle reader/writer for the RDF.rb library suite."@en ;
1617
doap:created "2011-08-29"^^xsd:date ;
1718
doap:programming-language "Ruby" ;
1819
doap:implements <https://www.w3.org/TR/turtle/> ;
1920
doap:category <http://dbpedia.org/resource/Resource_Description_Framework>,
2021
<http://dbpedia.org/resource/Ruby_(programming_language)> ;
21-
doap:download-page <https://rubygems.org/gems/rdf-turtle> ;
22+
doap:download-page <> ;
2223
doap:mailing-list <https://lists.w3.org/Archives/Public/public-rdf-ruby/> ;
2324
doap:bug-database <https://github.com/ruby-rdf/rdf-turtle/issues> ;
2425
doap:blog <https://greggkellogg.net/> ;

0 commit comments

Comments
 (0)