Sha256: 0ef4d155d7c5a67c6092617efdab4ce48c845cab95f3b746ef4369e9b4f1ebfa

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

module TestBnodeCapableAdapter
  def test_load_bnodes
    @adapter.load(File.dirname(File.expand_path(__FILE__)) + '/../test_bnode_data.nt')

    # loaded five triples in total
    assert_equal 8, @adapter.size

    # collecting the bnodes
    bnodes = Query.new.distinct(:s).where(:s,:p,:o).execute

    # triples contain two distinct bnodes
    assert_equal 3, bnodes.size

    # assert that _:a1 occurs in three triples
    assert_equal 3, Query.new.select(:p,:o).where(bnodes[0], :p, :o).execute.size
    # assert that _:a2 occurs in two triples
    assert_equal 2, Query.new.select(:p,:o).where(bnodes[1], :p, :o).execute.size
    # assert that _:a3 occurs in two triples
    assert_equal 3, Query.new.select(:p,:o).where(bnodes[2], :p, :o).execute.size
  end

  def test_bnodes
    @adapter.load(File.dirname(File.expand_path(__FILE__)) + '/../test_bnode_data.nt')

    #ObjectManager.construct_classes
    people = TEST::Person.find_all
    assert_equal 2, people.size
    assert_equal 29, people[1].age
    assert_equal "Another Person", TEST::Person.find_all[1].name
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activerdf_net7-1.7.2 test/adapters/test_bnode_capable_adapter.rb
activerdf_net7-1.7.1 test/adapters/test_bnode_capable_adapter.rb
activerdf_net7-1.7.0 test/adapters/test_bnode_capable_adapter.rb