Sha256: 6247e7a22614201540b1f369341dad05a99a3ce4b99bc65c577dffcc97ad1535

Contents?: true

Size: 924 Bytes

Versions: 1

Compression:

Stored size: 924 Bytes

Contents

# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
# License:   Apache License, Version 2.0

module RTM
  # Some useful or maybe not so useful stuff which I don't know how to put else.
  module PimpMyApi
    module Occurrence

      # Create an association out of this occurrence
      #   Norwegian isa: Language
      #   - name: "Norwegian"
      #   - iso639: "no"
      #   iso639: "no"
      #   webpage: http://example.org
      # to
      #   webpage( subject: Norwegian, occ: =http://www.example.org )
      def externalize
        a = parent.create_association
        a.create_role parent, RTM::PSI[:subject]
        a.create_role self.type, self.value # TODO what should be exactly done with value? prepend something? dependend on param?
        a
      end
    end
    def externalize!(*args)
      a = externalize(*args)
      remove
      a
    end
    RTM.register_extension( self )
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rtm-0.2.0 lib/rtm/sugar/occurrence/externalize.rb