spira 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.md CHANGED
@@ -1,4 +1,8 @@
1
1
  # Changelog for Spira <http://github.com/datagraph/spira>
2
+ ## 0.0.10
3
+ * Use RDF::URI.intern on URIs generated via base URIs
4
+ * Added a Spira::Types::Native, which will return the RDF::Value for a given
5
+ predicate directly without any serialization or dserialization.
2
6
 
3
7
  ## 0.0.9
4
8
  * Fix a bug with Spira::Types::Any that prevented blank node objects
@@ -12,6 +16,7 @@
12
16
  * Updating a value to nil will now remove it from the repository on #save!
13
17
  * Tweaks to dirty tracking to correctly catch both changed and updated values.
14
18
  All tests pass for the first time with this change.
19
+ * Change gemspec name to work with bundler
15
20
 
16
21
  ## 0.0.8
17
22
  * Remove type checking for repository addition. More power in return for
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.9
1
+ 0.0.10
@@ -65,7 +65,7 @@ module Spira
65
65
 
66
66
  # This lets including classes reference vocabularies without the RDF:: prefix
67
67
  include Spira::Types
68
- include RDF
68
+ include ::RDF
69
69
  include InstanceMethods
70
70
 
71
71
  end
@@ -128,12 +128,12 @@ module Spira
128
128
  id_for(identifier.to_uri)
129
129
  # see comment with #to_uri above, this might be a fragment
130
130
  when identifier.is_a?(Addressable::URI)
131
- id_for(RDF::URI.new(identifier))
131
+ id_for(RDF::URI.intern(identifier))
132
132
  # This is a #to_s or a URI fragment with a base uri. We'll treat them the same.
133
133
  # FIXME: when #/ makes it into RDF.rb proper, this can all be wrapped
134
134
  # into the one case statement above.
135
135
  else
136
- uri = identifier.is_a?(RDF::URI) ? identifier : RDF::URI.new(identifier.to_s)
136
+ uri = identifier.is_a?(RDF::URI) ? identifier : RDF::URI.intern(identifier.to_s)
137
137
  case
138
138
  when uri.absolute?
139
139
  uri
@@ -141,7 +141,7 @@ module Spira
141
141
  raise ArgumentError, "Cannot create identifier for #{self} by String without base_uri; an RDF::URI is required" if self.base_uri.nil?
142
142
  else
143
143
  separator = self.base_uri.to_s[-1,1] =~ /(\/|#)/ ? '' : '/'
144
- RDF::URI.new(self.base_uri.to_s + separator + identifier.to_s)
144
+ RDF::URI.intern(self.base_uri.to_s + separator + identifier.to_s)
145
145
  end
146
146
  end
147
147
  end
@@ -227,7 +227,7 @@ module Spira
227
227
  raise ResourceDeclarationError, "A :predicate option is required for types without a default vocabulary"
228
228
  else @default_vocabulary
229
229
  separator = @default_vocabulary.to_s[-1,1] =~ /(\/|#)/ ? '' : '/'
230
- RDF::URI.new(@default_vocabulary.to_s + separator + name.to_s)
230
+ RDF::URI.intern(@default_vocabulary.to_s + separator + name.to_s)
231
231
  end
232
232
  if !(predicate.respond_to?(:to_uri))
233
233
  raise ResourceDeclarationError, ":predicate options must be RDF::URIs or strings with a default vocabulary declared"
data/lib/spira/types.rb CHANGED
@@ -21,6 +21,7 @@ module Spira
21
21
  require 'spira/types/float'
22
22
  require 'spira/types/uri'
23
23
  require 'spira/types/decimal'
24
+ require 'spira/types/native'
24
25
 
25
26
 
26
27
  end
@@ -0,0 +1,22 @@
1
+ module Spira::Types
2
+
3
+ ##
4
+ # This type is a native type, doing no conversion to Ruby types. The naked
5
+ # RDF::Value (URI, Node, Literal, etc) will be used, and no deserialization
6
+ # is done.
7
+ #
8
+ # @see Spira::Type
9
+ class Native
10
+
11
+ include Spira::Type
12
+
13
+ def self.unserialize(value)
14
+ value
15
+ end
16
+
17
+ def self.serialize(value)
18
+ value
19
+ end
20
+
21
+ end
22
+ end
data/lib/spira/version.rb CHANGED
@@ -2,7 +2,7 @@ module Spira
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 9
5
+ TINY = 10
6
6
  EXTRA = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY].join('.')
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 9
9
- version: 0.0.9
8
+ - 10
9
+ version: 0.0.10
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ben Lavender
@@ -15,7 +15,7 @@ bindir:
15
15
  - bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-20 00:00:00 +02:00
18
+ date: 2010-10-26 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -132,6 +132,7 @@ files:
132
132
  - lib/spira/types/decimal.rb
133
133
  - lib/spira/types/float.rb
134
134
  - lib/spira/types/integer.rb
135
+ - lib/spira/types/native.rb
135
136
  - lib/spira/types/string.rb
136
137
  - lib/spira/types/uri.rb
137
138
  - lib/spira/types.rb