Class: SPARQL::Server::Request::Item
- Inherits:
-
Object
- Object
- SPARQL::Server::Request::Item
- Defined in:
- lib/sparql-server.rb
Instance Attribute Summary collapse
-
#masters ⇒ Object
readonly
Returns the value of attribute masters.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
-
#<<(triple) ⇒ Object
[-].
-
#==(other) ⇒ Object
[-].
-
#belongs_to?(other) ⇒ Boolean
[-].
-
#initialize(object, schema) ⇒ Item
constructor
[-].
- #inspect ⇒ Object
-
#instances ⇒ Object
[-].
-
#rdf_class ⇒ Object
[-].
-
#solvable? ⇒ Boolean
[-].
-
#to_sql(name) ⇒ Object
[-].
Constructor Details
#initialize(object, schema) ⇒ Item
- -
66 67 68 69 70 |
# File 'lib/sparql-server.rb', line 66 def initialize(object, schema) @schema = schema @object = object @conditions = [] end |
Instance Attribute Details
#masters ⇒ Object (readonly)
Returns the value of attribute masters.
61 62 63 |
# File 'lib/sparql-server.rb', line 61 def masters @masters end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
60 61 62 |
# File 'lib/sparql-server.rb', line 60 def object @object end |
Instance Method Details
#<<(triple) ⇒ Object
- -
82 83 84 |
# File 'lib/sparql-server.rb', line 82 def <<(triple) @conditions << triple end |
#==(other) ⇒ Object
- -
75 76 77 |
# File 'lib/sparql-server.rb', line 75 def ==(other) other.kind_of?(Item) ? @object == other.object : @object == other end |
#belongs_to?(other) ⇒ Boolean
- -
117 118 119 120 121 122 123 124 125 126 |
# File 'lib/sparql-server.rb', line 117 def belongs_to?(other) if rdf_class.nil? or other.rdf_class.nil? return false end attribute = rdf_class.has?(nil, other.rdf_class) if attribute.nil? or not attribute.belongs_to? return false end attribute.type end |
#inspect ⇒ Object
128 129 130 |
# File 'lib/sparql-server.rb', line 128 def inspect @object end |
#instances ⇒ Object
- -
89 90 91 |
# File 'lib/sparql-server.rb', line 89 def instances rdf_class ? rdf_class.find(:all, :conditions => ) : [] end |
#rdf_class ⇒ Object
- -
110 111 112 |
# File 'lib/sparql-server.rb', line 110 def rdf_class @schema.select { |cls| cls.type == rdf_type }.first end |
#solvable? ⇒ Boolean
- -
103 104 105 |
# File 'lib/sparql-server.rb', line 103 def solvable? predefined? or rdf_type end |
#to_sql(name) ⇒ Object
- -
96 97 98 |
# File 'lib/sparql-server.rb', line 96 def to_sql(name) predefined? ? value_to_sql(name) : model_to_sql(name) end |