Skip to content

Instantly share code, notes, and snippets.

@tpendragon
Created April 3, 2015 17:43
Show Gist options
  • Save tpendragon/dec4650c27f2c362d0b3 to your computer and use it in GitHub Desktop.
Save tpendragon/dec4650c27f2c362d0b3 to your computer and use it in GitHub Desktop.
n_triples_export
module OregonDigital
module SolrNTripleExtension
def self.extended(document)
document.will_export_as(:nt, "application/n-triples")
end
def export_as_nt
graph = CleanRepository.new(ActiveFedora.fedora.connection, GenericAsset).find(self["id"])
graph = OregonDigital::GraphMutators::SubjectChanger.call(graph, GenericAsset.id_to_uri(self["id"]), RDF::URI("http://oregondigital.org/resource/#{self["id"]}"))
graph.dump(:ntriples)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment