Sha256: 6c7695f6a62429777339d4de7550dcc2409e8f0d75b173d72a5141d8aecb0541

Contents?: true

Size: 1.41 KB

Versions: 13

Compression:

Stored size: 1.41 KB

Contents

#   Copyright 2011 innoQ Deutschland GmbH
#
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

module IqRdf
  class BlankNode < Node

    attr_reader :node_id

    def initialize(node_id = nil)
      super
      @node_id = node_id
    end

    def to_turtle(parent_lang = nil)

    end

    def to_s(parent_lang = nil)
      "[\n#{(nodes.map{|pred| "#{pred} #{pred.nodes.map{|o| o.to_s(pred.lang || parent_lang)}.join(", ")}"}.join(";\n")).gsub(/^/, "    ")}\n]"
    end

    def build_predicate(*args, &block)
      IqRdf::PredicateNamespace.new(self, IqRdf::Default).build_predicate(*args, &block)
    end

    def build_xml(xml, &block)
      block.call({}, lambda {
          attrs = {}
          attrs["xml:lang"] = self.lang if self.lang
          xml.rdf(:Description, attrs) do
            self.nodes.each do |predicate|
              predicate.build_xml(xml)
            end
          end
        })
    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
iq_rdf-0.1.17 lib/iq_rdf/blank_node.rb
iq_rdf-0.1.16 lib/iq_rdf/blank_node.rb
iq_rdf-0.1.15 lib/iq_rdf/blank_node.rb
iq_rdf-0.1.14 lib/iq_rdf/blank_node.rb
iq_rdf-0.1.13 lib/iq_rdf/blank_node.rb
iq_rdf-0.1.12 lib/iq_rdf/blank_node.rb
iq_rdf-0.1.10 lib/iq_rdf/blank_node.rb
iq_rdf-0.1.8 lib/iq_rdf/blank_node.rb
iq_rdf-0.1.7 lib/iq_rdf/blank_node.rb
iq_rdf-0.1.6 lib/iq_rdf/blank_node.rb
iq_rdf-0.1.5 lib/iq_rdf/blank_node.rb
iq_rdf-0.1.4 lib/iq_rdf/blank_node.rb
iq_rdf-0.1.3 lib/iq_rdf/blank_node.rb