Module: Tripod::Graphs

Extended by:
ActiveSupport::Concern
Included in:
Components
Defined in:
lib/tripod/graphs.rb

Overview

This module defines behaviour for resources with data across multiple graphs

Instance Method Summary collapse

Instance Method Details

#graphsObject



7
8
9
10
11
12
13
14
15
16
# File 'lib/tripod/graphs.rb', line 7

def graphs
  select_query = "SELECT DISTINCT ?g WHERE { GRAPH ?g {<#{uri.to_s}> ?p ?o } }"
  result = Tripod::SparqlClient::Query.select(select_query)

  if result.length > 0
     result.select{|r| r.keys.length > 0 }.map{|r| r["g"]["value"] }
  else
     []
  end
end