Skip to content

Commit 46cfbf7

Browse files
committed
Update N-Triples/N-Quads production names for quoted triples.
1 parent 10f6523 commit 46cfbf7

5 files changed

Lines changed: 18 additions & 18 deletions

File tree

etc/n-triples-star.ebnf

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
[1] ntriplesDoc ::= triple? (EOL triple)* EOL?
2-
[2] triple ::= subject predicate object '.'
3-
[3] subject ::= IRIREF | BLANK_NODE_LABEL | embTriple
4-
[4] predicate ::= IRIREF
5-
[5] object ::= IRIREF | BLANK_NODE_LABEL | literal | embTriple
6-
[6] literal ::= STRING_LITERAL_QUOTE ('^^' IRIREF | LANGTAG)?
7-
[7] embTriple ::= '<<' subject predicate object '>>'
1+
[1] ntriplesDoc ::= triple? (EOL triple)* EOL?
2+
[2] triple ::= subject predicate object '.'
3+
[3] subject ::= IRIREF | BLANK_NODE_LABEL | quotedTriple
4+
[4] predicate ::= IRIREF
5+
[5] object ::= IRIREF | BLANK_NODE_LABEL | literal | quotedTriple
6+
[6] literal ::= STRING_LITERAL_QUOTE ('^^' IRIREF | LANGTAG)?
7+
[7] quotedTriple ::= '<<' subject predicate object '>>'

lib/rdf/nquads.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ def read_triple
6969

7070
begin
7171
unless blank? || read_comment
72-
subject = read_uriref || read_node || read_embTriple || fail_subject
72+
subject = read_uriref || read_node || read_quotedTriple || fail_subject
7373
predicate = read_uriref(intern: true) || fail_predicate
74-
object = read_uriref || read_node || read_literal || read_embTriple || fail_object
74+
object = read_uriref || read_node || read_literal || read_quotedTriple || fail_object
7575
graph_name = read_uriref || read_node
7676
if validate? && !read_eos
7777
log_error("Expected end of statement (found: #{current_line.inspect})", lineno: lineno, exception: RDF::ReaderError)

lib/rdf/ntriples/reader.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def read_value
213213
begin
214214
read_statement
215215
rescue RDF::ReaderError
216-
value = read_uriref || read_node || read_literal || read_embTriple
216+
value = read_uriref || read_node || read_literal || read_quotedTriple
217217
log_recover
218218
value
219219
end
@@ -229,9 +229,9 @@ def read_triple
229229

230230
begin
231231
unless blank? || read_comment
232-
subject = read_uriref || read_node || read_embTriple || fail_subject
232+
subject = read_uriref || read_node || read_quotedTriple || fail_subject
233233
predicate = read_uriref(intern: true) || fail_predicate
234-
object = read_uriref || read_node || read_literal || read_embTriple || fail_object
234+
object = read_uriref || read_node || read_literal || read_quotedTriple || fail_object
235235

236236
if validate? && !read_eos
237237
log_error("Expected end of statement (found: #{current_line.inspect})", lineno: lineno, exception: RDF::ReaderError)
@@ -247,11 +247,11 @@ def read_triple
247247

248248
##
249249
# @return [RDF::Statement]
250-
def read_embTriple
250+
def read_quotedTriple
251251
if @options[:rdfstar] && match(ST_START)
252-
subject = read_uriref || read_node || read_embTriple || fail_subject
252+
subject = read_uriref || read_node || read_quotedTriple || fail_subject
253253
predicate = read_uriref(intern: true) || fail_predicate
254-
object = read_uriref || read_node || read_literal || read_embTriple || fail_object
254+
object = read_uriref || read_node || read_literal || read_quotedTriple || fail_object
255255
if !match(ST_END)
256256
log_error("Expected end of statement (found: #{current_line.inspect})", lineno: lineno, exception: RDF::ReaderError)
257257
end

lib/rdf/ntriples/writer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def format_statement(statement, **options)
227227
# @param [RDF::Statement] statement
228228
# @param [Hash{Symbol => Object}] options ({})
229229
# @return [String]
230-
def format_embTriple(statement, **options)
230+
def format_quotedTriple(statement, **options)
231231
"<<%s %s %s>>" % statement.to_a.map { |value| format_term(value, **options) }
232232
end
233233
##

lib/rdf/writer.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ def format_term(term, **options)
516516
when RDF::Literal then format_literal(term, **options)
517517
when RDF::URI then format_uri(term, **options)
518518
when RDF::Node then format_node(term, **options)
519-
when RDF::Statement then format_embTriple(term, **options)
519+
when RDF::Statement then format_quotedTriple(term, **options)
520520
else nil
521521
end
522522
end
@@ -574,7 +574,7 @@ def format_list(value, **options)
574574
# @return [String]
575575
# @raise [NotImplementedError] unless implemented in subclass
576576
# @abstract
577-
def format_embTriple(value, **options)
577+
def format_quotedTriple(value, **options)
578578
raise NotImplementedError.new("#{self.class}#format_statement") # override in subclasses
579579
end
580580

0 commit comments

Comments
 (0)