Class: PubliSci::Prov::Entity
- Inherits:
-
Object
- Object
- PubliSci::Prov::Entity
- Includes:
- Element
- Defined in:
- lib/publisci/metadata/prov/entity.rb
Defined Under Namespace
Classes: Derivations
Instance Attribute Summary collapse
-
#attributed_to(agent = nil) ⇒ Object
Returns the value of attribute attributed_to.
-
#derived_from(entity = nil, &block) ⇒ Object
Returns the value of attribute derived_from.
Instance Method Summary collapse
Methods included from Element
#__label, #__label=, #subject, #subject=, #subject_id
Methods included from CustomPredicate
Methods included from Vocabulary
Instance Attribute Details
#attributed_to(agent = nil) ⇒ Object
Returns the value of attribute attributed_to.
7 8 9 |
# File 'lib/publisci/metadata/prov/entity.rb', line 7 def attributed_to @attributed_to end |
#derived_from(entity = nil, &block) ⇒ Object
Returns the value of attribute derived_from.
6 7 8 |
# File 'lib/publisci/metadata/prov/entity.rb', line 6 def derived_from @derived_from end |
Instance Method Details
#generated_by(activity = nil) ⇒ Object
25 26 27 |
# File 'lib/publisci/metadata/prov/entity.rb', line 25 def generated_by(activity=nil) basic_keyword(:generated_by,:activities,activity) end |
#source(s = nil) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/publisci/metadata/prov/entity.rb', line 17 def source(s=nil) if s (@sources ||= []) << s else @sources end end |
#to_n3 ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/publisci/metadata/prov/entity.rb', line 37 def to_n3 str = "<#{subject}> a prov:Entity ;\n" str << "\tprov:wasGeneratedBy <#{generated_by}> ;\n" if generated_by str << "\tprov:wasAttributedTo <#{attributed_to}> ;\n" if attributed_to if derived_from derived_from.size.times.each{|k| der = derived_from[k] # if der.is_a?(Symbol) && Prov.entities[der] if der.is_a? Derivation str << "\tprov:wasDerivedFrom <#{der.entity}> ;\n" str << "\tprov:qualifiedDerivation <#{der.subject}> ;\n" else str << "\tprov:wasDerivedFrom <#{der}> ;\n" end } end add_custom(str) str << %Q(\trdfs:label "#{__label}" .\n\n) end |
#to_s ⇒ Object
59 60 61 |
# File 'lib/publisci/metadata/prov/entity.rb', line 59 def to_s subject end |