lib/active_rdf/lib/active_rdf/objectmanager/resource.rb
# split find_string by occurrences of _and_
split find_string by occurrences of _and_
split find_string by occurrences of _and_
def parse_attributes string, *args
    attributes = string.split('_and_')
    attributes.each do |atr|
      if Namespace.abbreviations.include?(atr.to_sym)
        @ns = atr.to_s.downcase.to_sym
      else
        candidates = Query.new.distinct(:p).where(:s,:p,:o).execute
        @where << candidates.select {|cand| Namespace.localname(cand) == atr}.first
      end
    end
    if Namespace.abbreviations.include?(attributes.last.to_sym)
      return self
    else
      return query(*args)
    end
  end
def parse_attributes string , * args attributes = string . split ( '_and_' ) attributes . each do | atr | if Namespace . abbreviations . include? ( atr . to_sym ) @ns = atr . to_s . downcase . to_sym else candidates = Query . new . distinct ( :p ) . where ( :s , :p , :o ) . execute @where << candidates . select { | cand | Namespace . localname ( cand ) == atr } . first end end if Namespace . abbreviations . include? ( attributes . last . to_sym ) return self else return query ( * args ) end end
split find_string by occurrences of _and_
split find_string by occurrences of _and_
# attribute can be: # - a namespace prefix (foaf): store prefix in @ns to prepare for method_missing # - name (attribute name): store in where to prepare for method_missing # found simple attribute label, e.g. 'name' # find out candidate (full) predicate for this localname: investigate  # all possible predicates and select first one with matching localname # if the last attribute was a prefix, return this dynamic finder (we'll  # catch the following method_missing and construct the real query then) # if the last attribute was a localname, construct the query now and return  # the results
string
args