class PubliSci::Prov::Agent

Attributes

behalf_of[RW]
organization[RW]

Public Instance Methods

name(name=nil) click to toggle source
# File lib/publisci/metadata/prov/agent.rb, line 20
def name(name=nil)
  if name
    @name = name
  else
    @name
  end
end
name=(name) click to toggle source
# File lib/publisci/metadata/prov/agent.rb, line 28
def name=(name)
  @name = name
end
on_behalf_of(other_agent=nil) click to toggle source

def organization=(organization)

@organization = organization

end

# File lib/publisci/metadata/prov/agent.rb, line 48
def on_behalf_of(other_agent=nil)
  basic_keyword(:behalf_of,:agents,other_agent)
  # if other_agent
  #   @behalf_of = other_agent
  # elsif @on_behalf_of.is_a? Symbol
  #   raise "UnknownAgent: #{@on_behalf_of}" unless Prov.agents.has_key?(@on_behalf_of)
  #   @behalf_of = Prov.agents[@on_behalf_of]
  # else
  #   @behalf_of
  # end

  # @behalf_of
end
Also aliased as: worked_for
to_n3() click to toggle source
# File lib/publisci/metadata/prov/agent.rb, line 63
def to_n3
  str = "<#{subject}> a"
  if type
    case type.to_sym
    when :software
      str << " prov:SoftwareAgent ;\n"
    when :person
      str << " prov:Person ;\n"
    when :organization
      str << " prov:Organization ;\n"
    end
  else
    str << " prov:Agent ;\n"
  end

  if name
    if type && type.to_sym == :person
      str << "\tfoaf:givenName \"#{name}\" ;\n"
    else
      str << "\tfoaf:name \"#{name}\" ;\n"
    end
  end

  if on_behalf_of
    str << "\tprov:actedOnBehalfOf <#{on_behalf_of}> ;\n"
  end

  add_custom(str)

  str << "\trdfs:label \"#{__label}\" .\n\n"
end
to_s() click to toggle source
# File lib/publisci/metadata/prov/agent.rb, line 95
def to_s
  subject
end
type(t=nil) click to toggle source
# File lib/publisci/metadata/prov/agent.rb, line 8
def type(t=nil)
  if t
    @type = t.to_sym
  else
    @type
  end
end
type=(t) click to toggle source
# File lib/publisci/metadata/prov/agent.rb, line 16
def type=(t)
  @type = t.to_sym
end
worked_for(other_agent=nil)
Alias for: on_behalf_of