lib/rbbt/association/item.rb in rbbt-util-5.21.69 vs lib/rbbt/association/item.rb in rbbt-util-5.21.70
- old
+ new
@@ -55,36 +55,44 @@
property :source_entity_type => :both do
Entity.formats[source_type].to_s
end
property :target_type => :both do
- knowledge_base.target(database)
+ if reverse
+ knowledge_base.source(database)
+ else
+ knowledge_base.target(database)
+ end
end
property :source_type => :both do
- knowledge_base.source(database)
+ if reverse
+ knowledge_base.target(database)
+ else
+ knowledge_base.source(database)
+ end
end
property :undirected => :both do
knowledge_base.undirected(database)
end
property :target_entity => :array2single do
- type = knowledge_base.target(database)
+ type = target_type
knowledge_base.annotate self.target, type, database #if self.target.any?
end
property :source_entity => :array2single do
- type = knowledge_base.source(database)
+ type = source_type
knowledge_base.annotate self.source, type, database #if self.source.any?
end
property :index => :both do |database|
@index ||= knowledge_base.get_index(database)
end
property :value => :array2single do
index = index(database)
- value = index.chunked_values_at self
+ value = self.reverse ? index.chunked_values_at(self.invert) : index.chunked_values_at(self)
value.collect{|v| NamedArray.setup(v, index.fields)}
end
property :info_fields => :both do
knowledge_base.index_fields(database)