class Dalton::Database

Attributes

datomic_db[R]

Public Class Methods

new(datomic_database_value) click to toggle source
# File lib/dalton/database.rb, line 7
def initialize(datomic_database_value)
  @datomic_db = datomic_database_value
end

Public Instance Methods

==(other) click to toggle source
# File lib/dalton/database.rb, line 13
def ==(other)
  datomic_db == other.datomic_db
end
attribute(id) click to toggle source
# File lib/dalton/database.rb, line 36
def attribute(id)
  Attribute.new(datomic_db.attribute(Translation.from_ruby(id)))
end
basis_t() click to toggle source
# File lib/dalton/database.rb, line 40
def basis_t
  datomic_db.basisT
end
entity(entity_id) click to toggle source
# File lib/dalton/database.rb, line 26
def entity(entity_id)
  Entity.new(datomic_db.entity(Translation.from_ruby(entity_id)))
rescue Java::JavaUtilConcurrent::ExecutionException => e
  raise DatomicError, "Entity retrieval failed: #{e.getMessage}"
end
q(query, *args) click to toggle source
# File lib/dalton/database.rb, line 17
def q(query, *args)
  translated_query = Translation.from_ruby(query)
  # STDERR.puts "translated_query=#{translated_query.to_edn}"
  result = Peer.q(translated_query, datomic_db, *args)
  Translation.from_clj(result)
rescue Java::JavaUtilConcurrent::ExecutionException => e
  raise DatomicError, "Query failed: #{e.getMessage}"
end
retrieve(query, *inputs) click to toggle source
# File lib/dalton/database.rb, line 32
def retrieve(query, *inputs)
  q(query, *inputs).lazy.map { |result| entity(result.first) }
end