Sha256: ef86f0fdb2b260d02541596d98347f07ba39347776d329faf18eed2183875a6d
Contents?: true
Size: 955 Bytes
Versions: 31
Compression:
Stored size: 955 Bytes
Contents
module PublishMyData module ThirdParty class Ontology < PublishMyData::Ontology delegate :comment, :description, :license, :publisher, :contact_email, to: :data_resource # if there's no data graph set, return the graph uri def data_graph_uri super || self.graph_uri end # Overrides ['to_rdf', 'to_ttl', 'to_nt', 'to_json'].each do |method_name| define_method method_name do |opts={}| resources = Resource.find_by_sparql(" SELECT DISTINCT ?uri WHERE { GRAPH <#{self.data_graph_uri}> {?uri ?p ?o} } ") Tripod::ResourceCollection.new(resources).send(method_name) end end def local? false end private def data_resource @data_resource = PublishMyData::Ontology.new(self.uri, graph_uri: self.data_graph_uri) @data_resource.hydrate! @data_resource end end end end
Version data entries
31 entries across 31 versions & 1 rubygems