# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig. # License: Apache License, Version 2.0 require File.dirname(__FILE__) + '/../../../spec_helper' module RTM::Navigation::Topic describe "characteristics" do before(:each) do @tm = get_used_tm_sys_tm @topic = @tm.get!("Person") end after(:each) do @tm.close end describe "#characteristics" do it "should give back an empty set if nothing matches" do topic = @tm.create_topic_by("Uni_Leipzig") topic.characteristics.size.should == 0 occ1 = topic.create_occurrence("Gruendungsjahr", "1409") topic.characteristics("super_Gruendungsjahr").size.should == 0 topic.characteristics("super_Gruendungsjahr").include?(occ1).should be_false end it "should give back the values of the Names and Occurrences included in Characteristics" do topic = @tm.create_topic_by("Uni_Leipzig") name1 = topic.create_name("Universität Leipzig") name2 = topic.create_name("University of Leipzig") occ1 = topic.create_occurrence("Gruendungsjahr", "1409") occ2 = topic.create_occurrence("Webseite", "http://www.topicmapslab.de") topic.characteristics.size.should == 4 topic.characteristics.should include name1, name2, occ1, occ2 end it "should give back Names and Occurrences of the subtype of the given argument" do topic = @tm.create_topic_by("Uni_Leipzig") name1 = topic.create_name("a_type","Universität Leipzig") @tm.get("a_type").add_supertype("a_super_type") topic.names.size.should == 1 topic.names.first.type.should == @tm.get("a_type") topic.names.first.type.supertypes.size.should == 1 topic.names.first.type.supertypes.first.should == @tm.get("a_super_type") topic.characteristics("a_super_type").size.should == 1 topic.characteristics("a_super_type").include?(name1).should be_true occ1 = topic.create_occurrence("Gruendungsjahr", "1409") @tm.get("Gruendungsjahr").add_supertype("super_Gruendungsjahr") topic.characteristics("super_Gruendungsjahr").size.should == 1 topic.characteristics("super_Gruendungsjahr").include?(occ1).should be_true end end #of describe "#characteristics" end #of describe "characteristics" end #of module