<commit_before>require File.join(File.dirname(__FILE__), 'spec_helper')

describe "RDF::Node#to_sxp" do
  specify { RDF::Node.new("a").to_sxp.should == %q("_:a")}
end

describe "RDF::Literal#to_sxp" do
  specify { RDF::Literal.new("a").to_sxp.should == %q("a")}
  specify { RDF::Literal.new("a", :language => "en-us").to_sxp.should == %q("a"@en-us)}
  specify { RDF::Literal.new("a", :datatype => RDF::XSD.string).to_sxp.should == %q("a"^^<http://www.w3.org/2001/XMLSchema#string>)}
end

describe "RDF::URI#to_sxp" do
  specify { RDF::URI("http://example.com").to_sxp.should == %q(<http://example.com>)}
end

describe "RDF::Query::Variable#to_sxp" do
  specify { RDF::Query::Variable.new("a").to_sxp.should == %q(?a)}
end

describe "RDF::Statement#to_sxp" do
  {
    RDF::Statement.new(RDF::URI("a"), RDF::URI("b"), RDF::URI("c")) => %q((triple <a> <b> <c>)),
    RDF::Statement.new(RDF::URI("a"), RDF::Query::Variable.new("b"), RDF::Literal.new("c")) =>
      %q((triple <a> ?b "c"))
  }.each_pair do |st, sxp|<commit_msg>Serialize RDF::Query::Pattern, not RDF::Triple to sxp.<commit_after>require File.join(File.dirname(__FILE__), 'spec_helper')

describe "RDF::Node#to_sxp" do
  specify { RDF::Node.new("a").to_sxp.should == %q("_:a")}
end

describe "RDF::Literal#to_sxp" do
  specify { RDF::Literal.new("a").to_sxp.should == %q("a")}
  specify { RDF::Literal.new("a", :language => "en-us").to_sxp.should == %q("a"@en-us)}
  specify { RDF::Literal.new("a", :datatype => RDF::XSD.string).to_sxp.should == %q("a"^^<http://www.w3.org/2001/XMLSchema#string>)}
end

describe "RDF::URI#to_sxp" do
  specify { RDF::URI("http://example.com").to_sxp.should == %q(<http://example.com>)}
end

describe "RDF::Query::Variable#to_sxp" do
  specify { RDF::Query::Variable.new("a").to_sxp.should == %q(?a)}
end

describe "RDF::Query::Pattern#to_sxp" do
  {
    RDF::Query::Pattern.new(RDF::URI("a"), RDF::URI("b"), RDF::URI("c")) => %q((triple <a> <b> <c>)),
    RDF::Query::Pattern.new(RDF::URI("a"), RDF::Query::Variable.new("b"), RDF::Literal.new("c")) =>
      %q((triple <a> ?b "c"))
  }.each_pair do |st, sxp|
{'fraction_non_alphanumeric': 0.263558515699334, 'fraction_numerical': 0.004757373929590866, 'mean_word_length': 5.762057877813505, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2451621', 'n_tokens_mistral': 907, 'n_tokens_neox': 894, 'n_words': 128}