Sha256: 78eeb0c7b305960018512d8970b9368e0d51ab734f81e2bcfeacb9163c183050
Contents?: true
Size: 1.67 KB
Versions: 1
Compression:
Stored size: 1.67 KB
Contents
require File.join(File.dirname(__FILE__), 'spec_helper') describe "ConjunctiveGraph" do before(:each) do @ex = Namespace.new("http://example.org/", "ex") @identifier = URIRef.new("http://store.identifier") @store = MemoryStore.new(@identifier) end subject { ConjunctiveGraph.new(:store => @store)} it "should should have same identifier as store" do subject.identifier.should == @identifier end it "should have a default context" do subject.default_context.should be_a(Graph) subject.default_context.identifier.should == @identifier subject.default_context.store.should == @store end it "should add triples to default context" do t = Triple.new(@ex.a, @ex.b, @ex.c) subject.add(t) count = 0 subject.triples do |t, ctx| t.should == t ctx.should be_a(Graph) ctx.identifier.should == @identifier count += 1 end count.should == 1 end it "should retrieve triples from all contexts" do g = Graph.new(:store => @store) t = Triple.new(@ex.a, @ex.b, @ex.c) g.add(t) count = 0 subject.triples do |t, ctx| t.should == t ctx.should == g count += 1 end count.should == 1 end it "should parse into new context" do n3_string = "<http://example.org/> <http://xmlns.com/foaf/0.1/name> \"Gregg Kellogg\" . " graph = subject.parse(n3_string, "http://foo.bar", :type => :n3) graph.identifier.should == "http://foo.bar" subject.size.should == 1 t = subject.triples.first t.subject.to_s.should == "http://example.org/" t.predicate.to_s.should == "http://xmlns.com/foaf/0.1/name" t.object.to_s.should == "Gregg Kellogg" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rdf_context-0.4.2 | spec/conjunctive_graph_spec.rb |