-
-
rena
-
-- http://github.com/tommorris/rena
-
-
-
-
DESCRIPTION:
-
-Rena is an RDF library for Ruby.
-
-
FEATURES/PROBLEMS:
-
-
SYNOPSIS:
-
- Synopsis
-
-
REQUIREMENTS:
-
-
INSTALL:
-
-- (sudo gem install rena)
-
-
-
-
LICENSE:
-
-(The MIT License)
-
-
-Copyright © 2008 Tom Morris
-
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-‘Software’), to deal in the Software without restriction,
-including without limitation the rights to use, copy, modify, merge,
-publish, distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to the
-following conditions:
-
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-
-THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-
-
-
-
\ No newline at end of file
diff --git a/doc/style.css b/doc/style.css
deleted file mode 100644
index a13d216..0000000
--- a/doc/style.css
+++ /dev/null
@@ -1,65 +0,0 @@
-body { font-family: Myriad, Helvetica, Arial, Verdana, sans-serif; font-size: 10pt; }
-#nav ul { list-style: none; padding: 0; margin: 0; }
-#nav ul li { white-space: nowrap; }
-#nav li em { font-size: 0.9em; color: #999; }
-#nav h1 { font-size: 1.2em; }
-h1 { font-size: 1.5em; background: #eee; color: #000; padding: 3px; text-decoration: none; }
-h2 { font-size: 1.2em; background: #eef; color: #000; padding: 3px; text-decoration: none; }
-h3 { font-size: 1.0em; }
-.clear { clear: both; }
-.section.module h1.title, .section.class h1.title, .section.readme h1 { color: #000; background: #ddd; border: 1px solid #ccc; padding: 7px; margin: 0; margin-bottom: 7px; }
-.section.class h1.title { border-bottom: 0; margin-bottom: 0; }
-.section.class > .section.docstring, .section.module > .section.docstring { padding: 0; }
-#initialize-instance_method .methodsignature .return_types { display: none; }
-.methodsignature .visibility { display: none; }
-.methodsignature .name { font-weight: bold; }
-.methoddetails .method_header h3 { display: none; }
-.section.method { background: #eee; margin-bottom: 0.8em; }
-.section.tags,.section.docstring,.section.source { padding: 5px 12px; }
-.section.method .details_title { font-size: 1.1em; background: #dde; padding: 7px; }
-.section.method .details_title p.aliases { padding: 0; margin: 0; font-style: italic; font-size: 0.9em; }
-.section.method .details_title p.aliases tt { font-weight: bold; font-style: normal; font-size: 1.1em; }
-.section.constants dl { font-family: monospace; }
-.section.constants dt { font-weight: bold; font-size: 1.1em; }
-.section.constants dt:after { content: " = "; }
-.section.constants dd { margin-bottom: 1em; }
-.section.source .source_link { font-size: 0.9em; }
-.section.source .source_code { display: none; }
-/*.section.source .source_code pre { float: left; }*/
-.section.attributes table { padding: 0; width: 100%; }
-.section.attributes .readwrite { width: 5%; }
-.section.attributes .name { font-weight: bold; width: 10%; }
-.section.attributes .visibility { font-style: italic; color: #666; width: 5%; }
-.section.attributes td, .section.attributes th { vertical-align: top; padding: 5px; }
-.section.attributes th { padding-left: 0; text-align: left; }
-.section.attributes .docstring p.returns { color: #555; font-style: italic; }
-.section.attributes .docstring .return_types { font-style: normal; }
-.section.attributes .docstring { width: 80%; }
-.section.attributes .docstring * { display: inline; }
-.section.inheritance { background: #ddd; padding: 5px; border: 1px solid #ccc; border-top: 0; }
-.section.inheritance ul { list-style: none; padding-left: 2.2em; margin: 0; }
-.section.inheritance ul li { line-height: 1.2em; }
-.section.inheritance ul li:before { content: "↳ "; }
-.section.inheritance > ul { padding-left: 5px; }
-.section.inheritance > ul > li:before { content: ""; }
-.section.inheritance > ul > ul { padding-left: 1em; }
-.section.methodsummary table { width: 100%; }
-.section.methodsummary td, .section.methodsummary th { background: #eee; vertical-align: top; padding: 5px; }
-.section.methodsummary th { background: #dde; text-align: left; white-space: nowrap; padding-right: 12px; }
-.section.methodsummary .signature { font-family: monospace; font-weight: normal; }
-.section.methodsummary .signature .name { font-weight: bold; }
-.section.methodsummary .signature .alias { display: block; }
-.section.methodsummary .docstring { width: 80%; }
-.section.methodsummary .docstring * { display: inline; }
-.section.methodsummary .docstring p.returns { color: #555; font-style: italic; }
-.section.methodsummary .docstring .return_types { font-style: normal; }
-.section.tags div { clear: both; }
-.section.tags h2 { display: none; }
-.section.tags h3 { font-size: 1.0em; margin-top: 3px; }
-.section.tags dl { margin-left: 2em; }
-.section.methodmissing p.note { font-style: italic; }
-.section.constructor p.inherited_msg { font-style: italic; }
-.included h1, .inherited h1 { font-size: 1em !important; border: 0; margin: 0; padding: 5px; border-bottom: 1px solid #ccc; }
-.included div, .inherited div { color: #444; margin: 1.5em 0; width: 47%; border: 1px solid #ccc; float: left; margin-right: 12px; }
-.included p .name, .inherited p .name { font-family: monospace; }
-.included p, .inherited p { margin: 5px; }
diff --git a/doc/syntax_highlight.css b/doc/syntax_highlight.css
deleted file mode 100644
index 22f9e1d..0000000
--- a/doc/syntax_highlight.css
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Canvas */
-.docstring pre, .source_code { background: #222; padding: 0 12px; margin-top: 8px; border: 1px dashed #ccc; font-size: 0.9em; overflow-x: auto; }
-.source_code pre.lines { margin-right: 20px; text-align: right; color: #888; }
-.docstring pre { padding: 12px; padding-left: 0; }
-
-/* Token colours. Borrowed from pastie.org's "Blackboard" theme */
-pre.code, pre.lines { font-family: Monaco, Courier, monospace; }
-pre.code { color: #fff; }
-pre.code .info.file { color: #888; }
-pre.code .val { color: #61CE3C; }
-pre.code .dstring { color: #61DE3C; }
-pre.code .fid, pre.code .id.new, pre.code .id.to_s,
-pre.code .id.to_sym, pre.code .id.to_f,
-pre.code .dot + pre.code .id,
-pre.code .id.to_i pre.code .id.each { color: #FF6400; }
-pre.code .comment { color: #AEAEAE; }
-pre.code .constant, pre.code .symbol { color: #D8FA3C; }
-pre.code .kw { color: #FBDE2D; }
-pre.code .ivar { color: #AACEFB; }
-pre.code .gvar, pre.code .id.nth_ref { color: #BADEFF; }
-pre.code .regexp, .dregexp { color: #EA5EFB; }
\ No newline at end of file
diff --git a/lib/rena.rb b/lib/rena.rb
deleted file mode 100644
index 9f945e9..0000000
--- a/lib/rena.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-$:.unshift File.dirname(__FILE__)
-Dir.glob(File.join(File.dirname(__FILE__), 'rena/**.rb')).each { |f| require f }
-
-module Rena
-end
diff --git a/lib/rena/bnode.rb b/lib/rena/bnode.rb
deleted file mode 100644
index f4804e8..0000000
--- a/lib/rena/bnode.rb
+++ /dev/null
@@ -1,69 +0,0 @@
-module Rena
- class BNode
- attr_accessor :identifier
- def initialize(identifier = nil)
- if identifier != nil && self.valid_id?(identifier) != false
- @identifier = identifier
- else
- @identifier = "bn" + self.hash.to_s
- end
- end
-
- def eql? (other)
- other.is_a?(self.class) && other.identifier == self.identifier
- end
-
- alias_method :==, :eql?
-
- ##
- # Exports the BNode in N-Triples form.
- #
- # ==== Example
- # b = BNode.new; b.to_n3 # => returns a string of the BNode in n3 form
- #
- # ==== Returns
- # @return [String] The BNode in n3.
- #
- # @author Tom Morris
-
- def to_n3
- "_:" + @identifier
- end
-
-
- ##
- # Exports the BNode in N-Triples form.
- #
- # ==== Example
- # b = BNode.new; b.to_ntriples # => returns a string of the BNode in N-Triples form
- #
- # ==== Returns
- # @return [String] The BNode in N-Triples.
- #
- # @author Tom Morris
-
- def to_ntriples
- self.to_n3
- end
-
- ##
- # Returns the identifier as a string.
- #
- # === Returns
- # @return [String] Blank node identifier.
- #
- # @author Tom Morris
- def to_s
- @identifier
- end
-
- protected
- def valid_id? name
- if name =~ /^[a-zA-Z_][a-zA-Z0-9]*$/
- true
- else
- false
- end
- end
- end
-end
diff --git a/lib/rena/exceptions/about_each_exception.rb b/lib/rena/exceptions/about_each_exception.rb
deleted file mode 100644
index 5291373..0000000
--- a/lib/rena/exceptions/about_each_exception.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-class AboutEachException
-end
\ No newline at end of file
diff --git a/lib/rena/exceptions/uri_relative_exception.rb b/lib/rena/exceptions/uri_relative_exception.rb
deleted file mode 100644
index 239632b..0000000
--- a/lib/rena/exceptions/uri_relative_exception.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-class UriRelativeException < RuntimeError
-end
\ No newline at end of file
diff --git a/lib/rena/graph.rb b/lib/rena/graph.rb
deleted file mode 100644
index e24ee75..0000000
--- a/lib/rena/graph.rb
+++ /dev/null
@@ -1,188 +0,0 @@
-require 'rena/namespace'
-require 'rena/bnode'
-require 'rena/uriref'
-require 'rena/literal'
-require 'rena/triple'
-
-module Rena
- class Graph
- attr_accessor :triples, :nsbinding
-
- def initialize
- @triples = []
- @nsbinding = {}
- end
-
- def size
- @triples.size
- end
-
- def each
- @triples.each { |value| yield value }
- end
-
- def [] (item)
- @triples[item]
- end
-
- def each_with_subject(subject)
- @triples.each do |value|
- yield value if value.subject == subject
- end
- end
-
- def get_resource(subject)
- temp = []
- each_with_subject(subject) do |value|
- temp << subject
- end
- if temp.any?
- Resource.new(temp)
- end
- end
-
- ##
- # Adds a triple to a graph directly from the intended subject, predicate, and object.
- #
- # ==== Example
- # g = Graph.new; g.add_triple(BNode.new, URIRef.new("http://xmlns.com/foaf/0.1/knows"), BNode.new) # => results in the triple being added to g; returns an array of g's triples
- #
- # @param [URIRef, BNode] s the subject of the triple
- # @param [URIRef] p the predicate of the triple
- # @param [URIRef, BNode, Literal, TypedLiteral] o the object of the triple
- #
- # ==== Returns
- # @return [Array] An array of the triples (leaky abstraction? consider returning the graph instead)
- #
- # @raise [Error] Checks parameter types and raises if they are incorrect.
- # @author Tom Morris
-
- def add_triple(s, p, o)
- @triples += [ Triple.new(s, p, o) ]
- end
-
- ##
- # Adds an extant triple to a graph
- #
- # ==== Example
- # g = Graph.new; t = Triple.new(BNode.new, URIRef.new("http://xmlns.com/foaf/0.1/knows"), BNode.new); g << t) # => results in the triple being added to g; returns an array of g's triples
- #
- # @param [Triple] t the triple to be added to the graph
- #
- # ==== Returns
- # @return [Array] An array of the triples (leaky abstraction? consider returning the graph instead)
- #
- # @author Tom Morris
-
-
- def << (triple)
- # self.add_triple(s, p, o)
- @triples += [ triple ]
- end
-
- ##
- # Exports the graph to RDF in N-Triples form.
- #
- # ==== Example
- # g = Graph.new; g.add_triple(BNode.new, URIRef.new("http://xmlns.com/foaf/0.1/knows"), BNode.new); g.to_ntriples # => returns a string of the graph in N-Triples form
- #
- # ==== Returns
- # @return [String] The graph in N-Triples.
- #
- # @author Tom Morris
-
- def to_ntriples
- @triples.collect do |t|
- t.to_ntriples
- end * "\n"
- end
-
- ##
- # Creates a new namespace given a URI and the short name and binds it to the graph.
- #
- # ==== Example
- # g = Graph.new; g.namespace("http://xmlns.com/foaf/0.1/", "foaf") # => binds the Foaf namespace to g
- #
- # @param [String] uri the URI of the namespace
- # @param [String] short the short name of the namespace
- #
- # ==== Returns
- # @return [Namespace] The newly created namespace.
- #
- # @raise [Error] Checks validity of the desired shortname and raises if it is incorrect.
- # @raise [Error] Checks that the newly created Namespace is of type Namespace and raises if it is incorrect.
- # @author Tom Morris
-
- def namespace(uri, short)
- self.bind Namespace.new(uri, short)
- end
-
- def bind(namespace)
- if namespace.class == Namespace
- @nsbinding["#{namespace.short}"] = namespace
- else
- raise
- end
- end
-
- def has_bnode_identifier?(bnodeid)
- temp_bnode = BNode.new(bnodeid)
- returnval = false
- @triples.each { |triple|
- if triple.subject.eql?(temp_bnode)
- returnval = true
- break
- end
- if triple.object.eql?(temp_bnode)
- returnval = true
- break
- end
- }
- return returnval
- end
-
- def get_bnode_by_identifier(bnodeid)
- temp_bnode = BNode.new(bnodeid)
- each do |triple|
- if triple.subject == temp_bnode
- return triple.subject
- end
- if triple.object == temp_bnode
- return triple.object
- end
- end
- return false
- end
-
- def get_by_type(object)
- out = []
- each do |t|
- next unless t.is_type?
- next unless case object
- when String
- object == t.object.to_s
- when Regexp
- object.match(t.object.to_s)
- else
- object == t.object
- end
- out << t.subject
- end
- return out
- end
-
- def join(graph)
- if graph.class == Graph
- graph.each { |t|
- self << t
- }
- else
- raise "join requires you provide a graph object"
- end
- end
- # alias :add, :add_triple
- # alias (=+, add_triple)
- private
-
- end
-end
diff --git a/lib/rena/literal.rb b/lib/rena/literal.rb
deleted file mode 100644
index 92e8c06..0000000
--- a/lib/rena/literal.rb
+++ /dev/null
@@ -1,207 +0,0 @@
-module Rena
- class Literal
- class Encoding
- def self.integer
- @integer ||= coerce "http://www.w3.org/2001/XMLSchema#int"
- end
-
- def self.float
- @float ||= coerce "http://www.w3.org/2001/XMLSchema#float"
- end
-
- def self.string
- @string ||= coerce "http://www.w3.org/2001/XMLSchema#string"
- end
-
- def self.coerce(string_or_nil)
- if string_or_nil.nil? || string_or_nil == ''
- the_null_encoding
- else
- new string_or_nil
- end
- end
-
- class Null
- def to_s
- ''
- end
-
- def format_as_n3(content)
- "\"#{content}\""
- end
-
- def format_as_trix(content)
- "