Skip to content

Commit 770861e

Browse files
committed
Add :base_direction as something supported (or not) by writables.
1 parent 0d1aea3 commit 770861e

4 files changed

Lines changed: 10 additions & 1 deletion

File tree

lib/rdf/mixin/enumerable.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ 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
# * `:quoted_triples` supports RDF 1.2 quoted triples.
87+
# * `:base_direction` supports RDF 1.2 directional language-tagged strings.
8788
#
8889
# @param [Symbol, #to_sym] feature
8990
# @return [Boolean]

lib/rdf/mixin/writable.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ def insert_statements(statements)
128128
each = statements.respond_to?(:each_statement) ? :each_statement : :each
129129
statements.__send__(each) do |statement|
130130
if statement.embedded? && respond_to?(:supports?) && !supports?(:quoted_triples)
131-
raise ArgumentError, "Wriable does not support quoted triples"
131+
raise ArgumentError, "Writable does not support quoted triples"
132+
end
133+
if statement.object && statement.object.literal? && statement.object.direction? && !supports?(:base_direction)
134+
raise ArgumentError, "Writable does not support directional languaged-tagged strings"
132135
end
133136
insert_statement(statement)
134137
end

lib/rdf/model/graph.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,9 @@ def insert_statement(statement)
308308
if statement.embedded? && !@data.supports?(:quoted_triples)
309309
raise ArgumentError, "Graph does not support quoted triples"
310310
end
311+
if statement.object && statement.object.literal? && statement.object.direction? && !@data.supports?(:base_direction)
312+
raise ArgumentError, "Graph does not support directional languaged-tagged strings"
313+
end
311314
statement = statement.dup
312315
statement.graph_name = graph_name
313316
@data.insert(statement)

lib/rdf/repository.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ def supports?(feature)
183183
when :literal_equality then true
184184
when :atomic_write then false
185185
when :quoted_triples then false
186+
when :base_direction then false
186187
when :snapshots then false
187188
else false
188189
end
@@ -270,6 +271,7 @@ def supports?(feature)
270271
when :literal_equality then true
271272
when :atomic_write then true
272273
when :quoted_triples then true
274+
when :base_direction then true
273275
when :snapshots then true
274276
else false
275277
end

0 commit comments

Comments
 (0)