Sha256: b73997b35a966210f40063e57d05d70686e563a66e08b1b0f0e0a9e239e7d98c
Contents?: true
Size: 1.98 KB
Versions: 3
Compression:
Stored size: 1.98 KB
Contents
# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig. # License: Apache License, Version 2.0 module RTM::Sugar::Occurrence module External # Creates an association out of this occurrence which represents the # occurrence information in relation to the parent topic. # # The association is of type "http://psi.topicmapslab.de/subject-representation". # It includes two roles. The parent topic plays the role of type # "http://psi.topicmapslab.de/represented-subject". The topic with the # subject locator created from the occurrence value plays the role # of a type the same as the occurrence type. # # The subject locator will be resolved using the get-method of RTM::TopicMap, # that means if the occurrence value is stored as String and is not a valid uri # the base_iri of the topic map is used to create one. # # The occurrence datatype may be xsd:anyURI as well as xsd:String. # The occurrence value must be a valid URL. # # Example: Creates an association out of the occurrence with value # "http://www.leipzig.de" and type "webpage" of the topic Leipzig: # * association type: subject_representation # * role 1: Leipzig plays the role "represented_subject" # * role 2: topic with subject locator "http://www.leipzig.de" plays the role "webpage" # # :call-seq: # externalize -> Association # def externalize topic_map.create_association(RTM::PSI[:subject_representation], RTM::PSI[:represented_subject] => parent, self.type => "=#{self.value}") end # Executes externalize and removes this occurrence from the topic map afterwards # # :call-seq: # externalize! # def externalize!(*args) association = externalize(*args) remove return association end # Returns true, if the datatype of this occurrence equals xsd:anyURI. def external? return self.datatype.reference == RTM::PSI[:IRI] ? true : false end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rtm-0.3.0 | lib/rtm/sugar/occurrence/external.rb |
rtm-0.2.1 | lib/rtm/sugar/occurrence/external.rb |
rtm-0.2 | lib/rtm/sugar/occurrence/external.rb |