spira 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES.md +5 -0
 - data/VERSION +1 -1
 - data/lib/spira/resource.rb +1 -1
 - data/lib/spira/resource/class_methods.rb +3 -3
 - data/lib/spira/resource/dsl.rb +1 -1
 - data/lib/spira/types.rb +1 -0
 - data/lib/spira/types/native.rb +22 -0
 - data/lib/spira/version.rb +1 -1
 - metadata +4 -3
 
    
        data/CHANGES.md
    CHANGED
    
    | 
         @@ -1,4 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # Changelog for Spira <http://github.com/datagraph/spira>
         
     | 
| 
      
 2 
     | 
    
         
            +
            ## 0.0.10
         
     | 
| 
      
 3 
     | 
    
         
            +
             * Use RDF::URI.intern on URIs generated via base URIs
         
     | 
| 
      
 4 
     | 
    
         
            +
             * Added a Spira::Types::Native, which will return the RDF::Value for a given
         
     | 
| 
      
 5 
     | 
    
         
            +
               predicate directly without any serialization or dserialization.
         
     | 
| 
       2 
6 
     | 
    
         | 
| 
       3 
7 
     | 
    
         
             
            ## 0.0.9
         
     | 
| 
       4 
8 
     | 
    
         
             
             * Fix a bug with Spira::Types::Any that prevented blank node objects
         
     | 
| 
         @@ -12,6 +16,7 @@ 
     | 
|
| 
       12 
16 
     | 
    
         
             
             * Updating a value to nil will now remove it from the repository on #save!
         
     | 
| 
       13 
17 
     | 
    
         
             
             * Tweaks to dirty tracking to correctly catch both changed and updated values.
         
     | 
| 
       14 
18 
     | 
    
         
             
               All tests pass for the first time with this change.
         
     | 
| 
      
 19 
     | 
    
         
            +
             * Change gemspec name to work with bundler
         
     | 
| 
       15 
20 
     | 
    
         | 
| 
       16 
21 
     | 
    
         
             
            ## 0.0.8
         
     | 
| 
       17 
22 
     | 
    
         
             
             * Remove type checking for repository addition.  More power in return for 
         
     | 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            0.0. 
     | 
| 
      
 1 
     | 
    
         
            +
            0.0.10
         
     | 
    
        data/lib/spira/resource.rb
    CHANGED
    
    
| 
         @@ -128,12 +128,12 @@ module Spira 
     | 
|
| 
       128 
128 
     | 
    
         
             
                        id_for(identifier.to_uri)
         
     | 
| 
       129 
129 
     | 
    
         
             
                      # see comment with #to_uri above, this might be a fragment
         
     | 
| 
       130 
130 
     | 
    
         
             
                      when identifier.is_a?(Addressable::URI)
         
     | 
| 
       131 
     | 
    
         
            -
                        id_for(RDF::URI. 
     | 
| 
      
 131 
     | 
    
         
            +
                        id_for(RDF::URI.intern(identifier))
         
     | 
| 
       132 
132 
     | 
    
         
             
                      # This is a #to_s or a URI fragment with a base uri.  We'll treat them the same.
         
     | 
| 
       133 
133 
     | 
    
         
             
                      # FIXME: when #/ makes it into RDF.rb proper, this can all be wrapped
         
     | 
| 
       134 
134 
     | 
    
         
             
                      # into the one case statement above.
         
     | 
| 
       135 
135 
     | 
    
         
             
                      else
         
     | 
| 
       136 
     | 
    
         
            -
                        uri = identifier.is_a?(RDF::URI) ? identifier : RDF::URI. 
     | 
| 
      
 136 
     | 
    
         
            +
                        uri = identifier.is_a?(RDF::URI) ? identifier : RDF::URI.intern(identifier.to_s)
         
     | 
| 
       137 
137 
     | 
    
         
             
                        case
         
     | 
| 
       138 
138 
     | 
    
         
             
                          when uri.absolute?
         
     | 
| 
       139 
139 
     | 
    
         
             
                            uri
         
     | 
| 
         @@ -141,7 +141,7 @@ module Spira 
     | 
|
| 
       141 
141 
     | 
    
         
             
                            raise ArgumentError, "Cannot create identifier for #{self} by String without base_uri; an RDF::URI is required" if self.base_uri.nil?
         
     | 
| 
       142 
142 
     | 
    
         
             
                          else
         
     | 
| 
       143 
143 
     | 
    
         
             
                            separator = self.base_uri.to_s[-1,1] =~ /(\/|#)/ ? '' : '/'
         
     | 
| 
       144 
     | 
    
         
            -
                            RDF::URI. 
     | 
| 
      
 144 
     | 
    
         
            +
                            RDF::URI.intern(self.base_uri.to_s + separator + identifier.to_s)
         
     | 
| 
       145 
145 
     | 
    
         
             
                        end
         
     | 
| 
       146 
146 
     | 
    
         
             
                    end
         
     | 
| 
       147 
147 
     | 
    
         
             
                  end
         
     | 
    
        data/lib/spira/resource/dsl.rb
    CHANGED
    
    | 
         @@ -227,7 +227,7 @@ module Spira 
     | 
|
| 
       227 
227 
     | 
    
         
             
                        raise ResourceDeclarationError, "A :predicate option is required for types without a default vocabulary"
         
     | 
| 
       228 
228 
     | 
    
         
             
                      else @default_vocabulary
         
     | 
| 
       229 
229 
     | 
    
         
             
                        separator = @default_vocabulary.to_s[-1,1] =~ /(\/|#)/ ? '' : '/'
         
     | 
| 
       230 
     | 
    
         
            -
                        RDF::URI. 
     | 
| 
      
 230 
     | 
    
         
            +
                        RDF::URI.intern(@default_vocabulary.to_s + separator + name.to_s)
         
     | 
| 
       231 
231 
     | 
    
         
             
                    end
         
     | 
| 
       232 
232 
     | 
    
         
             
                    if !(predicate.respond_to?(:to_uri))
         
     | 
| 
       233 
233 
     | 
    
         
             
                     raise ResourceDeclarationError, ":predicate options must be RDF::URIs or strings with a default vocabulary declared"
         
     | 
    
        data/lib/spira/types.rb
    CHANGED
    
    
| 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Spira::Types
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
              ##
         
     | 
| 
      
 4 
     | 
    
         
            +
              # This type is a native type, doing no conversion to Ruby types.  The naked
         
     | 
| 
      
 5 
     | 
    
         
            +
              # RDF::Value (URI, Node, Literal, etc) will be used, and no deserialization
         
     | 
| 
      
 6 
     | 
    
         
            +
              # is done.
         
     | 
| 
      
 7 
     | 
    
         
            +
              #
         
     | 
| 
      
 8 
     | 
    
         
            +
              # @see Spira::Type
         
     | 
| 
      
 9 
     | 
    
         
            +
              class Native
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                include Spira::Type
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                def self.unserialize(value)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  value
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                def self.serialize(value)
         
     | 
| 
      
 18 
     | 
    
         
            +
                  value
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
              end
         
     | 
| 
      
 22 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/spira/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version 
     | 
|
| 
       5 
5 
     | 
    
         
             
              segments: 
         
     | 
| 
       6 
6 
     | 
    
         
             
              - 0
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 0
         
     | 
| 
       8 
     | 
    
         
            -
              -  
     | 
| 
       9 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 8 
     | 
    
         
            +
              - 10
         
     | 
| 
      
 9 
     | 
    
         
            +
              version: 0.0.10
         
     | 
| 
       10 
10 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       11 
11 
     | 
    
         
             
            authors: 
         
     | 
| 
       12 
12 
     | 
    
         
             
            - Ben Lavender
         
     | 
| 
         @@ -15,7 +15,7 @@ bindir: 
     | 
|
| 
       15 
15 
     | 
    
         
             
            - bin
         
     | 
| 
       16 
16 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            date: 2010-10- 
     | 
| 
      
 18 
     | 
    
         
            +
            date: 2010-10-26 00:00:00 -05:00
         
     | 
| 
       19 
19 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       20 
20 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       21 
21 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -132,6 +132,7 @@ files: 
     | 
|
| 
       132 
132 
     | 
    
         
             
            - lib/spira/types/decimal.rb
         
     | 
| 
       133 
133 
     | 
    
         
             
            - lib/spira/types/float.rb
         
     | 
| 
       134 
134 
     | 
    
         
             
            - lib/spira/types/integer.rb
         
     | 
| 
      
 135 
     | 
    
         
            +
            - lib/spira/types/native.rb
         
     | 
| 
       135 
136 
     | 
    
         
             
            - lib/spira/types/string.rb
         
     | 
| 
       136 
137 
     | 
    
         
             
            - lib/spira/types/uri.rb
         
     | 
| 
       137 
138 
     | 
    
         
             
            - lib/spira/types.rb
         
     |