rdf_context 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt CHANGED
@@ -1,3 +1,6 @@
1
+ === 0.5.2
2
+ * Remove old binding for a namespace URI creating a new binding
3
+
1
4
  === 0.5.1
2
5
  * Avoid stack-overflow when checking graph size (if $DEBUG == true)
3
6
  * Refactor serializers to be based on AbstractSerializer
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.1
1
+ 0.5.2
@@ -506,6 +506,8 @@ module RdfContext
506
506
  #
507
507
  # Bind namespace to store, returns bound namespace
508
508
  def bind(namespace)
509
+ # Remove existing bindings for the same URI
510
+ executeSQL("DELETE FROM #{namespace_binds} WHERE uri=?", namespace.uri)
509
511
  executeSQL("INSERT INTO #{namespace_binds} VALUES (?, ?)", namespace.prefix, namespace.uri)
510
512
  # May throw exception, should be handled in driver-specific class
511
513
 
@@ -37,8 +37,10 @@ module RdfContext
37
37
  def bind(namespace)
38
38
  # Over-write an empty prefix
39
39
  uri = namespace.uri.to_s
40
- @uri_binding[uri] = namespace unless namespace.prefix.to_s.empty?
41
- @uri_binding[uri] ||= namespace
40
+ @uri_binding.delete(uri)
41
+ @nsbinding.delete_if {|prefix, ns| ns.uri.to_s == uri}
42
+
43
+ @uri_binding[uri] = namespace
42
44
  @nsbinding[namespace.prefix.to_s] = namespace
43
45
  end
44
46
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 1
9
- version: 0.5.1
8
+ - 2
9
+ version: 0.5.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Gregg Kellogg
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-02 00:00:00 -07:00
17
+ date: 2010-04-11 00:00:00 -07:00
18
18
  default_executable: rdf_context
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency