Class: Lbp::Transcription

Inherits:
Resource show all
Defined in:
lib/lbp/transcription.rb

Instance Attribute Summary

Attributes inherited from Resource

#identifier, #results

Instance Method Summary collapse

Methods inherited from Resource

create, #description, find, #has_parts, #initialize, #is_part_of, #title, #type, #value, #values

Constructor Details

This class inherits a constructor from Lbp::Resource

Instance Method Details

#doc_path(branch = "master") ⇒ Object

TODO; this will need to change because an expression above the item level will have more than one doc listed



20
21
22
23
24
25
26
27
# File 'lib/lbp/transcription.rb', line 20

def doc_path(branch="master")
	doc_path = value("http://scta.info/property/hasDocument").to_s
	#file_path = self.results.dup.filter(:p => RDF::URI("http://scta.info/property/hasXML")).first[:o].to_s
	if branch != "master"
	doc_path.gsub!("master", branch)
	end
	return doc_path
end

#file(branch: "master", confighash: nil, path: "doc") ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/lbp/transcription.rb', line 34

def file(branch: "master", confighash: nil, path: "doc")
if path == "file"
		file = File.new(self.file_path, self.transcription_type, confighash)
else path == "doc"
	file = File.new(self.doc_path(branch), self.transcription_type, confighash)
end
	return file
end

#file_part(partid: nil, confighash: nil, path: "doc") ⇒ Object

NOTE: this really is a temporary method, since the database should point to file corresponding to each transcription dynamically generated by the exist-db database. but this could remain in case it was useful to grab the part from a file that would include a tei header etc.



47
48
49
50
51
52
53
54
# File 'lib/lbp/transcription.rb', line 47

def file_part(partid: nil, confighash: nil, path: "doc")
if path == "file"
		file = FilePart.new(self.file_path, self.transcription_type, confighash, partid)
else path == "doc"
	file = FilePart.new(self.doc_path, self.transcription_type, confighash, partid)
end
	return file
end

#file_pathObject

initionalization handled by Resource Class



11
12
13
14
15
16
17
18
# File 'lib/lbp/transcription.rb', line 11

def file_path
	file_path = value("http://scta.info/property/hasXML").to_s
	#file_path = self.results.dup.filter(:p => RDF::URI("http://scta.info/property/hasXML")).first[:o].to_s
	if ENV['EXIST'] == "local"
		file_path.gsub!("exist.scta.info", "localhost:8080")
	end
	return file_path
end

#transcription_typeObject



28
29
30
31
32
# File 'lib/lbp/transcription.rb', line 28

def transcription_type
	type = value("http://scta.info/property/transcriptionType")
	#type = self.results.dup.filter(:p => RDF::URI("http://scta.info/property/transcriptionType")).first[:o].to_s
	type.to_s.downcase
end