<commit_before>$:.unshift "."
require File.join(File.dirname(__FILE__), 'spec_helper')
require 'rdf/rdfxml/patches/graph_properties'
require 'rdf/rdfxml/patches/seq'

class EX < RDF::Vocabulary("http://example.com/"); end

describe RDF::Graph do
  describe "properties" do
    subject { RDF::Graph.new }
    
    it "should get asserted properties" do
      subject << [EX.a, EX.b, EX.c]
      subject.properties(EX.a).should be_a(Hash)
      subject.properties(EX.a).size.should == 1
      subject.properties(EX.a).has_key?(EX.b.to_s).should be_true
      subject.properties(EX.a)[EX.b.to_s].should == [EX.c]
    end
    
    it "should get asserted properties with 2 properties" do
      subject << [EX.a, EX.b, EX.c]
      subject << [EX.a, EX.b, EX.d]
      subject.properties(EX.a).should be_a(Hash)
      subject.properties(EX.a).size.should == 1
      subject.properties(EX.a).has_key?(EX.b.to_s).should be_true
      subject.properties(EX.a)[EX.b.to_s].should include(EX.c, EX.d)
    end

    it "should get asserted properties with 3 properties" do
      subject << [EX.a, EX.b, EX.c]
      subject << [EX.a, EX.b, EX.d]
      subject << [EX.a, EX.b, EX.e]
      subject.properties(EX.a).should be_a(Hash)
      subject.properties(EX.a).size.should == 1
      subject.properties(EX.a).has_key?(EX.b.to_s).should be_true
      subject.properties(EX.a)[EX.b.to_s].should include(EX.c, EX.d, EX.e)
    end
    
    it "should get asserted properties for a RDF::Node" do
      bn = RDF::Node.new
      subject << [bn, EX.b, EX.c]
      subject.properties(bn).should be_a(Hash)
      subject.properties(bn).size.should == 1
      subject.properties(bn).has_key?(EX.b.to_s).should be_true
      subject.properties(bn)[EX.b.to_s].should == [EX.c]
    end

    it "should get asserted type with single type" do
      subject << [EX.a, RDF.type, EX.Audio]
      subject.properties(EX.a)[RDF.type.to_s].should == [EX.Audio]
      subject.type_of(EX.a).should == [EX.Audio]
    end
  
    it "should get nil with no type" do
      subject << [EX.a, EX.b, EX.c]
      subject.properties(EX.a)[RDF.type.to_s].should == nil
      subject.type_of(EX.a).should == []
    end
  end

  describe "rdf:_n sequences" do
    subject {
      g = RDF::Graph.new
      g << [EX.Seq, RDF.type, RDF.Seq]
      g << [EX.Seq, RDF._1, EX.john]
      g << [EX.Seq, RDF._2, EX.jane]
      g << [EX.Seq, RDF._3, EX.rick]
      g
    }
    
    it "should return object list" do
      subject.seq(EX.Seq).should == [EX.john, EX.jane, EX.rick]
    end
  end
end<commit_msg>Remove spec for removed Graph.seq.<commit_after>$:.unshift "."
require File.join(File.dirname(__FILE__), 'spec_helper')
require 'rdf/rdfxml/patches/graph_properties'

class EX < RDF::Vocabulary("http://example.com/"); end

describe RDF::Graph do
  describe "properties" do
    subject { RDF::Graph.new }
    
    it "should get asserted properties" do
      subject << [EX.a, EX.b, EX.c]
      subject.properties(EX.a).should be_a(Hash)
      subject.properties(EX.a).size.should == 1
      subject.properties(EX.a).has_key?(EX.b.to_s).should be_true
      subject.properties(EX.a)[EX.b.to_s].should == [EX.c]
    end
    
    it "should get asserted properties with 2 properties" do
      subject << [EX.a, EX.b, EX.c]
      subject << [EX.a, EX.b, EX.d]
      subject.properties(EX.a).should be_a(Hash)
      subject.properties(EX.a).size.should == 1
      subject.properties(EX.a).has_key?(EX.b.to_s).should be_true
      subject.properties(EX.a)[EX.b.to_s].should include(EX.c, EX.d)
    end

    it "should get asserted properties with 3 properties" do
      subject << [EX.a, EX.b, EX.c]
      subject << [EX.a, EX.b, EX.d]
      subject << [EX.a, EX.b, EX.e]
      subject.properties(EX.a).should be_a(Hash)
      subject.properties(EX.a).size.should == 1
      subject.properties(EX.a).has_key?(EX.b.to_s).should be_true
      subject.properties(EX.a)[EX.b.to_s].should include(EX.c, EX.d, EX.e)
    end
    
    it "should get asserted properties for a RDF::Node" do
      bn = RDF::Node.new
      subject << [bn, EX.b, EX.c]
      subject.properties(bn).should be_a(Hash)
      subject.properties(bn).size.should == 1
      subject.properties(bn).has_key?(EX.b.to_s).should be_true
      subject.properties(bn)[EX.b.to_s].should == [EX.c]
    end

    it "should get asserted type with single type" do
      subject << [EX.a, RDF.type, EX.Audio]
      subject.properties(EX.a)[RDF.type.to_s].should == [EX.Audio]
      subject.type_of(EX.a).should == [EX.Audio]
    end
  
    it "should get nil with no type" do
      subject << [EX.a, EX.b, EX.c]
      subject.properties(EX.a)[RDF.type.to_s].should == nil
      subject.type_of(EX.a).should == []
    end
  end
end
{'fraction_non_alphanumeric': 0.16045723962743438, 'fraction_numerical': 0.0031752751905165114, 'mean_word_length': 2.682774746687451, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 3}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2440322', 'n_tokens_mistral': 1770, 'n_tokens_neox': 1742, 'n_words': 353}