app/models/trait_bank.rb
# Given a page, get all of its traits and all of its metadata. Note that
# this necessarily returns a bunch of predicates of
# <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, which you should
# ignore. Sorry! NOTE: duplication with #page_traits
Given a page, get all of its traits and all of its metadata. Note that
this necessarily returns a bunch of predicates of
, which you should
ignore. Sorry. NOTE: duplication with #page_traits
Given a page get all of its traits and all of its metadata . Note that this necessarily returns a bunch of predicates of which you should ignore . Sorry . NOTE : duplication with #page_traits
def page_with_traits(page, limit = 10_000, offset = nil)
      query = "SELECT DISTINCT *
      # page_with_traits
      WHERE {
        GRAPH <#{TraitBank.graph}> {
          <http://eol.org/pages/#{page}> ?predicate ?trait .
          ?trait a eol:trait .
          ?trait ?trait_predicate ?value .
          OPTIONAL { ?value a eol:trait . ?value ?meta_predicate ?meta_value }
        }
      }
      LIMIT #{limit}
      #{"OFFSET #{offset}" if offset}"
      begin
        connection.query(query)
      rescue EOL::Exceptions::SparqlDataEmpty => e
        EOL.log_error(e)
        []
      end
    end
def page_with_traits ( page , limit = 10_000 , offset = nil ) query = "SELECT DISTINCT *
      # page_with_traits
      WHERE {
        GRAPH <#{TraitBank.graph}> {
          <http://eol.org/pages/#{page}> ?predicate ?trait .
          ?trait a eol:trait .
          ?trait ?trait_predicate ?value .
          OPTIONAL { ?value a eol:trait . ?value ?meta_predicate ?meta_value }
        }
      }
      LIMIT #{limit}
      #{"OFFSET #{offset}" if offset}" begin connection . query ( query ) rescue EOL :: Exceptions :: SparqlDataEmpty => e EOL . log_error ( e ) [ ] end end
Given a page, get all of its traits and all of its metadata.
Given a page get all of its traits and all of its metadata .
page
<not_specific>
limit
<not_specific>
offset
<not_specific>