Sha256: 3b5e485047fa78762ac978eeb396f5acfc11de847dddc8cb36c77611f17a5f44
Contents?: true
Size: 1.48 KB
Versions: 28
Compression:
Stored size: 1.48 KB
Contents
module TaliaCore module ActiveSourceParts # This contains sql joins and segments that can be used by the ActiveSource classes. module SqlHelper # Returns the "default" join (meaning that it joins all the "triple tables" # together. The flags signal whether the relations and properties should # be joined. def default_joins(include_rels = true, include_props = true) join = "LEFT JOIN semantic_relations ON semantic_relations.subject_id = active_sources.id " join << sources_join if(include_rels) join << props_join if(include_props) join end # Joins sources on semantic relations def sources_join " LEFT JOIN active_sources AS obj_sources ON semantic_relations.object_id = obj_sources.id AND semantic_relations.object_type = 'TaliaCore::ActiveSource'" end # Joins properties on semantic relations def props_join " LEFT JOIN semantic_properties AS obj_props ON semantic_relations.object_id = obj_props.id AND semantic_relations.object_type = 'TaliaCore::SemanticProperty'" end # Returns the "default" join for reverse lookups def default_inv_joins join = "LEFT JOIN semantic_relations ON semantic_relations.object_id = active_sources.id AND semantic_relations.object_type = 'TaliaCore::ActiveSource' " join << " LEFT JOIN active_sources AS sub_sources ON semantic_relations.subject_id = sub_sources.id" join end end end end
Version data entries
28 entries across 28 versions & 1 rubygems