<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/active_sesame/spec_helpers.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,36 +1,36 @@
-module ActiveSesame
-  module RDFConstants
-    def self.literal_to_proc_hash
-      {
-       &quot;http://www.w3.org/2001/XMLSchema#string&quot; =&gt; :to_s,
-       &quot;http://www.w3.org/2001/XMLSchema#dateTime&quot; =&gt; :to_time,
-       &quot;http://www.w3.org/2001/XMLSchema#int&quot; =&gt; :to_i
-      }
-    end
+module ActiveSesame::RDFConstants
+  def self.literal_to_proc_hash
+    {
+      &quot;http://www.w3.org/2001/XMLSchema#string&quot; =&gt; :to_s,
+      &quot;http://www.w3.org/2001/XMLSchema#dateTime&quot; =&gt; :to_time,
+      &quot;http://www.w3.org/2001/XMLSchema#int&quot; =&gt; :to_i
+    }
+  end
 
-    def self.literals
-      [
-       &quot;http://www.w3.org/2001/XMLSchema#string&quot;,
-       &quot;http://www.w3.org/2001/XMLSchema#int&quot;,
-       &quot;http://www.w3.org/2001/XMLSchema#dateTime&quot;,
-      ]
-    end
+  def self.literals
+    [
+     &quot;http://www.w3.org/2001/XMLSchema#string&quot;,
+     &quot;http://www.w3.org/2001/XMLSchema#int&quot;,
+     &quot;http://www.w3.org/2001/XMLSchema#dateTime&quot;,
+    ]
+  end
 
-    def self.class_to_match_hash
-      {
-       String =&gt; &quot;xsd:string&quot;,
-       Time =&gt; &quot;xsd:dateTime&quot;,
-       Date =&gt; &quot;xsd:date&quot;,
-       Fixnum =&gt; &quot;xsd:integer&quot;
-      }
-    end
+  def self.class_to_match_hash
+    {
+      String =&gt; &quot;xsd:string&quot;,
+      Time =&gt; &quot;xsd:dateTime&quot;,
+      Date =&gt; &quot;xsd:date&quot;,
+      Fixnum =&gt; &quot;xsd:integer&quot;
+    }
+  end
 
-    def self.class_to_literal
-      {
-       String =&gt; &quot;http://www.w3.org/2001/XMLSchema#string&quot;,
-       Time =&gt; &quot;http://www.w3.org/2001/XMLSchema#dateTime&quot;,
-       Fixnum =&gt; &quot;http://www.w3.org/2001/XMLSchema#int&quot;
-      }
-    end
+  def self.class_to_literal
+    {
+      String =&gt; &quot;http://www.w3.org/2001/XMLSchema#string&quot;,
+      Time =&gt; &quot;http://www.w3.org/2001/XMLSchema#dateTime&quot;,
+      Date =&gt; &quot;http://www.w3.org/2001/XMLSchema#date&quot;,
+      Fixnum =&gt; &quot;http://www.w3.org/2001/XMLSchema#int&quot;
+    }
   end
 end
+</diff>
      <filename>lib/active_sesame/rdf_constants.rb</filename>
    </modified>
    <modified>
      <diff>@@ -25,8 +25,6 @@ module ActiveSesame
     end
 
     def group_save(xml)
-      xml = &quot;&lt;transaction&gt;#{xml}&lt;/transaction&gt;&quot;
-      #puts xml
       query_dispatch(&quot;statements&quot;, {:method =&gt; :post, &quot;content-type&quot; =&gt; &quot;application/x-rdftransaction&quot;, :body =&gt; xml})
     end
 
@@ -52,7 +50,7 @@ module ActiveSesame
     require 'rest-open-uri'
     require 'uri'
 
-    def included(klass)
+    def self.extended(klass)
       simple_rest_methods :size, :contexts, :namespaces
     end
 
@@ -66,7 +64,7 @@ module ActiveSesame
       return open(self.repository_uri + &quot;/&quot; + self.triple_store_id + slash + method_name.to_s + vars_if_get, args).read
     end
 
-    def simple_rest_methods(*method_names)
+    def self.simple_rest_methods(*method_names)
       method_names.each do |name|
         new_name = name.to_s
         define_method(new_name) { return query_dispatch(name) }</diff>
      <filename>lib/active_sesame/repository.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,22 @@
 require 'active_sesame'
+require 'spec_helpers'
 
 describe ActiveSesame do
+  before(:all) do
+    @repo = ActiveSesame::Repository.new(ActiveSesame::SesameProtocol, {
+                                           :repository_uri =&gt; &quot;http://localhost:8111/sesame/repositories&quot;,
+                                           :triple_store_id =&gt; &quot;test&quot;,
+                                           :location =&gt; &quot;http://localhost:8111/sesame/repositories/test&quot;,
+                                           :query_language =&gt; &quot;SPARQL&quot;,
+                                           :base_uri =&gt; &quot;http://www.fakeontology.org/ontology.owl#&quot;
+                                         })
+    @repo.group_save(ActiveSesame::TransactionBuilder.build_triples(SpecHelpers.triples_to_add, &quot;add&quot;))
+  end
+
+  after(:all) do
+    @repo.group_save(ActiveSesame::TransactionBuilder.build_triples(SpecHelpers.triples_to_add, &quot;remove&quot;))
+  end
+
   it &quot;should load all it's libraries&quot; do
     ActiveSesame.const_defined?(&quot;Base&quot;).should be_true
     ActiveSesame.const_defined?(&quot;Repository&quot;).should be_true
@@ -13,12 +29,6 @@ describe ActiveSesame do
     ActiveSesame.const_defined?(&quot;Behaviors&quot;).should be_true
   end
 
-  describe ActiveSesame::Repository do
-    it &quot;should connect to a triple store&quot; do
-      ActiveSesame::Repository.new
-    end
-  end
-
   describe ActiveSesame::Behaviors do
     describe ActiveSesame::Behaviors::Ontology do
       before do
@@ -57,3 +67,32 @@ describe ActiveSesame do
   describe ActiveSesame::Base do
   end
 end
+
+describe ActiveSesame::Repository do
+  before do
+    @repo = ActiveSesame::Repository.new(ActiveSesame::SesameProtocol, {
+                                           :repository_uri =&gt; &quot;http://localhost:8111/sesame/repositories&quot;,
+                                           :triple_store_id =&gt; &quot;test&quot;,
+                                           :location =&gt; &quot;http://localhost:8111/sesame/repositories/test&quot;,
+                                           :query_language =&gt; &quot;SPARQL&quot;,
+                                           :base_uri =&gt; &quot;http://www.fakeontology.org/ontology.owl#&quot;
+                                         })
+  end
+
+  it &quot;should add triples to the store&quot; do
+    @repo.group_save(ActiveSesame::TransactionBuilder.build_triples(SpecHelpers.triples_to_add, &quot;add&quot;))
+    @repo.size.to_i.should_not be_equal(0)
+  end
+
+  it &quot;should remove triples from the store&quot; do
+    @repo.group_save(ActiveSesame::TransactionBuilder.build_triples(SpecHelpers.triples_to_add, &quot;remove&quot;))
+    @repo.size.to_i.should be_equal(0)
+  end
+
+  it &quot;should be able to connect to the test triple store&quot; do
+    results = open(&quot;http://localhost:8111/sesame/repositories&quot;, :method =&gt; :get).read
+    results.include?(&quot;http://localhost:8111/sesame/repositories/test&quot;).should be_true
+  end
+end
+
+</diff>
      <filename>lib/active_sesame/spec_active_sesame.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,32 +1,28 @@
-module ActiveSesame
-  module TransactionBuilder
-    require 'rexml/document'
+module ActiveSesame::TransactionBuilder
 
-    def self.object_to_triples(object)
-      base_class = object.class.base_uri_location.gsub(/&lt;|&gt;/,&quot;&quot;) + object.class.rdf_class
-      full_transaction = self.build_triple(object.instance, &quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&quot;, base_class)
-      object.class.simple_attributes.keys.inject(full_transaction) do |transaction,attribute|
-        transaction += self.build_triple(object.instance, attribute, object.send(Support.uri_to_sym(attribute)))
-      end
+  def self.object_to_triples(object)
+    base_class = object.class.base_uri_location.gsub(/&lt;|&gt;/,&quot;&quot;) + object.class.rdf_class
+    full_transaction = self.build_triple(object.instance, &quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&quot;, base_class)
+    object.class.simple_attributes.keys.inject(full_transaction) do |transaction,attribute|
+      transaction += self.build_triple(object.instance, attribute, object.send(Support.uri_to_sym(attribute)))
     end
+  end
 
-    def self.build_triples(list_of_triples, trans_type='add')
-      xml_for_transation = list_of_triples.inject(&quot;&lt;#{trans_type}&gt;&quot;) do |xml, triple|
-        triple_hash = triple.to_h
-        xml += type_cast(triple_hash[:subject]) + type_cast(triple_hash[:predicate]) + type_cast(triple_hash[:object])
-        xml
-      end
-      xml_for_transation += &quot;&lt;/#{trans_type}&gt;&quot;
+  def self.build_triples(list_of_triples, trans_type='add')
+    xml_for_transation = list_of_triples.inject(&quot;&lt;transaction&gt;&quot;) do |xml, triple|
+      xml += &quot;&lt;#{trans_type}&gt;&quot; + type_cast(triple[:subject]) + type_cast(triple[:predicate]) + type_cast(triple[:object]) + &quot;&lt;/#{trans_type}&gt;&quot;
+      xml
     end
+    xml_for_transation += &quot;&lt;/transaction&gt;&quot;
+  end
 
-    def self.type_cast(uri_or_literal)
-      if uri_or_literal =~ /http:\/\//
-        &quot;&lt;uri&gt;&amp;lt;#{uri_or_literal}&amp;gt;&lt;/uri&gt;&quot;
-      else
-        #xml += &quot;\t\t&lt;literal datatype=\&quot;&amp;lt;#{RDFConstants.class_to_literal[uri_or_literal.class]}&amp;gt;\&quot;&gt;#{uri_or_literal}&lt;/literal&gt;\n&quot;
-        &quot;&lt;literal&gt;#{uri_or_literal}&lt;/literal&gt;&quot;
-      end
+  def self.type_cast(uri_or_literal)
+    if uri_or_literal =~ /http:\/\//
+      &quot;&lt;uri&gt;#{uri_or_literal}&lt;/uri&gt;&quot;
+    else
+      &quot;&lt;literal datatype=\&quot;#{ActiveSesame::RDFConstants.class_to_literal[uri_or_literal.class]}\&quot;&gt;#{uri_or_literal}&lt;/literal&gt;&quot;
     end
-
   end
+
 end
+</diff>
      <filename>lib/active_sesame/transaction_builder.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>aecb7b506e06b398a40020627383cb506648ea77</id>
    </parent>
  </parents>
  <author>
    <name>Max Warnock</name>
    <email>circuitshaman@email.com</email>
  </author>
  <url>http://github.com/mwarnock/activesesame/commit/3f72474346d20a26472162c2bdeafde161f3e92d</url>
  <id>3f72474346d20a26472162c2bdeafde161f3e92d</id>
  <committed-date>2009-07-09T20:00:08-07:00</committed-date>
  <authored-date>2009-07-09T20:00:08-07:00</authored-date>
  <message>Fixed Repository and added Specs

Fixed the SesameProtocol module to add the size, context, and namespaces
methods when used as extension.
Fixed the TransactionBuilder to add datatypes and create the whole
transaction xml document.
Added specs to add and remove triples from the test triples store.  Also
added before(:all) and after(:all) to populate and clear the triple
store for the ActiveSesame spec description.</message>
  <tree>85a987f2e0a3548da275194d6006bba2ed21b592</tree>
  <committer>
    <name>Max Warnock</name>
    <email>circuitshaman@email.com</email>
  </committer>
</commit>
