class LD4L::OpenAnnotationRDF::Configuration
Used by LD4L::OpenAnnotationRDF
class to configureā¦
-
local_minter
@example Configure all configurable properties
LD4L::OpenAnnotationRDF.configure do |config| config.base_uri = "http://www.example.org/annotations/" config.localname_minter = lambda { |prefix=""| prefix+SecureRandom.uuid } config.unique_tags = true end
@example Usage of base uri and local name
# uri = base_uri + localname" annotation = LD4L::OpenAnnotationRDF::CommentAnnotation.new( ActiveTriples::LocalName::Minter.generate_local_name( LD4L::OpenAnnotationRDF::CommentBody, 10, 'a', LD4L::OpenAnnotationRDF.configuration.localname_minter )) annotation.rdf_subject # => "http://www.example.org/annotations/a9f85752c-9c2c-4a65-997a-68482895a656"
@note Use LD4L::OpenAnnotationRDF.configure
to call the methods in this class. See 'Configure all configurable
properties' example for most common approach to configuration.
Attributes
base_uri[R]
@overload base_uri
Get the base_uri to be used when generating rdf_subjects for new objects. See example configuration and usage in class documentation examples. @return the configured base_uri
@overload base_uri
=(new_base_uri)
Set the base_uri to be used when generating rdf_subjects for new objects. See example configuration and usage in class documentation examples. @param [String] new value for the base_uri @note base_uri will only take effect when a model class is first created. Once the model class is created, the base_uri is bound to the class.
localname_minter[R]
@overload localname_minter
Get the localname_minter to be used when generating rdf_subjects for new objects. See example configuration and usage in class documentation examples. @return the configured localname_minter
@overload localname_minter
=(new_localname_minter)
Set the localname_minter to be used when generating rdf_subjects for new objects. See example configuration and usage in class documentation examples. @param [String] new value for the localname_minter
Public Class Methods
new()
click to toggle source
# File lib/ld4l/open_annotation_rdf/configuration.rb, line 84 def initialize @base_uri = self.class.send(:default_base_uri) @localname_minter = self.class.send(:default_localname_minter) @unique_tags = self.class.send(:default_unique_tags) end
Private Class Methods
default_base_uri()
click to toggle source
# File lib/ld4l/open_annotation_rdf/configuration.rb, line 68 def self.default_base_uri @default_base_uri = "http://localhost/".freeze end
default_localname_minter()
click to toggle source
# File lib/ld4l/open_annotation_rdf/configuration.rb, line 73 def self.default_localname_minter # by setting to nil, it will use the default minter in the minter gem @default_localname_minter = nil end
Public Instance Methods
base_uri=(new_base_uri)
click to toggle source
# File lib/ld4l/open_annotation_rdf/configuration.rb, line 90 def base_uri=(new_base_uri) @base_uri = new_base_uri end
localname_minter=(new_minter)
click to toggle source
# File lib/ld4l/open_annotation_rdf/configuration.rb, line 101 def localname_minter=(new_minter) @localname_minter = new_minter end
reset_base_uri()
click to toggle source
Reset the base_uri
to be used when generating rdf_subject for new objects back to the default configuration.
# File lib/ld4l/open_annotation_rdf/configuration.rb, line 97 def reset_base_uri @base_uri = self.class.send(:default_base_uri) end
reset_localname_minter()
click to toggle source
Reset the minter to be used to generate the local name portion of the rdf_subject for new objects to the default minter.
# File lib/ld4l/open_annotation_rdf/configuration.rb, line 109 def reset_localname_minter @localname_minter = self.class.send(:default_localname_minter) end