You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](https://gitter.im/ruby-rdf/rdf?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
@@ -39,6 +39,22 @@ resources. Clients may also consider using [RestClient Components][] to enable
39
39
client-side caching of HTTP results using [Rack::Cache][] or other Rack
40
40
middleware.
41
41
42
+
See {RDF::Util::File} for configuring other mechanisms for retrieving resources.
43
+
44
+
### Term caching and configuration.
45
+
46
+
RDF.rb uses a weak-reference cache for storing internalized versions of URIs and Nodes. This is particularly useful for Nodes as two nodes are equivalent only if they're the same node.
47
+
48
+
By default, each cache can grow to an unlimited size, but this can be configured using {RDF.config}, for general limits, along with URI- or Node-specific limits.
49
+
50
+
For example, to limit the size of the URI intern cache only:
51
+
52
+
RDF.config.uri_cache_size = 10_000
53
+
54
+
The default for creating new caches without a specific initialization size can be set using:
55
+
56
+
RDF.config.cache_size = 100_000
57
+
42
58
## Differences between RDF 1.0 and RDF 1.1
43
59
44
60
This version of RDF.rb is fully compatible with [RDF 1.1][], but it creates some
@@ -246,17 +262,10 @@ By default, the N-Triples reader will reject a document containing a subject res
246
262
end
247
263
# => RDF::ReaderError
248
264
249
-
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:
Copy file name to clipboardExpand all lines: lib/rdf/model/list.rb
+29-4Lines changed: 29 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -49,14 +49,23 @@ def self.[](*values)
49
49
# g = RDF::Graph.new << l
50
50
# g.count # => l.count
51
51
#
52
+
# @example use a transaction for block initialization
53
+
# l = RDF::List(graph: graph, wrap_transaction: true) do |list|
54
+
# list << RDF::Literal(1)
55
+
# # list.graph.rollback will rollback all list changes within this block.
56
+
# end
57
+
# list.count #=> 1
58
+
#
52
59
# @param [RDF::Resource] subject (RDF.nil)
53
60
# Subject should be an {RDF::Node}, not a {RDF::URI}. A list with an IRI head will not validate, but is commonly used to detect if a list is valid.
54
61
# @param [RDF::Graph] graph (RDF::Graph.new)
55
62
# @param [Array<RDF::Term>] values
56
63
# Any values which are not terms are coerced to `RDF::Literal`.
64
+
# @param [Boolean] wrap_transaction (false)
65
+
# Wraps the callback in a transaction, and replaces the graph with that transaction for the duraction of the callback. This has the effect of allowing any list changes to be made atomically, or rolled back.
Copy file name to clipboardExpand all lines: lib/rdf/model/node.rb
+2-6Lines changed: 2 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -13,18 +13,14 @@ class Node
13
13
includeRDF::Resource
14
14
15
15
##
16
-
# Defines the maximum number of interned Node references that can be held
17
-
# cached in memory at any one time.
16
+
# Cache size may be set through {RDF.config} using `node_cache_size`.
18
17
#
19
18
# @note caching interned nodes means that two different invocations using the same symbol will result in the same node, which may not be appropriate depending on the graph from which it is used. RDF requires that bnodes with the same label are, in fact, different bnodes, unless they are used within the same document.
0 commit comments