3
3
[ Turtle] [ ] reader/writer for [ RDF.rb] [ RDF.rb ] .
4
4
5
5
[ ![ 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 )
8
9
9
10
## Description
10
11
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
65
66
end
66
67
# => RDF::ReaderError
67
68
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.
69
70
70
71
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}
72
73
end
73
- graph.count #=> 2
74
+ graph.count #=> 1
75
+
76
+ ### Reading a Graph containing statement annotations
74
77
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.
76
80
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
+ )
77
86
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}
79
88
end
80
- graph.count #=> 1
89
+ # => RDF::ReaderError
90
+
91
+ Note that this requires the ` rdfstar ` option to be se.
81
92
82
93
## Documentation
83
94
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
159
170
list in the the ` README ` . Alphabetical order applies.
160
171
* Do note that in order for us to merge any non-trivial changes (as a rule
161
172
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.
163
176
164
177
## License
165
178
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
171
184
[ RDF ] : https://www.w3.org/RDF/
172
185
[ YARD ] : https://yardoc.org/
173
186
[ 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
175
188
[ RDF.rb ] : https://rubydoc.info/github/ruby-rdf/rdf
176
189
[ EBNF ] : https://rubygems.org/gems/ebnf
177
190
[ Backports ] : https://rubygems.org/gems/backports
178
191
[ N-Triples ] : https://www.w3.org/TR/rdf-testcases/#ntriples
179
192
[ 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
181
194
[ Turtle doc ] : https://rubydoc.info/github/ruby-rdf/rdf-turtle/master/file/README.md
182
195
[ Turtle EBNF ] : https://dvcs.w3.org/hg/rdf/file/default/rdf-turtle/turtle.bnf
183
196
[ Freebase Dumps ] : https://developers.google.com/freebase/data
0 commit comments