Module: PubliSci::Prov
- Defined in:
- lib/bio-publisci/metadata/prov/dsl.rb,
lib/bio-publisci/metadata/prov/plan.rb,
lib/bio-publisci/metadata/prov/prov.rb,
lib/bio-publisci/metadata/prov/role.rb,
lib/bio-publisci/metadata/prov/agent.rb,
lib/bio-publisci/metadata/prov/usage.rb,
lib/bio-publisci/metadata/prov/entity.rb,
lib/bio-publisci/metadata/prov/element.rb,
lib/bio-publisci/mixins/dereferencable.rb,
lib/bio-publisci/metadata/prov/activity.rb,
lib/bio-publisci/metadata/prov/derivation.rb,
lib/bio-publisci/metadata/prov/association.rb
Defined Under Namespace
Modules: DSL, Dereferencable, Element
Classes: Activity, Agent, Association, Derivation, Entity, Plan, Role, Usage
Class Method Summary
collapse
Class Method Details
.activities ⇒ Object
47
48
49
|
# File 'lib/bio-publisci/metadata/prov/prov.rb', line 47
def self.activities
registry[:activities] ||= {}
end
|
.agents ⇒ Object
39
40
41
|
# File 'lib/bio-publisci/metadata/prov/prov.rb', line 39
def self.agents
registry[:agents] ||= {}
end
|
.associations ⇒ Object
51
52
53
|
# File 'lib/bio-publisci/metadata/prov/prov.rb', line 51
def self.associations
registry[:associations] ||= {}
end
|
.base_url ⇒ Object
59
60
61
|
# File 'lib/bio-publisci/metadata/prov/prov.rb', line 59
def self.base_url
@base_url ||= "http://rqtl.org/ns"
end
|
.base_url=(url) ⇒ Object
63
64
65
|
# File 'lib/bio-publisci/metadata/prov/prov.rb', line 63
def self.base_url=(url)
@base_url = url
end
|
.entities ⇒ Object
43
44
45
|
# File 'lib/bio-publisci/metadata/prov/prov.rb', line 43
def self.entities
registry[:entities] ||= {}
end
|
.plans ⇒ Object
55
56
57
|
# File 'lib/bio-publisci/metadata/prov/prov.rb', line 55
def self.plans
registry[:plans] ||= {}
end
|
.prefixes ⇒ Object
67
68
69
70
71
72
73
74
|
# File 'lib/bio-publisci/metadata/prov/prov.rb', line 67
def self.prefixes
<<-EOF
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
EOF
end
|
.register(name, object) ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/bio-publisci/metadata/prov/prov.rb', line 3
def self.register(name,object)
name = name.to_sym if name
if object.is_a? Agent
sub = :agents
elsif object.is_a? Entity
sub = :entities
elsif object.is_a? Activity
sub = :activities
elsif object.is_a? Association
sub = :associations
elsif object.is_a? Plan
sub = :plans
else
sub = object.class.to_s.split('::').last.downcase.to_sym
end
if name
(registry[sub] ||= {})[name] = object
else
(registry[sub] ||= []) << object
end
end
|
.registry ⇒ Object
27
28
29
|
# File 'lib/bio-publisci/metadata/prov/prov.rb', line 27
def self.registry
@registry ||= {}
end
|
.run(string) ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/bio-publisci/metadata/prov/prov.rb', line 31
def self.run(string)
if File.exists? string
DSL::Singleton.new.instance_eval(IO.read(string),string)
else
DSL::Singleton.new.instance_eval(string)
end
end
|