def invalidate!(activity_uri = nil, ignore_invalid = false)
      raise "Cannot invalidate #{rdf_subject}, does not exist." unless exists?

      # force a reload unless we have cached an invalidatedAtTime
      rdf_source.get({}, true) unless invalidated?
      # we check invalidated again in case the reload came back invalid
      if invalidated?
        return if ignore_invalid
        raise "Cannot invalidate #{rdf_subject}, already invalid." 
      end

      uri = RDF::URI(rdf_subject)
      
      rdf_source << [uri, INVALIDATED_BY_URI, activity_uri] unless 
        activity_uri.nil?
      rdf_source << [uri, INVALIDATED_TIME_URI, DateTime.now]

      rdf_source.save
    end
def invalidate!(activity_uri = nil, ignore_invalid = false)
      raise "Cannot invalidate #{rdf_subject}, does not exist." unless exists?

      # force a reload unless we have cached an invalidatedAtTime
      rdf_source.get({}, true) unless invalidated?
      # we check invalidated again in case the reload came back invalid
      if invalidated?
        return if ignore_invalid
        raise "Cannot invalidate #{rdf_subject}, already invalid." 
      end

      uri = RDF::URI(rdf_subject)
      
      rdf_source << [uri, INVALIDATED_BY_URI, activity_uri] unless 
        activity_uri.nil?
      rdf_source << [uri, INVALIDATED_TIME_URI, DateTime.now]

      rdf_source.save
    end
Invalidates the resource by marking it with a `prov:invalidatedAtTime`. If
 an `RDF::Term` is passed as the first argument, that term is used as the
 value of `prov:wasInvalidatedBy`.

 @example invalidating with an activity
   invalidatable_resource.invalidate!(RDF::URI('http://example.org/moomin'))
   invalidatable_resource.was_invalidated_by
   # => #<RDF::URI:0x2acab846109c URI:http://example.org/moomin>

 @param activity_uri [RDF::Term] a URI for the invalidating activity. If
   none is given, this defaults to `nil` and no `prov:wasInvalidatedBy`
   statement is added.
 @param ignore_invalid [Boolean] if true, supresses errors on already,
   invalid records

 @raise [RuntimeError] when the resource does not exist or is already
   invalid; unless `ignore_invalid` is `true`
 @return [void]