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
* A new class `RDF::Changeset` has been added. This is meant to replace any
5
+
previous use of `RDF::Transaction`, which in fact used to in RDF.rb 1.x
6
+
represent more of a buffered changeset than a genuine transaction scope.
7
+
8
+
- Instead of `RDF::Transaction.execute`, use `RDF::Changeset.apply`.
9
+
- Instead of `RDF::Transaction#execute`, use `RDF::Changeset#apply`.
10
+
11
+
* The `RDF::Transaction` class has been substantially revamped, including
12
+
some minor backwards-incompatible changes. These changes will mostly
13
+
affect repository implementors, not so much general RDF.rb users.
14
+
15
+
The changes reflect the expanded purpose of the class: instead of being a
16
+
mere buffered changeset (for which, see `RDF::Changeset`), transactions
17
+
are now intended to provide a proper ACID scope for repository queries and
18
+
mutations.
19
+
20
+
We always now also carefully distinguish between read-only and read/write
21
+
transactions, in order to enable repository implementations to take out the
22
+
appropriate locks for concurrency control. Note as well that transactions
23
+
are now read-only by default; mutability must be explicitly requested on
24
+
construction in order to obtain a read/write transaction.
25
+
26
+
In case repository implementations should be unable to provide actual ACID
27
+
guarantees for transactions, that must be clearly indicated in their
28
+
documentation. Similarly, implementations should throw an exception when
29
+
appropriate in case they don't provide write transaction support.
30
+
31
+
-`RDF::Transaction#initialize` now takes the target repository as its
32
+
first argument. Transactions are now always tied to a specific
33
+
repository instance, instead of being free-floating objects as they used
34
+
to be (for that, see `RDF::Changeset`).
35
+
36
+
-`RDF::Transaction` now mixes in `RDF::Queryable` and `RDF::Enumerable`,
37
+
enabling quad-pattern matches and BGP queries to execute in a proper
38
+
transaction scope.
39
+
40
+
- The `RDF::Transaction#context` accessor, and its aliases, have been
41
+
removed. Transactions aren't necessarily scoped to a single graph only.
42
+
43
+
- There is a new `RDF::Transaction#repository` accessor for retrieving the
44
+
target repository object that the transaction operates upon.
45
+
46
+
- There is a new `RDF::Transaction#buffered?` predicate for testing
47
+
whether the changeset that constitutes a transaction is available for
48
+
introspection. Particular repository implementations may support both
49
+
options and permit the user the choice on transaction construction.
50
+
51
+
- The `RDF::Transaction#inserts` and `#deletes` methods are deprecated.
52
+
Instead, there is a new `RDF::Transaction#changes` accessor to retrieve
53
+
an `RDF::Changeset` instance, which contains corresponding methods.
54
+
For unbuffered transactions, `#changes` returns `nil`.
55
+
56
+
* Enumerables vs. Enumerators
57
+
58
+
-`RDF::Queryable#query` and `RDF::Query#execute` not return an enumerable, which may be an enumerator. Most internal uses return an Array now, which aides performance for small result sets, but potentially causes problems for large result sets. Implementations may still return an Enumerator, and Enumerators may be passed as arguments.
59
+
-`RDF::Enumerable#statements`, `#quads`, `#triples`, `#subjects`, `#predicates`, `#objects`, and `#contexts` now return an array rather than an Enumerator.
60
+
61
+
* The following vocabularies are deprecated and have been moved to the rdf-vocab gem.
[](https://gitter.im/ruby-rdf/rdf?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
15
17
16
18
## Features
@@ -28,8 +30,7 @@ This is a pure-Ruby library for working with [Resource Description Framework
28
30
not modify any of Ruby's core classes or standard library.
29
31
* Based entirely on Ruby's autoloading, meaning that you can generally make
30
32
use of any one part of the library without needing to load up the rest.
31
-
* Compatible with Ruby Ruby 1.9.2, Ruby 2.0, Rubinius and JRuby 1.7+.
32
-
* Compatible with older Ruby versions with the help of the [Backports][] gem.
33
+
* Compatible with Ruby Ruby 2.x, Rubinius and JRuby 1.7+ (in Ruby 2.0 mode).
33
34
* Performs auto-detection of input to select appropriate Reader class if one
34
35
cannot be determined from file characteristics.
35
36
@@ -50,12 +51,12 @@ the 1.1 release of RDF.rb:
50
51
* Introduces {RDF::IRI}, as a synonym for {RDF::URI} either {RDF::IRI} or {RDF::URI} can be used interchangeably. Versions of RDF.rb prior to the 1.1 release were already compatible with IRIs. Internationalized Resource Identifiers (see [RFC3987][]) are a super-set of URIs (see [RFC3986][]) which allow for characters other than standard US-ASCII.
51
52
* {RDF::URI} no longer uses the `Addressable` gem. As URIs typically don't need to be parsed, this provides a substantial performance improvement when enumerating or querying graphs and repositories.
52
53
* {RDF::List} no longer emits a `rdf:List` type. However, it will now recognize any subjects that are {RDF::Node} instances as being list elements, as long as they have both `rdf:first` and `rdf:rest` predicates.
53
-
* {RDF::Graph} adding a `context` to a graph may only be done when the underlying storage model supports contexts (the default {RDF::Repository} does). The notion of `context` in RDF.rb is treated equivalently to [Named Graphs](http://www.w3.org/TR/rdf11-concepts/#dfn-named-graph) within an RDF Dataset, and graphs on their own are not named.
54
+
* {RDF::Graph} adding a `graph_name` to a graph may only be done when the underlying storage model supports graph_names (the default {RDF::Repository} does). The notion of `graph_name` in RDF.rb is treated equivalently to [Named Graphs](http://www.w3.org/TR/rdf11-concepts/#dfn-named-graph) within an RDF Dataset, and graphs on their own are not named.
54
55
* {RDF::Graph}, {RDF::Statement} and {RDF::List} now include {RDF::Value}, and not {RDF::Resource}. Made it clear that using {RDF::Graph} does not mean that it may be used within an {RDF::Statement}, for this see {RDF::Term}.
55
56
* {RDF::Statement} now is stricter about checking that all elements are valid when validating.
56
57
* {RDF::NTriples::Writer} and {RDF::NQuads::Writer} now default to validate output, only allowing valid statements to be emitted. This may disabled by setting the `:validate` option to `false`.
57
58
* {RDF::Dataset} is introduced as a class alias of {RDF::Repository}. This allows closer alignment to the RDF concept of [Dataset](http://www.w3.org/TR/rdf11-concepts/#dfn-dataset).
58
-
* The `context` (or `name`) of a named graph within a Dataset or Repository may be either an {RDF::IRI} or {RDF::Node}. Implementations of repositories may restrict this to being only {RDF::IRI}.
59
+
* The `graph_name`of a graph within a Dataset or Repository may be either an {RDF::IRI} or {RDF::Node}. Implementations of repositories may restrict this to being only {RDF::IRI}.
59
60
* There are substantial and somewhat incompatible changes to {RDF::Literal}. In [RDF 1.1][], all literals are typed, including plain literals and language tagged literals. Internally, plain literals are given the `xsd:string` datatype and language tagged literals are given the `rdf:langString` datatype. Creating a plain literal, without a datatype or language, will automatically provide the `xsd:string` datatype; similar for language tagged literals. Note that most serialization formats will remove this datatype. Code which depends on a literal having the `xsd:string` datatype being different from a plain literal (formally, without a datatype) may break. However note that the `#has\_datatype?` will continue to return `false` for plain or language-tagged literals.
60
61
* {RDF::Query#execute} now accepts a block and returns {RDF::Query::Solutions}. This allows `enumerable.query(query)` to behave like `query.execute(enumerable)` and either return an enumerable or yield each solution.
61
62
* {RDF::Queryable#query} now returns {RDF::Query::Solutions} instead of an Enumerator if it's argument is an {RDF::Query}.
@@ -146,15 +147,15 @@ appropriate writer to use.
146
147
147
148
RDF::Writer.open("hello.nq", format: :nquads) do |writer|
0 commit comments