Skip to content

Commit 625a4c8

Browse files
committed
Finish 3.3.4
2 parents ed82a0b + 59d9c22 commit 625a4c8

20 files changed

+949
-738
lines changed

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,6 @@ A separate [SPARQL][SPARQL doc] gem builds on basic BGP support to provide full
265265
foaf[:name] #=> RDF::URI("http://xmlns.com/foaf/0.1/name")
266266
foaf['mbox'] #=> RDF::URI("http://xmlns.com/foaf/0.1/mbox")
267267

268-
## RDF-star CG
269-
270-
[RDF.rb][] includes provisional support for [RDF-star][] with an N-Triples/N-Quads syntax for quoted triples in the _subject_ or _object_ position.
271-
272-
Support for RDF-star quoted triples is now deprecated, use RDF 1.2 triple terms instead.
273-
274268
## RDF 1.2
275269

276270
[RDF.rb][] includes provisional support for [RDF 1.2][] with an N-Triples/N-Quads syntax for triple terms in the _object_ position.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.3.3
1+
3.3.4

etc/n-triples.ebnf

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1-
ntriplesDoc ::= triple? (EOL triple)* EOL?
1+
ntriplesDoc ::= statement? (EOL statement)* EOL?
2+
statement ::= directive | triple '.'
3+
directive ::= versionDirective
4+
versionDirective ::= 'VERSION' versionSpecifier
5+
versionSpecifier ::= STRING_LITERAL_QUOTE
26
triple ::= subject predicate object '.'
3-
subject ::= IRIREF | BLANK_NODE_LABEL | quotedTriple
7+
subject ::= IRIREF | BLANK_NODE_LABEL
48
predicate ::= IRIREF
5-
object ::= IRIREF | BLANK_NODE_LABEL | literal | tripleTerm | quotedTriple
9+
object ::= IRIREF | BLANK_NODE_LABEL | literal | tripleTerm
610
literal ::= STRING_LITERAL_QUOTE ('^^' IRIREF | LANG_DIR )?
7-
tripleTerm ::= '<<' subject predicate object '>>'
8-
quotedTriple ::= '<<' subject predicate object '>>'
11+
tripleTerm ::= '<<(' subject predicate object ')>>'
912

1013
@terminals
1114

1215
IRIREF ::= '<' ([^#x00-#x20<>"{}|^`\] | UCHAR)* '>'
1316
BLANK_NODE_LABEL ::= '_:' ( PN_CHARS_U | [0-9] ) ((PN_CHARS|'.')* PN_CHARS)?
14-
LANG_DIR ::= "@" [a-zA-Z]+ ( "-" [a-zA-Z0-9]+ )* ('--' [a-zA-Z]+)?`
17+
LANG_DIR ::= '@' [a-zA-Z]+ ( '-' [a-zA-Z0-9]+ )* ( '--' [a-zA-Z]+ )?
1518
STRING_LITERAL_QUOTE ::= '"' ( [^#x22#x5C#xA#xD] | ECHAR | UCHAR )* '"'
16-
UCHAR ::= ( "\u" HEX HEX HEX HEX )
17-
| ( "\U" HEX HEX HEX HEX HEX HEX HEX HEX )
18-
ECHAR ::= ("\" [tbnrf"'])
19+
UCHAR ::= ( '\u' HEX HEX HEX HEX )
20+
| ( '\U' HEX HEX HEX HEX HEX HEX HEX HEX )
21+
ECHAR ::= ('\' [tbnrf\"'])
1922
PN_CHARS_BASE ::= ([A-Z]
2023
| [a-z]
2124
| [#x00C0-#x00D6]
@@ -32,7 +35,7 @@ PN_CHARS_BASE ::= ([A-Z]
3235
| [#x10000-#xEFFFF])
3336
PN_CHARS_U ::= PN_CHARS_BASE | '_'
3437
PN_CHARS ::= (PN_CHARS_U
35-
| "-"
38+
| '-'
3639
| [0-9]
3740
| #x00B7
3841
| [#x0300-#x036F]

lib/rdf/format.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ module RDF
4747
class Format
4848
extend ::Enumerable
4949

50+
##
51+
# RDF defines specific version strings, but does not define normative behavior
52+
VERSIONS = %w{1.1 1.2-basic 1.2}.freeze
53+
5054
##
5155
# Enumerates known RDF serialization format classes.
5256
#

lib/rdf/mixin/enumerable.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ def to_a
8484
# * `:validity` allows a concrete Enumerable implementation to indicate that it does or does not support valididty checking. By default implementations are assumed to support validity checking.
8585
# * `:skolemize` supports [Skolemization](https://www.w3.org/wiki/BnodeSkolemization) of an `Enumerable`. Implementations supporting this feature must implement a `#skolemize` method, taking a base URI used for minting URIs for BNodes as stable identifiers and a `#deskolemize` method, also taking a base URI used for turning URIs having that prefix back into the same BNodes which were originally skolemized.
8686
# * `:rdf_full` supports RDF 1.2 Full profile, including support for embedded Triple Terms.
87-
# * `:quoted_triples` supports RDF-star quoted triples. (DEPRECATED)
8887
# * `:base_direction` supports RDF 1.2 directional language-tagged strings.
8988
#
9089
# @param [Symbol, #to_sym] feature

lib/rdf/mixin/writable.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,8 @@ def insert_graph(graph)
127127
def insert_statements(statements)
128128
each = statements.respond_to?(:each_statement) ? :each_statement : :each
129129
statements.__send__(each) do |statement|
130-
# FIXME: quoted triples are now deprecated
131-
if statement.embedded? && respond_to?(:supports?) && !(supports?(:quoted_triples) || supports?(:rdf_full))
132-
raise ArgumentError, "Writable does not support quoted triples"
130+
if statement.embedded? && respond_to?(:supports?) && !supports?(:rdf_full)
131+
raise ArgumentError, "Writable does not support triple terms"
133132
end
134133
if statement.object && statement.object.literal? && statement.object.direction? && respond_to?(:supports?) && !supports?(:base_direction)
135134
raise ArgumentError, "Writable does not support directional languaged-tagged strings"

lib/rdf/model/dataset.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ def isolation_level
104104
# @private
105105
# @see RDF::Enumerable#supports?
106106
def supports?(feature)
107-
# FIXME: quoted triples are now deprecated
108-
return true if %i(graph_name quoted_triples rdf_full).include?(feature)
107+
return true if %i(graph_name rdf_full).include?(feature)
109108
super
110109
end
111110

lib/rdf/model/graph.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,7 @@ def query_pattern(pattern, **options, &block)
335335
# @private
336336
# @see RDF::Mutable#insert
337337
def insert_statement(statement)
338-
# FIXME: quoted triples are now deprecated
339-
if statement.embedded? && !(@data.supports?(:quoted_triples) || @data.supports?(:rdf_full))
338+
if statement.embedded? && !@data.supports?(:rdf_full)
340339
raise ArgumentError, "Graph does not support the RDF Full profile"
341340
end
342341
if statement.object && statement.object.literal? && statement.object.direction? && !@data.supports?(:base_direction)

lib/rdf/model/statement.rb

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ def self.from(statement, graph_name: nil, **options)
7272
# Note, in RDF 1.1, a graph name MUST be an {Resource}.
7373
# @option options [Boolean] :inferred used as a marker to record that this statement was inferred based on semantic relationships (T-Box).
7474
# @option options [Boolean] :tripleTerm used as a marker to record that this statement appears as the object of another RDF::Statement.
75-
# @option options [Boolean] :quoted used as a marker to record that this statement quoted and appears as the subject or object of another RDF::Statement (deprecated).
7675
# @return [RDF::Statement]
7776
#
7877
# @overload initialize(subject, predicate, object, **options)
@@ -86,7 +85,6 @@ def self.from(statement, graph_name: nil, **options)
8685
# Note, in RDF 1.1, a graph name MUST be an {Resource}.
8786
# @option options [Boolean] :inferred used as a marker to record that this statement was inferred based on semantic relationships (T-Box).
8887
# @option options [Boolean] :tripleTerm used as a marker to record that this statement appears as the object of another RDF::Statement.
89-
# @option options [Boolean] :quoted used as a marker to record that this statement quoted and appears as the subject or object of another RDF::Statement (deprecated).
9088
# @return [RDF::Statement]
9189
def initialize(subject = nil, predicate = nil, object = nil, options = {})
9290
if subject.is_a?(Hash)
@@ -187,7 +185,7 @@ def variable?(*args)
187185
# Note: Nomenclature is evolving, alternatives could include `#complex?` and `#nested?`
188186
# @return [Boolean]
189187
def embedded?
190-
subject && subject.statement? || object && object.statement?
188+
object && object.statement?
191189
end
192190

193191
##
@@ -208,7 +206,7 @@ def valid?
208206
##
209207
# @return [Boolean]
210208
def asserted?
211-
!quoted?
209+
!embedded?
212210
end
213211

214212
##
@@ -217,13 +215,6 @@ def tripleTerm?
217215
!!@options[:tripleTerm]
218216
end
219217

220-
##
221-
# @return [Boolean]
222-
# @deprecated Quoted triples are now deprecated
223-
def quoted?
224-
!!@options[:quoted]
225-
end
226-
227218
##
228219
# @return [Boolean]
229220
def inferred?

lib/rdf/nquads.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,14 @@ def read_triple
7070
line = @line # for backtracking input in case of parse error
7171

7272
begin
73-
unless blank? || read_comment
74-
# FIXME: quoted triples are now deprecated
75-
subject = read_uriref || read_node || read_quotedTriple || fail_subject
73+
if blank? || read_comment
74+
# No-op
75+
elsif version = read_version
76+
@options[:version] = version
77+
else
78+
subject = read_uriref || read_node || fail_subject
7679
predicate = read_uriref(intern: true) || fail_predicate
77-
object = read_uriref || read_node || read_literal || read_tripleTerm || read_quotedTriple || fail_object
80+
object = read_uriref || read_node || read_literal || read_tripleTerm || fail_object
7881
graph_name = read_uriref || read_node
7982
if validate? && !read_eos
8083
log_error("Expected end of statement (found: #{current_line.inspect})", lineno: lineno, exception: RDF::ReaderError)

0 commit comments

Comments
 (0)