File: index.rb

package info (click to toggle)
libdb-ruby 0.6.5-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 2,596 kB
  • ctags: 3,978
  • sloc: ansic: 13,984; cpp: 8,739; ruby: 7,864; sh: 47; makefile: 6
file content (33 lines) | stat: -rw-r--r-- 1,030 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/ruby -I../../src -I..
require 'bdbxml'

index = BDB::XML::Index.new

index.add(BDB::XML::Namespace["uri"], BDB::XML::Name["default"], 
	  "node-attribute-substring-string")

index.add("http://moulon/", "ref2", "node-attribute-equality-string")
index.add("http://moulon/", "ref0", "node-attribute-equality-string")
index.add("http://moulon/", "ref1", "node-element-presence-none")

index.each do |url, name, val|
   puts "#{url}, #{name}, #{val}"
end

p index.find("http://moulon/", "ref2")
p index.find("", "ref2")

index.add("http://moulon/", "ref0", "node-element-presence-none")
index.add("http://moulon/", "ref0", "edge-attribute-equality-string")
p index.find("http://moulon/", "ref0")

index.delete("http://moulon/", "ref0", "node-attribute-equality-string")
p index.find("http://moulon/", "ref0")

index.replace("http://moulon/", "ref0", "edge-element-presence-none")
p index.find("http://moulon/", "ref0")

index.replace("http://moulon/", "ref0", "none-none-none-none")
p index.find("http://moulon/", "ref0")