Class: PubliSci::Prov::Derivation
- Inherits:
-
Object
- Object
- PubliSci::Prov::Derivation
show all
- Includes:
- CustomPredicate
- Defined in:
- lib/bio-publisci/metadata/prov/derivation.rb
Instance Method Summary
collapse
#add_custom, #custom, #has
Instance Method Details
#entity(entity = nil) ⇒ Object
Also known as:
data
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/bio-publisci/metadata/prov/derivation.rb', line 27
def entity(entity=nil)
if entity
@entity = entity
elsif @entity.is_a? Symbol
raise "UnknownEntity #{@entity}" unless Prov.entities[@entity]
@entity = Prov.entities[@entity]
else
@entity
end
end
|
#had_activity(activity = nil) ⇒ Object
Also known as:
activity
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/bio-publisci/metadata/prov/derivation.rb', line 15
def had_activity(activity=nil)
if activity
@had_activity = activity
elsif @had_activity.is_a? Symbol
raise "UnknownActivity #{@had_activity}" unless Prov.activities[@had_activity]
@had_activity = Prov.activities[@had_activity]
else
@had_activity
end
end
|
#subject(sub = nil) ⇒ Object
7
8
9
10
11
12
13
|
# File 'lib/bio-publisci/metadata/prov/derivation.rb', line 7
def subject(sub=nil)
if sub
@subject = sub
else
@subject ||= "#{Prov.base_url}/derivation/#{Time.now.nsec.to_s(32)}"
end
end
|
#to_n3 ⇒ Object
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/bio-publisci/metadata/prov/derivation.rb', line 39
def to_n3
str = "<#{subject}> a prov:Derivation ;\n"
str << "\tprov:entity <#{entity}> ;\n" if entity
str << "\tprov:hadActivity <#{had_activity}> ;\n" if had_activity
add_custom(str)
str[-2] = ".\n"
str
end
|
#to_s ⇒ Object
50
51
52
|
# File 'lib/bio-publisci/metadata/prov/derivation.rb', line 50
def to_s
subject
end
|