app/models/concerns/concept.rb
# these are just the top-concepts
these are just the top-concepts
these are just the top - concepts
def top_level_concepts
      concepts = self.find_by_sparql("
        SELECT ?uri (<#{self.get_graph_uri}> as ?graph) WHERE {
          <#{self.resource_concept_scheme_uri.to_s}> <#{RDF::SKOS.hasTopConcept}> ?uri .
          GRAPH <#{self.get_graph_uri}> {
            ?uri ?p ?o .
          }
        }"
      )
      others = concepts.select{|x| x.label.downcase == "other"}
      other = others.first
      if other
        concepts.delete_if{|x| x.label.downcase == "other"}
        concepts.sort{|x,y| x.label.downcase <=> y.label.downcase }.push(other)
      end
    end
def top_level_concepts concepts = self . find_by_sparql ( "
        SELECT ?uri (<#{self.get_graph_uri}> as ?graph) WHERE {

          <#{self.resource_concept_scheme_uri.to_s}> <#{RDF::SKOS.hasTopConcept}> ?uri .

          GRAPH <#{self.get_graph_uri}> {
            ?uri ?p ?o .
          }

        }" ) others = concepts . select { | x | x . label . downcase == "other" } other = others . first if other concepts . delete_if { | x | x . label . downcase == "other" } concepts . sort { | x , y | x . label . downcase <=> y . label . downcase } . push ( other ) end end
these are just the top-concepts
these are just the top - concepts
# need a custom query here as the concept scheme in diff. graph # force other to end and sort rest alphabetically