rdf-sesame 0.0.0

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/AUTHORS ADDED
@@ -0,0 +1 @@
1
+ * Arto Bendiken <arto.bendiken@gmail.com>
data/README ADDED
@@ -0,0 +1,49 @@
1
+ RDF::Sesame: Sesame 2.0 Adapter for RDF.rb
2
+ ==========================================
3
+
4
+ This is a Sesame 2.0 adapter for [RDF.rb](http://rdf.rubyforge.org/).
5
+
6
+ ### About Sesame
7
+
8
+ * <http://www.openrdf.org/>
9
+
10
+ Documentation
11
+ -------------
12
+
13
+ * <http://rdf.rubyforge.org/>
14
+
15
+ Dependencies
16
+ ------------
17
+
18
+ * [RDF.rb](http://rdf.rubyforge.org/) (>= 0.0.6)
19
+
20
+ Installation
21
+ ------------
22
+
23
+ The recommended installation method is via RubyGems. To install the latest
24
+ official release from Gemcutter, do:
25
+
26
+ % [sudo] gem install rdf-sesame
27
+
28
+ Download
29
+ --------
30
+
31
+ To get a local working copy of the development repository, do:
32
+
33
+ % git clone git://github.com/bendiken/rdf-sesame.git
34
+
35
+ Alternatively, you can download the latest development version as a tarball
36
+ as follows:
37
+
38
+ % wget http://github.com/bendiken/rdf-sesame/tarball/master
39
+
40
+ Author
41
+ ------
42
+
43
+ * [Arto Bendiken](mailto:arto.bendiken@gmail.com) - <http://ar.to/>
44
+
45
+ License
46
+ -------
47
+
48
+ RDF::Sesame is free and unencumbered public domain software. For more
49
+ information, see <http://unlicense.org/> or the accompanying UNLICENSE file.
data/UNLICENSE ADDED
@@ -0,0 +1,24 @@
1
+ This is free and unencumbered software released into the public domain.
2
+
3
+ Anyone is free to copy, modify, publish, use, compile, sell, or
4
+ distribute this software, either in source code form or as a compiled
5
+ binary, for any purpose, commercial or non-commercial, and by any
6
+ means.
7
+
8
+ In jurisdictions that recognize copyright laws, the author or authors
9
+ of this software dedicate any and all copyright interest in the
10
+ software to the public domain. We make this dedication for the benefit
11
+ of the public at large and to the detriment of our heirs and
12
+ successors. We intend this dedication to be an overt act of
13
+ relinquishment in perpetuity of all present and future rights to this
14
+ software under copyright law.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ For more information, please refer to <http://unlicense.org/>
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.0
data/lib/rdf/sesame.rb ADDED
@@ -0,0 +1,21 @@
1
+ require 'rdf'
2
+
3
+ module RDF
4
+ ##
5
+ # RDF::Sesame: Sesame 2.0 adapter for RDF.rb.
6
+ #
7
+ # @example Installing the RDF::Sesame plugin
8
+ # $ sudo gem install rdf-sesame
9
+ #
10
+ # @example Requiring the RDF::Sesame plugin
11
+ # require 'rdf/sesame'
12
+ #
13
+ # @see http://rdf.rubyforge.org/
14
+ # @see http://www.openrdf.org/
15
+ # @see http://www.openrdf.org/doc/sesame2/system/ch08.html
16
+ module Sesame
17
+ autoload :Connection, 'rdf/sesame/connection'
18
+ autoload :Repository, 'rdf/sesame/repository'
19
+ autoload :VERSION, 'rdf/sesame/version'
20
+ end
21
+ end
@@ -0,0 +1,87 @@
1
+ module RDF module Sesame
2
+ ##
3
+ # A connection to a Sesame 2.0 HTTP server.
4
+ #
5
+ # @example Connecting to a Sesame server
6
+ # url = RDF::URI.new("http://localhost:8080/openrdf-sesame")
7
+ # conn = RDF::Sesame::Connection.open(url)
8
+ #
9
+ # @see http://www.openrdf.org/doc/sesame2/system/ch08.html
10
+ class Connection
11
+ # @return [RDF::URI]
12
+ attr_reader :url
13
+
14
+ # @return [Hash{Symbol => Object}]
15
+ attr_reader :options
16
+
17
+ # @return [Boolean]
18
+ attr_reader :connected
19
+ alias_method :connected?, :connected
20
+ alias_method :open?, :connected
21
+
22
+ ##
23
+ # Opens a connection to a Sesame server.
24
+ #
25
+ # @param [RDF::URI] url
26
+ # @param [Hash{Symbol => Object}] options
27
+ # @yield [connection]
28
+ # @yieldparam [Connection]
29
+ # @return [Connection]
30
+ def self.open(url, options = {}, &block)
31
+ self.new(url, options) do |conn|
32
+ if conn.open && block_given?
33
+ case block.arity
34
+ when 1 then block.call(conn)
35
+ else conn.instance_eval(&block)
36
+ end
37
+ else
38
+ conn
39
+ end
40
+ end
41
+ end
42
+
43
+ ##
44
+ # @param [RDF::URI] url
45
+ # @param [Hash{Symbol => Object}] options
46
+ # @yield [connection]
47
+ # @yieldparam [Connection]
48
+ def initialize(url, options = {}, &block)
49
+ @url, @options = url, options
50
+ @connected = false
51
+
52
+ if block_given?
53
+ case block.arity
54
+ when 1 then block.call(self)
55
+ else instance_eval(&block)
56
+ end
57
+ end
58
+ end
59
+
60
+ ##
61
+ # Opens the connection to the Sesame server.
62
+ #
63
+ # @return [Boolean]
64
+ def open
65
+ if connected?
66
+ true
67
+ else
68
+ false # TODO
69
+ end
70
+ end
71
+
72
+ alias_method :open!, :open
73
+
74
+ ##
75
+ # Closes the connection to the Sesame server.
76
+ #
77
+ # @return [void]
78
+ def close
79
+ if connected?
80
+ # TODO
81
+ @connected = false
82
+ end
83
+ end
84
+
85
+ alias_method :close!, :close
86
+ end
87
+ end end
@@ -0,0 +1,34 @@
1
+ module RDF module Sesame
2
+ ##
3
+ # A repository on a Sesame 2.0 HTTP server.
4
+ #
5
+ # @example Connecting to a repository
6
+ # url = RDF::URI.new("http://localhost:8080/openrdf-sesame/repositories/")
7
+ # db = RDF::Sesame::Repository.new(:url => url)
8
+ #
9
+ # @see http://www.openrdf.org/doc/sesame2/system/ch08.html
10
+ class Repository < RDF::Repository
11
+ alias_method :url, :uri
12
+
13
+ # @return [Connection]
14
+ attr_reader :connection
15
+
16
+ ##
17
+ # @param [Hash{Symbol => Object}] options
18
+ # @option options [RDF::URI] :url (nil)
19
+ # @yield [repository]
20
+ # @yieldparam [Repository]
21
+ def initialize(options = {}, &block)
22
+ @title = options.delete(:title) if options.has_key?(:title)
23
+ @uri = options.delete(:url) || options.delete(:uri)
24
+ @options = options
25
+
26
+ if block_given?
27
+ case block.arity
28
+ when 1 then block.call(self)
29
+ else instance_eval(&block)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end end
@@ -0,0 +1,19 @@
1
+ module RDF module Sesame
2
+ module VERSION
3
+ MAJOR = 0
4
+ MINOR = 0
5
+ TINY = 0
6
+ EXTRA = nil
7
+
8
+ STRING = [MAJOR, MINOR, TINY].join('.')
9
+ STRING << "-#{EXTRA}" if EXTRA
10
+
11
+ ##
12
+ # @return [String]
13
+ def self.to_s() STRING end
14
+
15
+ ##
16
+ # @return [String]
17
+ def self.to_str() STRING end
18
+ end
19
+ end end
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rdf-sesame
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Arto Bendiken
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-12-31 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rspec
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.2.9
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: yard
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.5.2
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: rdf
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 0.0.6
44
+ version:
45
+ description: RDF::Sesame is a Sesame 2.0 adapter for RDF.rb.
46
+ email: arto.bendiken@gmail.com
47
+ executables: []
48
+
49
+ extensions: []
50
+
51
+ extra_rdoc_files: []
52
+
53
+ files:
54
+ - AUTHORS
55
+ - README
56
+ - UNLICENSE
57
+ - VERSION
58
+ - lib/rdf/sesame/connection.rb
59
+ - lib/rdf/sesame/repository.rb
60
+ - lib/rdf/sesame/version.rb
61
+ - lib/rdf/sesame.rb
62
+ has_rdoc: false
63
+ homepage: http://rdf.rubyforge.org/
64
+ licenses:
65
+ - Public Domain
66
+ post_install_message:
67
+ rdoc_options: []
68
+
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 1.8.2
76
+ version:
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: "0"
82
+ version:
83
+ requirements: []
84
+
85
+ rubyforge_project: rdf
86
+ rubygems_version: 1.3.5
87
+ signing_key:
88
+ specification_version: 3
89
+ summary: Sesame 2.0 adapter for RDF.rb.
90
+ test_files: []
91
+