Class: RDF::Normalize::RDFC10::IdentifierIssuer
- Defined in:
- vendor/bundler/ruby/3.3.0/bundler/gems/rdf-normalize-5170ab39c807/lib/rdf/normalize/rdfc10.rb
Instance Method Summary collapse
-
#dup ⇒ IdentifierIssuer
Duplicate this issuer, ensuring that the issued identifiers remain distinct.
-
#identifier(node) ⇒ RDF::Node
Canonical identifier assigned to node.
-
#initialize(prefix = "c14n") ⇒ IdentifierIssuer
constructor
A new instance of IdentifierIssuer.
- #inspect ⇒ Object
-
#issue_identifier(node) ⇒ String
Return an identifier for this BNode.
- #issued ⇒ Object
-
#to_hash ⇒ Hash{Symbol => Symbol}
The issued identifiers map.
Constructor Details
#initialize(prefix = "c14n") ⇒ IdentifierIssuer
Returns a new instance of IdentifierIssuer.
396 397 398 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/rdf-normalize-5170ab39c807/lib/rdf/normalize/rdfc10.rb', line 396 def initialize(prefix = "c14n") @prefix, @counter, @issued = prefix, 0, {} end |
Instance Method Details
#dup ⇒ IdentifierIssuer
Duplicate this issuer, ensuring that the issued identifiers remain distinct
426 427 428 429 430 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/rdf-normalize-5170ab39c807/lib/rdf/normalize/rdfc10.rb', line 426 def dup other = super other.instance_variable_set(:@issued, @issued.dup) other end |
#identifier(node) ⇒ RDF::Node
Returns Canonical identifier assigned to node.
415 416 417 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/rdf-normalize-5170ab39c807/lib/rdf/normalize/rdfc10.rb', line 415 def identifier(node) @issued[node] end |
#inspect ⇒ Object
432 433 434 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/rdf-normalize-5170ab39c807/lib/rdf/normalize/rdfc10.rb', line 432 def inspect "{#{@issued.map {|k,v| "#{k.id}: #{v}"}.join(', ')}}" end |
#issue_identifier(node) ⇒ String
Return an identifier for this BNode
403 404 405 406 407 408 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/rdf-normalize-5170ab39c807/lib/rdf/normalize/rdfc10.rb', line 403 def issue_identifier(node) @issued[node] ||= begin res, @counter = @prefix + @counter.to_s, @counter + 1 res end end |
#issued ⇒ Object
410 411 412 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/rdf-normalize-5170ab39c807/lib/rdf/normalize/rdfc10.rb', line 410 def issued @issued.keys end |